Skip to content

Commit ab94753

Browse files
Hani YacoubHani Yacoub
authored andcommitted
Test blocking cryptominers
1 parent 49a1933 commit ab94753

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

modules/data/about_prefs.components.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,35 @@
220220
"selectorData": "menuitem[data-l10n-id=\"home-mode-choice-default-fx\"]",
221221
"strategy": "css",
222222
"groups": []
223+
},
224+
225+
"custom-radio": {
226+
"selectorData": "customRadio",
227+
"strategy": "id",
228+
"groups": []
229+
},
230+
231+
"cookies-checkbox": {
232+
"selectorData": "contentBlockingBlockCookiesCheckbox",
233+
"strategy": "id",
234+
"groups": []
235+
},
236+
237+
"tracking-checkbox": {
238+
"selectorData": "contentBlockingTrackingProtectionCheckbox",
239+
"strategy": "id",
240+
"groups": []
241+
},
242+
243+
"known-fingerprints-checkbox": {
244+
"selectorData": "contentBlockingFingerprintersCheckbox",
245+
"strategy": "id",
246+
"groups": []
247+
},
248+
249+
"suspected-fingerprints-checkbox": {
250+
"selectorData": "contentBlockingFingerprintingProtectionCheckbox",
251+
"strategy": "id",
252+
"groups": []
223253
}
224254
}

modules/data/navigation.components.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,17 @@
184184
"selectorData": "//div[@data-text-ad]//a",
185185
"strategy": "xpath",
186186
"groups": []
187+
},
188+
189+
"shield-icon": {
190+
"selectorData": "tracking-protection-icon-container",
191+
"strategy": "id",
192+
"groups": []
193+
},
194+
195+
"cryptominers": {
196+
"selectorData": ".protections-popup-category.subviewbutton.subviewbutton-iconic.subviewbutton-nav.blocked",
197+
"strategy": "css",
198+
"groups": []
187199
}
188200
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import pytest
2+
3+
4+
@pytest.fixture()
5+
def suite_id():
6+
return ("X", "Security and Privacy")
7+
8+
9+
@pytest.fixture()
10+
def set_prefs():
11+
"""Set prefs"""
12+
return []
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from time import sleep
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_navigation import Navigation
5+
from modules.page_object_about_prefs import AboutPrefs
6+
7+
url = "https://senglehardt.com/test/trackingprotection/test_pages/fingerprinting_and_cryptomining.html"
8+
9+
10+
def test_blocking_cryptominers(driver: Firefox):
11+
# instantiate objects
12+
nav = Navigation(driver).open()
13+
about_prefs = AboutPrefs(driver, category="privacy").open()
14+
15+
# Select custom option and keep just cryptominers checked
16+
about_prefs.get_element("custom-radio").click()
17+
about_prefs.get_element("cookies-checkbox").click()
18+
about_prefs.get_element("tracking-checkbox").click()
19+
about_prefs.get_element("known-fingerprints-checkbox").click()
20+
about_prefs.get_element("suspected-fingerprints-checkbox").click()
21+
22+
# Access url and click on the shield icon and verify that cryptominers are blocked
23+
driver.get(url)
24+
with driver.context(driver.CONTEXT_CHROME):
25+
nav.get_element("shield-icon").click()
26+
assert nav.get_element("cryptominers").is_displayed()

0 commit comments

Comments
 (0)