Skip to content

Commit ed55cdf

Browse files
committed
refactor asserts
1 parent 133b63a commit ed55cdf

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

tests/address_bar_and_search/test_intervention_card_refresh_firefox.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33

44
from modules.browser_object import Navigation
55

6-
LIGHT_MODE_BEFORE_RBG_VALUE = "rgba(207, 207, 216, 0.33)"
7-
DARK_MODE_BEFORE_RGB_VALUE = "rgba(0, 0, 0, 0.33)"
8-
9-
LIGHT_MODE_AFTER_RGB_VALUE = "color(srgb 0 0 0 / 0.6)"
10-
DARK_MODE_AFTER_RGB_VALUE = "color(srgb 0.984314 0.984314 0.996078 / 0.6)"
11-
6+
ALLOWED_RGB_BEFORE_VALUES = set(["rgba(207, 207, 216, 0.33)", "color(srgb 0 0 0 / 0.13)", "rgba(0, 0, 0, 0.33)"])
7+
ALLOWED_RGB_AFTER_VALUES = set(["color(srgb 0 0 0 / 0.6)", "color(srgb 0.984314 0.984314 0.996078 / 0.6)"])
128

139
# Set search region
1410
@pytest.fixture()
@@ -40,35 +36,22 @@ def test_intervention_card_refresh(driver: Firefox):
4036

4137
# ensure the color before hover
4238
button_background = refresh_button.value_of_css_property("background-color")
43-
assert (
44-
button_background == LIGHT_MODE_BEFORE_RBG_VALUE
45-
or button_background == DARK_MODE_BEFORE_RGB_VALUE
46-
)
39+
assert button_background in ALLOWED_RGB_BEFORE_VALUES
4740
nav.hover_over_element(refresh_button, chrome=True)
4841

4942
# ensure there is a hover state
5043
new_button_background = refresh_button.value_of_css_property("background-color")
51-
assert (
52-
new_button_background == LIGHT_MODE_AFTER_RGB_VALUE
53-
or new_button_background == DARK_MODE_AFTER_RGB_VALUE
54-
)
55-
44+
assert new_button_background in ALLOWED_RGB_AFTER_VALUES
5645
# repeated from before but with the 3 dots menu button
5746
help_menu_background = help_menu_button.value_of_css_property("background-color")
58-
assert (
59-
help_menu_background == LIGHT_MODE_BEFORE_RBG_VALUE
60-
or help_menu_background == DARK_MODE_BEFORE_RGB_VALUE
61-
)
47+
assert help_menu_background in ALLOWED_RGB_BEFORE_VALUES
6248
assert help_menu_button.get_attribute("open") is None
6349
nav.hover_over_element(help_menu_button, chrome=True)
6450

6551
new_help_menu_background = help_menu_button.value_of_css_property(
6652
"background-color"
6753
)
68-
assert (
69-
new_help_menu_background == LIGHT_MODE_AFTER_RGB_VALUE
70-
or new_help_menu_background == DARK_MODE_AFTER_RGB_VALUE
71-
)
54+
assert new_help_menu_background in ALLOWED_RGB_AFTER_VALUES
7255

7356
# ensure the popup appears
7457
help_menu_button.click()

0 commit comments

Comments
 (0)