Skip to content

Commit

Permalink
Update the way how to remove environment variables for Jupyter ntb
Browse files Browse the repository at this point in the history
This change slightly simplifies the way how the variables are removed
from the Jupyter spawner page for the notebook - now it doesn't depend
on particular variable values, but simply clicks until the remove button
is present on the page.

Another change here is that this variable removal is now run also in
case that the given set of variables to the `Spawn Notebook With
Arguments` keyword is empty. This will assure that any eventual
leftovers from previous test are cleaned up properly not affecting this
current test.
  • Loading branch information
jstourac committed Nov 25, 2024
1 parent a48d84d commit d47c4e7
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ods_ci/tests/Resources/Page/ODH/JupyterHub/JupyterHubSpawner.robot
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,18 @@ Add Spawner Environment Variable

Remove All Spawner Environment Variables
[Documentation] Removes all existing environment variables in the Spawner
@{env_vars_list} = Create List
@{env_elements} = Get WebElements xpath://*[.='Variable name']/../../div[2]/input

# We need to fist get the env values and remove them later to avoid a
# selenium error due to modifiying the DOM while iterating its contents
FOR ${element} IN @{env_elements}
${txt} = Get Value ${element}
Append To List ${env_vars_list} ${txt}
END

FOR ${env} IN @{env_vars_list}
Remove Spawner Environment Variable ${env}
${remove_env_btn_xpath} = Set Variable //*[@data-id="remove-env-var-button"]
${first_remove_env_btn_xpath} = Set Variable
... //*[@class="odh-notebook-controller__env-var-row"][1]${remove_env_btn_xpath}

WHILE ${TRUE}
${remove_btn_number} = Get Element Count ${remove_env_btn_xpath}
IF ${remove_btn_number} > 0
Click Button ${first_remove_env_btn_xpath}
Sleep 0.5s # Give browser time to react
ELSE
BREAK
END
END

Remove Spawner Environment Variable
Expand Down Expand Up @@ -359,8 +359,8 @@ Spawn Notebook With Arguments # robocop: disable
Capture Page Screenshot reload.png
Wait Until JupyterHub Spawner Is Ready
END
Remove All Spawner Environment Variables
IF &{envs}
Remove All Spawner Environment Variables
FOR ${key} ${value} IN &{envs}[envs]
Sleep 1
Add Spawner Environment Variable ${key} ${value}
Expand Down

0 comments on commit d47c4e7

Please sign in to comment.