-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from mozilla/sl/cross-site-cookies-blocked
Cross Site Cookies
- Loading branch information
Showing
3 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests/security_and_privacy/test_cross_site_tracking_cookies_blocked.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import pytest | ||
from selenium.webdriver import Firefox | ||
|
||
from modules.browser_object import Navigation, TrackerPanel | ||
from modules.page_object import GenericPage | ||
|
||
FIRST_TRACKER_WEBSITE = "https://senglehardt.com/test/trackingprotection/test_pages/tracking_protection.html" | ||
ALLOWED_COOKIES = set( | ||
[ | ||
"https://ads-track-digest256.dummytracker.org", | ||
"https://social-track-digest256.dummytracker.org", | ||
"https://analytics-track-digest256.dummytracker.org", | ||
] | ||
) | ||
|
||
|
||
@pytest.fixture() | ||
def add_prefs(): | ||
return [ | ||
("privacy.trackingprotection.pbmode.enabled", False), | ||
("privacy.trackingprotection.cryptomining.enabled", False), | ||
("privacy.trackingprotection.fingerprinting.enabled", False), | ||
("privacy.fingerprintingProtection.pbmode", False), | ||
] | ||
|
||
|
||
def test_cross_site_tracking_cookies_blocked(driver: Firefox): | ||
""" | ||
C446402: Ensures the cross tracking cookies are displayed in the tracker panel | ||
""" | ||
# instantiate objects | ||
nav = Navigation(driver) | ||
tracker_panel = TrackerPanel(driver) | ||
tracker_website = GenericPage(driver, url=FIRST_TRACKER_WEBSITE).open() | ||
tracker_panel.wait_for_trackers(nav, tracker_website) | ||
|
||
driver.set_context(driver.CONTEXT_CHROME) | ||
nav.open_tracker_panel() | ||
|
||
# fetch the items in the cross site trackers and verify | ||
cross_site_trackers = tracker_panel.open_and_return_cross_site_trackers() | ||
for item in cross_site_trackers: | ||
assert item.get_attribute("value") in ALLOWED_COOKIES |