Skip to content

Commit 4389f56

Browse files
authored
Merge pull request #110 from mozilla/hy/blocking_cryptominers
hy/Test blocking cryptominers
2 parents d4656c1 + f1d91e4 commit 4389f56

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-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
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from time import sleep
2+
3+
import pytest
4+
from selenium.webdriver import Firefox
5+
from modules.browser_object_navigation import Navigation
6+
from modules.page_object_about_prefs import AboutPrefs
7+
8+
CRYPTOMINERS_URL = "https://senglehardt.com/test/trackingprotection/test_pages/fingerprinting_and_cryptomining.html"
9+
10+
@pytest.fixture()
11+
def add_prefs():
12+
return []
13+
14+
def test_blocking_cryptominers(driver: Firefox):
15+
# instantiate objects
16+
nav = Navigation(driver).open()
17+
about_prefs = AboutPrefs(driver, category="privacy").open()
18+
19+
# Select custom option and keep just cryptominers checked
20+
about_prefs.get_element("custom-radio").click()
21+
about_prefs.get_element("cookies-checkbox").click()
22+
about_prefs.get_element("tracking-checkbox").click()
23+
about_prefs.get_element("known-fingerprints-checkbox").click()
24+
about_prefs.get_element("suspected-fingerprints-checkbox").click()
25+
sleep(2)
26+
27+
# Access url and click on the shield icon and verify that cryptominers are blocked
28+
driver.get(CRYPTOMINERS_URL)
29+
with driver.context(driver.CONTEXT_CHROME):
30+
nav.get_element("shield-icon").click()
31+
assert nav.get_element("cryptominers").is_displayed()

0 commit comments

Comments
 (0)