Skip to content

Commit

Permalink
Fix end-to-end tests
Browse files Browse the repository at this point in the history
  • Loading branch information
treiher committed Oct 31, 2023
1 parent 4065fab commit 8df6155
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 4 additions & 6 deletions tests/e2e/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,11 @@ def title(self) -> str:
def url(self) -> str:
raise NotImplementedError

def load(self, *, accept_unsaved_changes: bool = False) -> None:
self._driver.get(f"http://{HOST}:{PORT}/#{self.url}")

if accept_unsaved_changes:
alert = self.wait_for_alert()
alert.accept()
def refresh(self) -> None:
self._driver.refresh()

def load(self) -> None:
self._driver.get(f"http://{HOST}:{PORT}/#{self.url}")
wait(self._driver).until(
EC.presence_of_element_located((By.XPATH, "/html/body/div[@id='app']/nav/div/div"))
)
Expand Down
8 changes: 6 additions & 2 deletions tests/e2e/web_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,9 @@ def test_training_session_change_entries(driver: webdriver.Chrome) -> None:

assert page.get_sets() == [new_values, *sets[1:]]

page.load(accept_unsaved_changes=True)
page.refresh()
alert = page.wait_for_alert()
alert.accept()

page.wait_for_title(str(workout.date))
assert page.get_sets() == sets
Expand Down Expand Up @@ -561,7 +563,9 @@ def test_training_session_change_notes(driver: webdriver.Chrome) -> None:
assert page.get_sets() == sets
assert page.get_notes() == new_notes

page.load(accept_unsaved_changes=True)
page.refresh()
alert = page.wait_for_alert()
alert.accept()

page.wait_for_title(str(workout.date))
assert page.get_sets() == sets
Expand Down

0 comments on commit 8df6155

Please sign in to comment.