Skip to content

Commit

Permalink
f-m: notebook tests
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Sep 15, 2023
1 parent 42ecca5 commit d2678fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 54 deletions.
21 changes: 0 additions & 21 deletions notebooks/computational_resources.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,6 @@
"display(resources1)\n",
"display(resources2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ee9ed2e5",
"metadata": {},
"outputs": [],
"source": [
"db = awb.databases.NewComputationalResourcesDatabaseWidget()\n",
"display(db)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "11b53118",
"metadata": {},
"outputs": [],
"source": [
"print(db.code_selector.value)"
]
}
],
"metadata": {
Expand Down
40 changes: 7 additions & 33 deletions tests_notebooks/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,50 +128,24 @@ def test_computational_resources_code_setup(
# Select daint.cscs.ch domain
driver.find_element(By.XPATH, '(//option[text()="daint.cscs.ch"])[1]').click()

# Select computer multicore
driver.find_element(By.XPATH, '(//option[text()="multicore"])[1]').click()
# Select computer mc
driver.find_element(By.XPATH, '(//option[text()="mc"])[1]').click()

# select code pw-7.0-multicore
driver.find_element(By.XPATH, '(//option[text()="pw-7.0-multicore"])[1]').click()
# select code
driver.find_element(By.XPATH, '(//option[text()="cp2k-9.1"])[1]').click()

# fill the SSH username
driver.find_element(
By.XPATH, "(//label[text()='username:'])[1]/following-sibling::input"
).send_keys("dummyuser")

# click the quick setup
driver.find_element(By.XPATH, '(//button[text()="Quick Setup"])[1]').click()
time.sleep(1.0)

# check the new code pw-7.0@daint-mc is in code list
output = aiidalab_exec("verdi code list").decode().strip()
assert "pw-7.0@daint-mc" in output

# Set the second code of the same computer
# issue https://github.com/aiidalab/aiidalab-widgets-base/issues/416
# click the "Setup new code" button
driver.find_element(By.XPATH, '(//button[text()="Setup new code"])[2]').click()

# Select daint.cscs.ch domain
driver.find_element(By.XPATH, '(//option[text()="daint.cscs.ch"])[2]').click()

# Select computer multicore
driver.find_element(By.XPATH, '(//option[text()="multicore"])[2]').click()

# select code pw-7.0-multicore
driver.find_element(By.XPATH, '(//option[text()="dos-7.0-multicore"])[2]').click()

# fill the SSH username
# Get the element of index 3 which is the SSH username of second widget
# the one of index 2 is the SSH username in detail setup of the first widget.
driver.find_element(
By.XPATH, "(//label[text()='username:'])[3]/following-sibling::input"
By.XPATH, "(//label[text()='Slurm account'])[1]/following-sibling::input"
).send_keys("dummyuser")

# click the quick setup
driver.find_element(By.XPATH, '(//button[text()="Quick Setup"])[2]').click()
driver.find_element(By.XPATH, '(//button[text()="Quick Setup"])').click()
time.sleep(1.0)

# check the new code pw-7.0@daint-mc is in code list
output = aiidalab_exec("verdi code list").decode().strip()
assert "dos-7.0@daint-mc" in output
assert "cp2k-9.1@daint-mc" in output

0 comments on commit d2678fd

Please sign in to comment.