Skip to content

Commit

Permalink
Validate that third party trackers load correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanKingston committed Apr 27, 2023
1 parent ed15b90 commit b258984
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions integration-test/data/configs/storage-blocking.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
{
"globalThis.dbg.tds.config.features.trackerAllowlist": {
"allowlistedTrackers": {
"ad-company.site": {
"rules": [
{
"rule": "convert.ad-company.site",
"domains": [
"<all>"
],
"reason": "Validation of the cookie rules and not blocking"
}
]
}
}
},
"globalThis.dbg.tds.config.features.trackingCookies3p": {
"state": "enabled",
"exceptions": [ ],
Expand Down
11 changes: 11 additions & 0 deletions integration-test/storage-blocking.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { routeFromLocalhost } from './helpers/testPages'
const testPageDomain = 'privacy-test-pages.glitch.me'
const thirdPartyDomain = 'good.third-party.site'
const thirdPartyTracker = 'broken.third-party.site'
const thirdPartyAd = 'convert.ad-company.site'

async function waitForAllResults (page) {
while ((await page.$$('#tests-details > li > span > ul')).length < 2) {
Expand Down Expand Up @@ -40,6 +41,11 @@ test.describe('Storage blocking Tests', () => {
thirdparty_firstparty_headerdata: expectUnmodified('allows 1st party HTTP cookies from non-tracker frames'),
jsdata: expectUnmodified('does not block 3rd party JS cookies not on block list')
},
[thirdPartyAd]: {
top_thirdparty_headerdata: expectUnmodified('allows 3rd party HTTP cookies not on block list'),
thirdparty_firstparty_headerdata: expectUnmodified('allows 1st party HTTP cookies from non-tracker frames'),
jsdata: expectUnmodified('does not block 3rd party JS cookies not on block list')
},
[thirdPartyTracker]: {
thirdpartytracker_thirdparty_headerdata: expectUnmodified('allows 3rd party tracker HTTP cookies from tracker frames'),
top_tracker_headerdata: expectBlocked('blocks 3rd party HTTP cookies for trackers'),
Expand All @@ -55,6 +61,11 @@ test.describe('Storage blocking Tests', () => {
if (jsCookies.has(cookie.name)) {
expect(cookie.expires - nowSeconds).toBeGreaterThan(0)
expect(cookie.expires - nowSeconds).toBeLessThan(604800)
if (cookie.domain === thirdPartyTracker) {
expect(cookie.expires - nowSeconds).toBeLessThan(86400)
} else {
expect(cookie.expires - nowSeconds).toBeGreaterThan(86400)
}
}
}
})
Expand Down

0 comments on commit b258984

Please sign in to comment.