Skip to content

Commit 39cc4f6

Browse files
Merge pull request #526 from mozilla/vs/fix-theme-devedition
vs/fix devedition theme
2 parents ee4509e + 9edc57b commit 39cc4f6

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

modules/page_object_prefs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,13 @@ def activate_theme(
523523
else:
524524
return background_color
525525

526+
def is_devedition(self):
527+
active_theme_el = self.driver.find_element(
528+
By.CSS_SELECTOR, ".card.addon[active] h3.addon-name"
529+
)
530+
active_theme_name = active_theme_el.text.lower()
531+
return "dark" in active_theme_name or "developer edition" in active_theme_name
532+
526533
def enabled_theme_matches(self, expected_theme: str) -> bool:
527534
"""
528535
Check the enabled theme name against any string.

tests/theme_and_toolbar/test_customize_themes_and_redirect.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ def test_open_addons(driver: Firefox, theme_name: str):
4040
nav = Navigation(driver)
4141
abt_addons = AboutAddons(driver).open()
4242
abt_addons.choose_sidebar_option("theme")
43+
44+
# Dynamically detect if running Developer Edition
45+
if abt_addons.is_devedition():
46+
# Adjust expectations for Developer Edition
47+
if theme_name == "firefox-compact-dark_mozilla_org-heading":
48+
# Already default on Developer Edition; skip activation/assertion
49+
pytest.skip("Compact Dark is default on DevEdition, skipping.")
50+
else:
51+
# Adjust expectations for standard Firefox
52+
if theme_name == "firefox-compact-light_mozilla_org-heading":
53+
# Already default on Firefox standard; skip activation/assertion
54+
pytest.skip("Compact Light is default on Firefox, skipping.")
55+
4356
abt_addons.activate_theme(nav, theme_name, themes[theme_name])
4457

4558

0 commit comments

Comments
 (0)