Skip to content

Commit 879acb2

Browse files
fix tests
1 parent b83d101 commit 879acb2

File tree

5 files changed

+45
-10
lines changed

5 files changed

+45
-10
lines changed

SELECTOR_INFO.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,13 @@ Location: about:preferences#privacy
662662
Path to .json: modules/data/about_prefs.components.json
663663
```
664664
```
665+
Selector Name: custom-radio
666+
Selector Data: "customRadio"
667+
Description: Parent Element in custom tracker blocking checkboxes
668+
Location: about:preferences#privacy
669+
Path to .json: modules/data/about_prefs.components.json
670+
```
671+
```
665672
Selector Name: cookies-checkbox
666673
Selector Data: "contentBlockingBlockCookiesCheckbox"
667674
Description: In Enhanced Tracking Protection, the check-box for Cookies

modules/data/about_prefs.components.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
"searchEngineDropdown"
1414
]
1515
},
16+
"custom-tracker-options-parent": {
17+
"selectorData": "contentBlockingOptionCustom",
18+
"strategy": "id",
19+
"groups": []
20+
},
1621
"search-engine-dropmarker": {
1722
"selectorData": "dropmarker",
1823
"strategy": "tag",

modules/page_object_prefs.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ def select_content_and_action(self, content_type: str, action: str) -> BasePage:
118118
self.wait.until(lambda _: el.get_attribute("label") == action)
119119
return self
120120

121+
def select_trackers_to_block(self, *options):
122+
"""Select the trackers to block in the about:preferences page. Unchecks all first."""
123+
self.click_on("custom-radio")
124+
checkboxes = self.get_element("custom-tracker-options-parent").find_elements(
125+
By.TAG_NAME, "checkbox"
126+
)
127+
for checkbox in checkboxes:
128+
if checkbox.is_selected():
129+
checkbox.click()
130+
for option in options:
131+
self.click_on(option)
132+
return self
133+
121134
def get_history_menulist(self) -> WebElement:
122135
"""
123136
Gets the web element for the list of history items that appear in about:preferences

tests/security_and_privacy/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import pytest
22

3+
from modules.browser_object_navigation import Navigation
4+
from modules.page_object_prefs import AboutPrefs
5+
36

47
@pytest.fixture()
58
def suite_id():
@@ -17,3 +20,13 @@ def prefs_list(add_to_prefs_list: dict):
1720
@pytest.fixture()
1821
def add_to_prefs_list():
1922
return []
23+
24+
25+
@pytest.fixture()
26+
def nav(driver):
27+
return Navigation(driver)
28+
29+
30+
@pytest.fixture()
31+
def about_prefs_privacy(driver):
32+
return AboutPrefs(driver, category="privacy")

tests/security_and_privacy/test_blocking_fingerprinters.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,22 @@ def test_case():
1515
)
1616

1717

18-
def test_blocking_fingerprinter(driver: Firefox):
18+
def test_blocking_fingerprinter(
19+
driver: Firefox, nav: Navigation, about_prefs_privacy: AboutPrefs
20+
):
1921
"""
2022
C446404: Blocking Fingerprinters
2123
"""
2224
# instantiate objects
23-
nav = Navigation(driver)
24-
about_prefs = AboutPrefs(driver, category="privacy")
25-
about_prefs.open()
25+
about_prefs_privacy.open()
2626

2727
# Select custom option and keep just known fingerprinters checked
28-
about_prefs.get_element("custom-radio").click()
29-
about_prefs.get_element("cookies-checkbox").click()
30-
about_prefs.get_element("tracking-checkbox").click()
31-
about_prefs.get_element("cryptominers-checkbox").click()
32-
about_prefs.get_element("suspected-fingerprints-checkbox").click()
28+
about_prefs_privacy.select_trackers_to_block("known-fingerprints-checkbox")
3329

3430
# Access url and click on the shield icon and verify that known fingerprinters are blocked
3531
driver.get(FINGERPRINTERS_URL)
36-
nav.click_on("shield-icon")
32+
33+
nav.open_tracker_panel()
3734
nav.element_visible("known-fingerprints")
3835

3936
# Click on fingerprinters and check if subpanel is correctly displayed

0 commit comments

Comments
 (0)