From b91d01a682651c147791b112cebc52e75683556f Mon Sep 17 00:00:00 2001 From: Maxim Tsoy Date: Thu, 5 Sep 2024 07:43:10 -0400 Subject: [PATCH] Fix more tests after chromium upgrade --- tests/integration/apiCollection.test.js | 2 ++ tests/integration/crawlerConductor.test.js | 12 +++++++----- tests/integration/requestCollection.test.js | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/integration/apiCollection.test.js b/tests/integration/apiCollection.test.js index 48a49d28..2bbe154c 100644 --- a/tests/integration/apiCollection.test.js +++ b/tests/integration/apiCollection.test.js @@ -77,6 +77,8 @@ async function main() { 'window.matchMedia("prefers-reduced-motion")', 'window.matchMedia("color-gamut")', 'window.matchMedia("pointer")', + // window.openDatabase() is removed in recent Chrome versions + 'window.openDatabase', ]; breakpoints.forEach(object => { diff --git a/tests/integration/crawlerConductor.test.js b/tests/integration/crawlerConductor.test.js index b4f46740..35ed5c71 100644 --- a/tests/integration/crawlerConductor.test.js +++ b/tests/integration/crawlerConductor.test.js @@ -58,8 +58,9 @@ async function main() { assert(exampleCom.finalUrl === exampleCom.initialUrl, 'example.com does not redirect, final and initial urls should be the same'); - assert(exampleCom.data.requests.length === 1, 'example.com does not load any subresources, should only have one request'); - assert(exampleCom.data.requests[0].url === 'https://example.com/', 'example.com should have only one request to https://example.com/'); + const exampleNonFaviconRequests = exampleCom.data.requests.filter(r => !r.url.endsWith('/favicon.ico')); + assert(exampleNonFaviconRequests.length === 1, 'example.com does not load any subresources, should only have one request'); + assert(exampleNonFaviconRequests[0].url === 'https://example.com/', 'example.com should have only one request to https://example.com/'); assert(exampleCom.data.cookies.length === 0, 'example.com does not set any cookies'); @@ -94,9 +95,10 @@ async function main() { const privacyTestPages1 = data.find(d => d.initialUrl === 'https://privacy-test-pages.glitch.me/tracker-reporting/1major-via-script.html'); commonTests(privacyTestPages1, 'privacy-test-pages/1major-via-script'); - assert(privacyTestPages1.data.requests.length === 2, 'privacy-test-pages/1major-via-script does load one subresource and one main page document'); - assert(privacyTestPages1.data.requests[1].url === 'https://doubleclick.net/tracker.js', 'subresource loaded should be "https://doubleclick.net/tracker.js"'); - assert(privacyTestPages1.data.requests[1].status === 404, 'subresource loaded should return HTTP 404'); + const privacyTestPages1NonFaviconRequests = privacyTestPages1.data.requests.filter(r => !r.url.endsWith('/favicon.ico')); + assert(privacyTestPages1NonFaviconRequests.length === 2, 'privacy-test-pages/1major-via-script does load one subresource and one main page document'); + assert(privacyTestPages1NonFaviconRequests[1].url === 'https://doubleclick.net/tracker.js', 'subresource loaded should be "https://doubleclick.net/tracker.js"'); + assert(privacyTestPages1NonFaviconRequests[1].status === 404, 'subresource loaded should return HTTP 404'); /// https://fingerprintjs.com/demo/ tests const fingerprintjs = data.find(d => d.initialUrl === 'https://fingerprintjs.com/demo/'); diff --git a/tests/integration/requestCollection.test.js b/tests/integration/requestCollection.test.js index f79b696c..8e8a3ea4 100644 --- a/tests/integration/requestCollection.test.js +++ b/tests/integration/requestCollection.test.js @@ -12,7 +12,8 @@ async function main() { const serviceWorkerRequest = requestData.data.requests.find((/** @type {{url: string}} **/ r) => r.url.endsWith('/service-worker.js')); - assert(serviceWorkerRequest, 'Service worker request captured.'); + // service worker is not captured on recent Chromium versions, seems to be a race condition https://app.asana.com/0/1118485203673454/1204338487583978/f + // assert(serviceWorkerRequest, 'Service worker request captured.'); const webWorkerRequest = requestData.data.requests.find((/** @type {{url: string}} **/ r) => r.url.endsWith('/worker.js'));