Skip to content

Commit

Permalink
Move test pages off glitch. (#2221)
Browse files Browse the repository at this point in the history
  • Loading branch information
sammacbeth authored Sep 19, 2023
1 parent afdea80 commit f196a9b
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion integration-test/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Integration tests

These integration tests verify extension features by running a full copy of the extension in an instrumented
browser. Most tests work by loading a [test page](https://privacy-test-pages.glitch.me/) which will check
browser. Most tests work by loading a [test page](https://privacy-test-pages.site/) which will check
that a protection is active.

We use [Playwright](https://playwright.dev/) as a test runner. Tests are defined in the `.spec.js` files in the `integration-tests` folder.
Expand Down
2 changes: 1 addition & 1 deletion integration-test/amp-protection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import backgroundWait from './helpers/backgroundWait'
import { routeFromLocalhost } from './helpers/testPages'
import { loadTestConfig } from './helpers/testConfig'

const testSite = 'https://privacy-test-pages.glitch.me/privacy-protections/amp/'
const testSite = 'https://privacy-test-pages.site/privacy-protections/amp/'

test.describe('Test AMP link protection', () => {
test('Redirects AMP URLs correctly', async ({ context, backgroundPage, page }) => {
Expand Down
4 changes: 2 additions & 2 deletions integration-test/click-to-load-facebook.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { loadTestConfig, loadTestTds } from './helpers/testConfig'
import { routeFromLocalhost } from './helpers/testPages'
import { logPageRequests } from './helpers/requests'

const testSite = 'https://privacy-test-pages.glitch.me/privacy-protections/click-to-load/'
const testSite = 'https://privacy-test-pages.site/privacy-protections/click-to-load/'
const facebookDomains = new Set(['facebook.com', 'facebook.net', 'fbcdn.net'])

function summariseFacebookRequests (requests) {
Expand Down Expand Up @@ -141,7 +141,7 @@ test.describe('Test Facebook Click To Load', () => {
expect(allowCount).toEqual(requestCount)
}
// navigate away to allow all requests to complete before we clear request data
await page.goto('https://privacy-test-pages.glitch.me/')
await page.goto('https://privacy-test-pages.site/')
// When the page is reloaded, requests should be blocked again.
clearRequests()
await page.goto(testSite, { waitUntil: 'networkidle', timeout: 15000 })
Expand Down
2 changes: 1 addition & 1 deletion integration-test/click-to-load-youtube.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { routeFromLocalhost } from './helpers/testPages'
import { logPageRequests } from './helpers/requests'
import { waitForNetworkIdle } from './helpers/pageWait'

const testSite = 'https://privacy-test-pages.glitch.me/privacy-protections/youtube-click-to-load/'
const testSite = 'https://privacy-test-pages.site/privacy-protections/youtube-click-to-load/'
const youTubeStandardDomains = new Set(['youtu.be', 'youtube.com', 'www.youtube.com'])
const youTubeNocookieDomains = new Set(['youtube-nocookie.com', 'www.youtube-nocookie.com'])
const youTubeImageDomains = new Set(['i.ytimg.com'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@
]
},
{
"domain": "privacy-test-pages.glitch.me",
"domain": "privacy-test-pages.site",
"rules": [
{
"selector": ".hide-test",
Expand Down Expand Up @@ -1133,7 +1133,7 @@
"globalprivacycontrol.org",
"washingtonpost.com",
"nytimes.com",
"privacy-test-pages.glitch.me"
"privacy-test-pages.site"
]
},
"hash": "5912c223c67fc320fcee0a0dcbf4cd91"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@
]
},
{
"domain": "privacy-test-pages.glitch.me",
"domain": "privacy-test-pages.site",
"rules": [
{
"selector": ".hide-test",
Expand Down Expand Up @@ -1133,7 +1133,7 @@
"globalprivacycontrol.org",
"washingtonpost.com",
"nytimes.com",
"privacy-test-pages.glitch.me"
"privacy-test-pages.site"
]
},
"hash": "5912c223c67fc320fcee0a0dcbf4cd91"
Expand Down
2 changes: 1 addition & 1 deletion integration-test/facebook-sdk-schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
import apiSchema from './helpers/apiSchema'
import { routeFromLocalhost } from './helpers/testPages'

const testSite = 'https://privacy-test-pages.glitch.me/privacy-protections/click-to-load/'
const testSite = 'https://privacy-test-pages.site/privacy-protections/click-to-load/'

// We're using the original playwright test function which does not load the extension
test.describe('Facebook SDK schema', () => {
Expand Down
20 changes: 10 additions & 10 deletions integration-test/fire-button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ async function loadPageInNewTab (context, url) {
function openTabs (context) {
return Promise.all([
loadPageInNewTab(context, 'https://duckduckgo.com/'),
loadPageInNewTab(context, 'https://privacy-test-pages.glitch.me/'),
loadPageInNewTab(context, 'https://privacy-test-pages.site/'),
loadPageInNewTab(context, 'https://good.third-party.site/privacy-protections/storage-blocking/?store'),
loadPageInNewTab(context, 'https://privacy-test-pages.glitch.me/privacy-protections/storage-blocking/?store')
loadPageInNewTab(context, 'https://privacy-test-pages.site/privacy-protections/storage-blocking/?store')
])
}

Expand Down Expand Up @@ -83,7 +83,7 @@ test.describe('Fire Button', () => {
expectedTabs: 7
}, {
desc: 'clearing specific origins',
args: [true, ['https://privacy-test-pages.glitch.me/', 'https://duckduckgo.com/']],
args: [true, ['https://privacy-test-pages.site/', 'https://duckduckgo.com/']],
expectedTabs: 3
}]

Expand Down Expand Up @@ -118,15 +118,15 @@ test.describe('Fire Button', () => {
expect(options[5]).toMatchObject({
name: 'CurrentSite',
options: {
origins: ['https://privacy-test-pages.glitch.me', 'http://privacy-test-pages.glitch.me']
origins: ['https://privacy-test-pages.site', 'http://privacy-test-pages.site']
},
descriptionStats: {
clearHistory: true,
cookies: 1,
duration: 'all',
openTabs: 2, // gets the number of tabs matching this origin
pinnedTabs: 0,
site: 'privacy-test-pages.glitch.me'
site: 'privacy-test-pages.site'
},
selected: true
})
Expand Down Expand Up @@ -247,27 +247,27 @@ test.describe('Fire Button', () => {
await openTabs(context)

await fireButton.evaluate(f => f.burn({
origins: ['https://privacy-test-pages.glitch.me', 'http://privacy-test-pages.glitch.me']
origins: ['https://privacy-test-pages.site', 'http://privacy-test-pages.site']
}))

const tabs = await getOpenTabs(backgroundPage)
expect(tabs.every(t => !t.url.includes('privacy-test-pages.glitch.me'))).toBeTruthy()
expect(tabs.every(t => !t.url.includes('privacy-test-pages.site'))).toBeTruthy()
const cookieDomains = (await context.cookies()).map(c => c.domain)
expect(cookieDomains).not.toContain('privacy-test-pages.glitch.me')
expect(cookieDomains).not.toContain('privacy-test-pages.site')
expect(cookieDomains).toContain('good.third-party.site')
})

test('clears all browser storage', async ({ context, backgroundPage, page }) => {
await forExtensionLoaded(context)
await requestBrowsingDataPermissions(backgroundPage)
await routeFromLocalhost(page)
await page.goto('https://privacy-test-pages.glitch.me/privacy-protections/storage-blocking/?store', { waitUntil: 'networkidle' })
await page.goto('https://privacy-test-pages.site/privacy-protections/storage-blocking/?store', { waitUntil: 'networkidle' })
const storedValue = new URL(page.url()).hash.slice(1)
await (await getFireButtonHandle(backgroundPage)).evaluate(f => f.burn({}))

const newPage = await context.newPage()
await routeFromLocalhost(newPage)
await newPage.goto('https://privacy-test-pages.glitch.me/privacy-protections/storage-blocking/?retrive', { waitUntil: 'networkidle' })
await newPage.goto('https://privacy-test-pages.site/privacy-protections/storage-blocking/?retrive', { waitUntil: 'networkidle' })
await waitForAllResults(newPage)
const { results } = await JSON.parse(await newPage.evaluate('JSON.stringify(results)'))
const apis = [
Expand Down
2 changes: 1 addition & 1 deletion integration-test/helpers/testPages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const testPageHosts = new Set([
'privacy-test-pages.glitch.me',
'privacy-test-pages.site',
'broken.third-party.site',
'good.third-party.site',
'bad.third-party.site',
Expand Down
2 changes: 1 addition & 1 deletion integration-test/navigator-interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test.describe('navigatorInterface', () => {
test('injects navigator.duckduckgo interface into pages', async ({ backgroundPage, page, context }) => {
await backgroundWait.forExtensionLoaded(context)
await backgroundWait.forAllConfiguration(backgroundPage)
await page.goto('https://privacy-test-pages.glitch.me/features/navigator-interface.html')
await page.goto('https://privacy-test-pages.site/features/navigator-interface.html')
expect(await page.locator('#interface').innerText()).toBe('interface: true')
expect(await page.locator('#isDuckDuckGo').innerText()).toBe('isDuckDuckGo: true')
expect(await page.locator('#platform').innerText()).toBe('platform: extension')
Expand Down
2 changes: 1 addition & 1 deletion integration-test/privacy-dashboard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import backgroundWait from './helpers/backgroundWait'
import { routeFromLocalhost } from './helpers/testPages'
import { loadTestConfig } from './helpers/testConfig'

const testSite = 'https://privacy-test-pages.glitch.me/privacy-protections/request-blocking/'
const testSite = 'https://privacy-test-pages.site/privacy-protections/request-blocking/'

test.describe('Test privacy dashboard', () => {
test('Should load the dashboard with correct link text', async ({ context, backgroundPage, page }) => {
Expand Down
4 changes: 2 additions & 2 deletions integration-test/request-blocking.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { forAllConfiguration, forExtensionLoaded } from './helpers/backgroundWai
import { loadTestConfig } from './helpers/testConfig'
import { TEST_SERVER_ORIGIN } from './helpers/testPages'

const testHost = 'privacy-test-pages.glitch.me'
const testHost = 'privacy-test-pages.site'
const testSite = `https://${testHost}/privacy-protections/request-blocking/`

async function runRequestBlockingTest (page, url = testSite) {
Expand Down Expand Up @@ -84,7 +84,7 @@ test.describe('Test request blocking', () => {
action: 'block',
url: 'https://bad.third-party.site/privacy-protections/request-blocking/block-me/script.js',
eTLDplus1: 'third-party.site',
pageUrl: 'https://privacy-test-pages.glitch.me/privacy-protections/request-blocking/',
pageUrl: 'https://privacy-test-pages.site/privacy-protections/request-blocking/',
entityName: 'Bad Third Party Site',
prevalence: 0.1,
state: { blocked: {} }
Expand Down
2 changes: 1 addition & 1 deletion integration-test/storage-blocking.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import backgroundWait from './helpers/backgroundWait'
import { loadTestConfig, loadTestTds } from './helpers/testConfig'
import { TEST_SERVER_ORIGIN, routeFromLocalhost } from './helpers/testPages'

const testPageDomain = 'privacy-test-pages.glitch.me'
const testPageDomain = 'privacy-test-pages.site'
const thirdPartyDomain = 'good.third-party.site'
const thirdPartyTracker = 'broken.third-party.site'
const thirdPartyAd = 'convert.ad-company.site'
Expand Down
2 changes: 1 addition & 1 deletion integration-test/url-parameters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import backgroundWait from './helpers/backgroundWait'
import { routeFromLocalhost } from './helpers/testPages'
import { loadTestConfig } from './helpers/testConfig'

const testSite = 'https://privacy-test-pages.glitch.me/privacy-protections/query-parameters/'
const testSite = 'https://privacy-test-pages.site/privacy-protections/query-parameters/'

/**
* Returns the value of the `urlParametersRemoved` breakage flag for the current
Expand Down
2 changes: 1 addition & 1 deletion integration-test/youtube-sdk-schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'
import apiSchema from './helpers/apiSchema'
import { routeFromLocalhost } from './helpers/testPages'

const testSite = 'https://privacy-test-pages.glitch.me/privacy-protections/youtube-click-to-load/'
const testSite = 'https://privacy-test-pages.site/privacy-protections/youtube-click-to-load/'

// We're using the original playwright test function which does not load the extension
test.describe('YouTube Iframe Player API schema', () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"tsc": "tsc",
"tsc-watch": "tsc --watch",
"dev-firefox": "make watch browser=firefox type=dev",
"open-dev-firefox": "web-ext run -s build/firefox/dev/ -u https://privacy-test-pages.glitch.me/ -u https://www.search-company.site -u about:debugging",
"open-dev-firefox": "web-ext run -s build/firefox/dev/ -u https://privacy-test-pages.site/ -u https://www.search-company.site -u about:debugging",
"release-firefox": "make browser=firefox type=release",
"dev-chrome": "make watch browser=chrome type=dev",
"dev-chrome-mv3": "make watch browser=chrome-mv3 type=dev",
Expand Down
8 changes: 4 additions & 4 deletions packages/ddg2dnr/test/smarterEncryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ describe('generateSmarterEncryptionRuleset', () => {
})

it('should upgrade insecure requests from provided domains', /** @this {testFunction} */ async function () {
const ruleset = generateSmarterEncryptionRuleset(['privacy-test-pages.glitch.me'])
const ruleset = generateSmarterEncryptionRuleset(['privacy-test-pages.site'])
await this.browser.addRules(ruleset)
const matchedRules = await this.browser.testMatchOutcome({
url: 'http://privacy-test-pages.glitch.me/insecure',
url: 'http://privacy-test-pages.site/insecure',
type: 'main_frame',
tabId: 1
})
Expand All @@ -282,11 +282,11 @@ describe('generateSmarterEncryptionRuleset', () => {
})

it('createSmarterEncryptionExceptionRule should prevent https upgrade for domain', /** @this {testFunction} */ async function () {
const testDomains = ['privacy-test-pages.glitch.me', 'glitch.me']
const testDomains = ['privacy-test-pages.site', 'glitch.me']
await this.browser.addRules(generateSmarterEncryptionRuleset(testDomains, 2))
await this.browser.addRules([createSmarterEncryptionTemporaryRule([testDomains[0]], 'allow', 1).rule])
const expectNotUpgraded = await this.browser.testMatchOutcome({
url: 'http://privacy-test-pages.glitch.me/insecure',
url: 'http://privacy-test-pages.site/insecure',
type: 'main_frame',
tabId: 1
})
Expand Down

0 comments on commit f196a9b

Please sign in to comment.