@@ -9,9 +9,16 @@ def test_case():
99 return "118173"
1010
1111
12- THEMES : dict [str , str ] = {
13- "firefox-compact-dark_mozilla_org-heading" : "rgb(43, 42, 51)" ,
14- "firefox-compact-light_mozilla_org-heading" : "rgb(249, 249, 251)" ,
12+ THEMES : dict [str , list [str ]] = {
13+ "firefox-compact-dark_mozilla_org-heading" : [
14+ "rgb(43, 42, 51)" , # classic darker tone
15+ "rgb(143, 143, 148)" , # focused dark
16+ "rgb(120, 119, 126)" , # dark without focus
17+ ],
18+ # Compact Light
19+ "firefox-compact-light_mozilla_org-heading" : [
20+ "rgb(249, 249, 251)" ,
21+ ],
1522}
1623
1724ALPENGLOW_MAP : dict [str , str ] = {
@@ -39,7 +46,7 @@ def colors_match(a: str, b: str, tolerance: float = 0.14) -> bool:
3946 b_vals = b .split ("(" )[1 ][:- 1 ]
4047 a_nums = [float (n .strip ()) for n in a_vals .split ("," )]
4148 b_nums = [float (n .strip ()) for n in b_vals .split ("," )]
42- except (IndexError , ValueError ) as e :
49+ except (IndexError , ValueError ):
4350 # Raised if string doesn't contain expected format or non-numeric parts
4451 return False
4552
@@ -65,7 +72,7 @@ def test_redirect_to_addons(driver: Firefox) -> None:
6572
6673 # remember original window, then switch to newly opened one
6774 orig = driver .window_handles [0 ]
68- new = driver .window_handles [- 1 ]
75+ new = driver .window_handles [- 1 ]
6976 driver .switch_to .window (new )
7077 assert driver .current_url == "about:addons"
7178
@@ -94,15 +101,19 @@ def test_activate_theme_background_matches_expected(driver: Firefox, theme_name:
94101 pytest .skip ("Compact Light is default on Firefox, skipping." )
95102
96103 current_bg = abt_addons .activate_theme (
97- nav , theme_name , THEMES [theme_name ], perform_assert = False
104+ nav , theme_name , "" , perform_assert = False
105+ )
106+
107+ expected_list = THEMES [theme_name ]
108+ assert any (colors_match (current_bg , exp ) for exp in expected_list ), (
109+ f"Got { current_bg } for { theme_name } ; expected one of { expected_list } "
98110 )
99- assert colors_match (current_bg , THEMES [theme_name ])
100111
101112
102113def test_alpenglow_theme (driver : Firefox ) -> None :
103114 """
104115 C118173: Alpenglow theme can render two values depending on light / dark mode.
105- Accept either using the tolerance - based comparison.
116+ Accept either using the tolerance- based comparison.
106117 """
107118
108119 nav = Navigation (driver )
0 commit comments