Skip to content

Commit

Permalink
Update dev requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Feb 9, 2024
1 parent c81c58e commit a267a13
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
11 changes: 5 additions & 6 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
jupyter_packaging==0.7.12
flaky==3.7.0
notebook==6.4.10
pre-commit==2.17.0
pytest==7.0.1
pytest-tornasync==0.6.0.post2
selenium==3.141.0
wheel==0.37.1
notebook==6.5.4
pre-commit==3.6.0
pytest==7.4.4
selenium==4.17.2
wheel==0.42.0
# jupyterlab is installed separately so we can test multiple versions
46 changes: 23 additions & 23 deletions tests/test_offlinenotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ def initialise_firefox(self, downloaddir, url):
# Comment this out to see the browser window
options.headless = HEADLESS

kwargs = {"firefox_profile": profile, "options": options}
options.profile = profile
if FIREFOX_BIN:
kwargs["firefox_binary"] = FIREFOX_BIN
self.driver = webdriver.Firefox(**kwargs)
options.binary_location = FIREFOX_BIN
self.driver = webdriver.Firefox(options=options)
self.wait = WebDriverWait(self.driver, TIMEOUT)

self.driver.get(url)
Expand Down Expand Up @@ -141,38 +141,38 @@ def download_visible(self):
return size, ncells

def save_to_browser_storage(self):
self.driver.find_element_by_xpath(
"//button[@title='Save to browser storage']"
self.driver.find_element(
By.XPATH, "//button[@title='Save to browser storage']"
).click()
dialog = self.wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "div.modal-dialog"))
)

assert dialog.find_element_by_css_selector("h4.modal-title").text == (
assert dialog.find_element(By.CSS_SELECTOR, "h4.modal-title").text == (
"Notebook saved to browser storage"
)
assert dialog.find_element_by_css_selector("div.modal-body").text == (
assert dialog.find_element(By.CSS_SELECTOR, "div.modal-body").text == (
"repoid: https://github.com/manics/jupyter-offlinenotebook\n"
"path: example.ipynb"
)
dialog.find_element_by_css_selector("button.btn-default").click()
dialog.find_element(By.CSS_SELECTOR, "button.btn-default").click()

def restore_from_browser_storage(self):
self.driver.find_element_by_xpath(
"//button[@title='Restore from browser storage']"
self.driver.find_element(
By.XPATH, "//button[@title='Restore from browser storage']"
).click()
dialog = self.wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "div.modal-dialog"))
)

assert dialog.find_element_by_css_selector("h4.modal-title").text == (
assert dialog.find_element(By.CSS_SELECTOR, "h4.modal-title").text == (
"This will replace your current notebook with"
)
assert dialog.find_element_by_css_selector("div.modal-body").text == (
assert dialog.find_element(By.CSS_SELECTOR, "div.modal-body").text == (
"repoid: https://github.com/manics/jupyter-offlinenotebook\n"
"path: example.ipynb"
)
buttons = dialog.find_elements_by_css_selector("button.btn-default")
buttons = dialog.find_elements(By.CSS_SELECTOR, "button.btn-default")
assert buttons[0].text == "OK"
assert buttons[1].text == "Cancel"
buttons[0].click()
Expand Down Expand Up @@ -248,8 +248,8 @@ def download_visible(self):
return size, ncells

def save_to_browser_storage(self):
self.driver.find_element_by_xpath(
"//button[@title='Save to browser storage']"
self.driver.find_element(
By.XPATH, "//button[@title='Save to browser storage']"
).click()
dialog = self.wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "div.jp-Dialog-content"))
Expand All @@ -259,18 +259,18 @@ def save_to_browser_storage(self):
el = "span"
else:
el = "div"
assert dialog.find_element_by_css_selector(f"{el}.jp-Dialog-header").text == (
assert dialog.find_element(By.CSS_SELECTOR, f"{el}.jp-Dialog-header").text == (
"Notebook saved to browser storage"
)
assert dialog.find_element_by_css_selector("span.jp-Dialog-body").text == (
assert dialog.find_element(By.CSS_SELECTOR, "span.jp-Dialog-body").text == (
"repoid: https://github.com/manics/jupyter-offlinenotebook "
"path: example.ipynb"
)
dialog.find_element_by_css_selector("button.jp-Dialog-button").click()
dialog.find_element(By.CSS_SELECTOR, "button.jp-Dialog-button").click()

def restore_from_browser_storage(self):
self.driver.find_element_by_xpath(
"//button[@title='Restore from browser storage']"
self.driver.find_element(
By.XPATH, "//button[@title='Restore from browser storage']"
).click()
dialog = self.wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "div.jp-Dialog-content"))
Expand All @@ -280,14 +280,14 @@ def restore_from_browser_storage(self):
el = "span"
else:
el = "div"
assert dialog.find_element_by_css_selector(f"{el}.jp-Dialog-header").text == (
assert dialog.find_element(By.CSS_SELECTOR, f"{el}.jp-Dialog-header").text == (
"This will replace your current notebook with"
)
assert dialog.find_element_by_css_selector("span.jp-Dialog-body").text == (
assert dialog.find_element(By.CSS_SELECTOR, "span.jp-Dialog-body").text == (
"repoid: https://github.com/manics/jupyter-offlinenotebook "
"path: example.ipynb"
)
buttons = dialog.find_elements_by_css_selector("button.jp-Dialog-button")
buttons = dialog.find_elements(By.CSS_SELECTOR, "button.jp-Dialog-button")
assert buttons[0].text == "Cancel"
assert buttons[1].text == "OK"
buttons[1].click()
Expand Down

0 comments on commit a267a13

Please sign in to comment.