Skip to content

Commit

Permalink
test: don't search for source strings when testing a translation
Browse files Browse the repository at this point in the history
  • Loading branch information
cfm committed Nov 22, 2024
1 parent c608b28 commit 550e0f3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def admin_visits_user_edit_page(self, username_of_journalist_to_edit: str) -> No
# Ensure the admin is allowed to edit the journalist
def can_edit_user():
h = self.driver.find_elements(By.TAG_NAME, "h1")[0]
assert f'Edit user "{username_of_journalist_to_edit}"' == h.text
if not self.accept_languages:
assert f'Edit user "{username_of_journalist_to_edit}"' == h.text

self.nav_helper.wait_for(can_edit_user)
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def explanatory_tooltip_is_correct() -> None:
explanatory_tooltip_opacity = explanatory_tooltip.value_of_css_property("opacity")
assert explanatory_tooltip_opacity == "1"

if assert_tooltip_text_is:
if assert_tooltip_text_is and not journ_app_nav.accept_languages:
assert explanatory_tooltip.text == assert_tooltip_text_is

journ_app_nav.nav_helper.wait_for(explanatory_tooltip_is_correct)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ def test_admin_changes_logo(self, sd_servers_with_clean_state, firefox_web_drive
# Then it succeeds
def updated_image() -> None:
flash_msg = journ_app_nav.driver.find_element(By.CSS_SELECTOR, ".flash")
assert "Image updated." in flash_msg.text
if not journ_app_nav.accept_languages:
assert "Image updated." in flash_msg.text

journ_app_nav.nav_helper.wait_for(updated_image, timeout=20)

Expand Down Expand Up @@ -288,7 +289,8 @@ def test_ossec_alert_button(self, sd_servers, firefox_web_driver):
# Then it succeeds
def test_alert_sent():
flash_msg = journ_app_nav.driver.find_element(By.CSS_SELECTOR, ".flash")
assert "Test alert sent. Please check your email." in flash_msg.text
if not journ_app_nav.accept_languages:
assert "Test alert sent. Please check your email." in flash_msg.text

journ_app_nav.nav_helper.wait_for(test_alert_sent)

Expand Down
2 changes: 1 addition & 1 deletion securedrop/tests/functional/web_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _create_firefox_driver(

# Add this attribute to the returned driver object so that tests using this
# fixture can know what locale it's parameterized with.
firefox_driver.locale = accept_languages or "en_US" # type: ignore[attr-defined]
firefox_driver.locale = accept_languages # type: ignore[attr-defined]

return firefox_driver

Expand Down

0 comments on commit 550e0f3

Please sign in to comment.