From 73f3f4e173b3cd8d23b942c8052e5c2cc49ccd7d Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:09:13 +0100 Subject: [PATCH] test: fix sort-test-expectations (#12107) --- test/TestExpectations.json | 89 -------------------------------- tools/sort-test-expectations.mjs | 12 ++--- 2 files changed, 6 insertions(+), 95 deletions(-) diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 949cd74760f..099195fd43e 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -584,13 +584,6 @@ "parameters": ["webDriverBiDi"], "expectations": ["PASS"] }, - { - "testIdPattern": "[network.spec] network Page.setBypassServiceWorker *", - "platforms": ["win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[network.spec] network Request.initiator should return the initiator", "platforms": ["darwin", "linux", "win32"], @@ -1021,12 +1014,6 @@ "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[browsercontext.spec] BrowserContext should create new incognito context", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["PASS"] - }, { "testIdPattern": "[browsercontext.spec] BrowserContext should fire target events", "platforms": ["darwin", "linux", "win32"], @@ -1041,12 +1028,6 @@ "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[browsercontext.spec] BrowserContext should have default context", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["PASS"] - }, { "testIdPattern": "[browsercontext.spec] BrowserContext should wait for a target", "platforms": ["darwin", "linux", "win32"], @@ -2328,13 +2309,6 @@ "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch can launch and close the browser", - "platforms": ["win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should be able to launch Chrome", "platforms": ["darwin", "linux", "win32"], @@ -2671,13 +2645,6 @@ "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[network.spec] network Network Events Page.Events.RequestServedFromCache", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["chrome", "webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[network.spec] network Network Events Page.Events.Response", "platforms": ["darwin", "linux", "win32"], @@ -2825,13 +2792,6 @@ "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[network.spec] network Response.buffer should throw if the response does not have a body", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["chrome", "webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[network.spec] network Response.buffer should work", "platforms": ["darwin", "linux", "win32"], @@ -2867,13 +2827,6 @@ "expectations": ["FAIL", "PASS"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[network.spec] network Response.fromServiceWorker Response.fromServiceWorker", - "platforms": ["win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[network.spec] network Response.fromServiceWorker Response.fromServiceWorker", "platforms": ["darwin", "linux", "win32"], @@ -2909,13 +2862,6 @@ "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[network.spec] network Response.text should wait until response completes", - "platforms": ["win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[network.spec] network Response.text should work", "platforms": ["darwin", "linux", "win32"], @@ -3830,13 +3776,6 @@ "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch userDataDir option restores preferences", - "platforms": ["win32"], - "parameters": ["firefox", "headless", "webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[network.spec] network Network Events Page.Events.Request", "platforms": ["linux"], @@ -3879,34 +3818,6 @@ "expectations": ["FAIL", "PASS"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work for an element with an offset", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox", "headful"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { - "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work for an element with an offset", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox", "headless"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { - "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work with a rotated element", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox", "headful"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { - "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work with a rotated element", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox", "headless"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[target.spec] Target should close a service worker", "platforms": ["darwin", "linux", "win32"], diff --git a/tools/sort-test-expectations.mjs b/tools/sort-test-expectations.mjs index 972d2448740..a80f0cfbd26 100644 --- a/tools/sort-test-expectations.mjs +++ b/tools/sort-test-expectations.mjs @@ -78,14 +78,14 @@ const toBeRemoved = new Set(); for (let i = testExpectations.length - 1; i >= 0; i--) { const expectation = testExpectations[i]; const params = new Set(expectation.parameters); - const labels = new Set(expectation.expectations); + const expectations = new Set(expectation.expectations); const platforms = new Set(expectation.platforms); let foundMatch = false; for (let j = i - 1; j >= 0; j--) { const candidate = testExpectations[j]; const candidateParams = new Set(candidate.parameters); - const candidateLabels = new Set(candidate.expectations); + const candidateExpectations = new Set(candidate.expectations); const candidatePlatforms = new Set(candidate.platforms); if ( @@ -93,11 +93,11 @@ for (let i = testExpectations.length - 1; i >= 0; i--) { expectation.testIdPattern, candidate.testIdPattern ) && - isSubset(candidateParams, params) && - isSubset(candidatePlatforms, platforms) + isSubset(candidatePlatforms, platforms) && + (isSubset(params, candidateParams) || isSubset(candidateParams, params)) ) { foundMatch = true; - if (isSubset(candidateLabels, labels)) { + if (isSubset(candidateExpectations, expectations)) { console.log('removing', expectation, 'already covered by', candidate); toBeRemoved.add(expectation); } @@ -105,7 +105,7 @@ for (let i = testExpectations.length - 1; i >= 0; i--) { } } - if (!foundMatch && isSubset(new Set(['PASS']), labels)) { + if (!foundMatch && isSubset(new Set(['PASS']), expectations)) { console.log( 'removing', expectation,