From 43f24538232effbc259325708992dd868dfb0280 Mon Sep 17 00:00:00 2001 From: Maksim Sadym <69349599+sadym-chromium@users.noreply.github.com> Date: Mon, 4 Mar 2024 17:19:18 +0100 Subject: [PATCH] test: fix some ff cookie tests (#12039) --- test/TestExpectations.json | 15 ++++----------- test/src/cookies.spec.ts | 3 --- test/src/mocha-utils.ts | 26 +++++++++++++++----------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 89e8bd3127a..6146a2ea462 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -1215,13 +1215,6 @@ "expectations": ["FAIL", "PASS"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[cookies.spec] Cookie specs Page.cookies should get cookies from multiple urls", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[cookies.spec] Cookie specs Page.cookies should get cookies from nested path", "platforms": ["darwin", "linux", "win32"], @@ -1296,8 +1289,8 @@ "testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should default to setting secure cookie for HTTPS websites", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "expectations": ["SKIP"], + "comment": "Chromium-specific test. The test relies on the cookie in secure context to be secure. This is not the case for Firefox." }, { "testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should isolate cookies in browser contexts", @@ -1373,8 +1366,8 @@ "testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set secure same-site cookies from a frame", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "expectations": ["SKIP"], + "comment": "Chromium-specific test. The test relies on the cookie in secure context to be secure. This is not the case for Firefox." }, { "testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should work", diff --git a/test/src/cookies.spec.ts b/test/src/cookies.spec.ts index 5a6d2475956..1fa4a9407c8 100644 --- a/test/src/cookies.spec.ts +++ b/test/src/cookies.spec.ts @@ -150,7 +150,6 @@ describe('Cookie specs', () => { expires: -1, size: 11, httpOnly: false, - secure: true, session: true, sourceScheme: 'Secure', }, @@ -163,7 +162,6 @@ describe('Cookie specs', () => { expires: -1, size: 10, httpOnly: false, - secure: true, session: true, sourceScheme: 'Secure', }, @@ -436,7 +434,6 @@ describe('Cookie specs', () => { expires: -1, size: 18, httpOnly: false, - secure: true, session: true, sourceScheme: 'Secure', }, diff --git a/test/src/mocha-utils.ts b/test/src/mocha-utils.ts index 5ee16017c12..333204d83b5 100644 --- a/test/src/mocha-utils.ts +++ b/test/src/mocha-utils.ts @@ -378,17 +378,21 @@ export const expectCookieEquals = async ( if (!processVariables.isChrome) { // Only keep standard properties when testing on a browser other than Chrome. expectedCookies = expectedCookies.map(cookie => { - return { - domain: cookie.domain, - expires: cookie.expires, - httpOnly: cookie.httpOnly, - name: cookie.name, - path: cookie.path, - secure: cookie.secure, - session: cookie.session, - size: cookie.size, - value: cookie.value, - }; + return Object.fromEntries( + Object.entries(cookie).filter(([key]) => { + return [ + 'domain', + 'expires', + 'httpOnly', + 'name', + 'path', + 'secure', + 'session', + 'size', + 'value', + ].includes(key); + }) + ); }); }