diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /remote/test/puppeteer/test | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'remote/test/puppeteer/test')
24 files changed, 958 insertions, 403 deletions
diff --git a/remote/test/puppeteer/test/.eslintrc.js b/remote/test/puppeteer/test/.eslintrc.js index 5f7746a76b..ea697b0a47 100644 --- a/remote/test/puppeteer/test/.eslintrc.js +++ b/remote/test/puppeteer/test/.eslintrc.js @@ -36,6 +36,12 @@ module.exports = { selector: 'CallExpression[callee.object.name="it"] > MemberExpression > Identifier[name="deflake"], CallExpression[callee.object.name="it"] > MemberExpression > Identifier[name="deflakeOnly"]', }, + { + message: + 'No `expect` in EventHandler. They will never throw errors', + selector: + 'CallExpression[callee.property.name="on"] BlockStatement > :not(TryStatement) > ExpressionStatement > CallExpression[callee.object.callee.name="expect"]', + }, ], }, }, diff --git a/remote/test/puppeteer/test/TestExpectations.json b/remote/test/puppeteer/test/TestExpectations.json index e55f223441..9f021882f5 100644 --- a/remote/test/puppeteer/test/TestExpectations.json +++ b/remote/test/puppeteer/test/TestExpectations.json @@ -18,7 +18,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "Chrome-only feature blocked on https://github.com/GoogleChromeLabs/chromium-bidi/issues/2082" }, { "testIdPattern": "[device-request-prompt.spec] *", @@ -58,9 +58,9 @@ { "testIdPattern": "[headful.spec] *", "platforms": ["darwin", "linux", "win32"], - "parameters": ["headless", "firefox"], + "parameters": ["headless"], "expectations": ["SKIP"], - "comment": "Cannot be run in headless mode" + "comment": "Spawns headful browser, needs display or `xvfb` like which is not required for other headless tests" }, { "testIdPattern": "[idle_override.spec] *", @@ -84,20 +84,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[network.spec] network Page.authenticate *", - "platforms": ["darwin", "linux"], - "parameters": ["webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { - "testIdPattern": "[network.spec] network Page.authenticate *", - "platforms": ["win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { "testIdPattern": "[network.spec] network Page.setBypassServiceWorker *", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox"], @@ -112,13 +98,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[network.spec] network Page.setExtraHTTPHeaders *", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { "testIdPattern": "[network.spec] network Request.isNavigationRequest *", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], @@ -175,25 +154,18 @@ "comment": "Chrome-specific test" }, { - "testIdPattern": "[requestinterception-experimental.spec] *", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { - "testIdPattern": "[requestinterception.spec] *", + "testIdPattern": "[screencast.spec] *", "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], + "parameters": ["chrome"], "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "Currently no reliable ffmpeg downloads for testing https://github.com/puppeteer/puppeteer/issues/12121" }, { "testIdPattern": "[screencast.spec] *", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox"], "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "CDP-specific feature" }, { "testIdPattern": "[screenshot.spec] Screenshots Cdp *", @@ -224,20 +196,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryOne (Chromium web test) should find by role \"button\"", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { - "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryOne (Chromium web test) should find by role \"heading\"", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { "testIdPattern": "[autofill.spec] *", "platforms": ["darwin", "linux", "win32"], "parameters": ["chrome", "chrome-headless-shell"], @@ -363,14 +321,14 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if asPage is used", + "testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if custom isPageTarget is provided", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox"], "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if custom isPageTarget is provided", + "testIdPattern": "[devtools.spec] DevTools target.page() should return Page when calling asPage on DevTools target", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox"], "expectations": ["SKIP"], @@ -391,13 +349,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.clickablePoint should not work if the click box is not visible due to the iframe", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { "testIdPattern": "[evaluation.spec] Evaluation specs Page.evaluate should replace symbols with undefined", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp"], @@ -440,13 +391,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[frame.spec] Frame specs Frame Management should handle nested frames", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { "testIdPattern": "[frame.spec] Frame specs Frame Management should report frame.name()", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], @@ -482,17 +426,17 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[jshandle.spec] JSHandle Page.evaluateHandle should return the RemoteObject", + "testIdPattern": "[jshandle.spec] JSHandle JSHandle.toString should work with window subtypes", "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], + "parameters": ["cdp"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "CDP does not have special type for window" }, { - "testIdPattern": "[keyboard.spec] Keyboard should send a character with sendCharacter in iframe", + "testIdPattern": "[jshandle.spec] JSHandle Page.evaluateHandle should return the RemoteObject", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], - "expectations": ["SKIP"], + "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { @@ -580,6 +524,13 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[navigation.spec] navigation Page.goto should navigate to URL with hash and fire requests without hash", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "BiDi spec expect the request to not trim the hash" + }, + { "testIdPattern": "[navigation.spec] navigation Page.goto should send referer", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], @@ -599,11 +550,11 @@ "expectations": ["PASS"] }, { - "testIdPattern": "[network.spec] network Page.setBypassServiceWorker *", - "platforms": ["win32"], + "testIdPattern": "[network.spec] network Page.setExtraHTTPHeaders *", + "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "Firefox does not support headers override" }, { "testIdPattern": "[network.spec] network Request.initiator should return the initiator", @@ -625,6 +576,12 @@ "expectations": ["PASS"] }, { + "testIdPattern": "[network.spec] network Request.isNavigationRequest should work with request interception", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["PASS"] + }, + { "testIdPattern": "[network.spec] network Request.postData should be |undefined| when there is no post data", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], @@ -671,7 +628,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "See https://github.com/puppeteer/puppeteer/issues/4840" }, { "testIdPattern": "[page.spec] Page Page.addStyleTag should throw when added with content to the CSP page", @@ -681,13 +638,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[page.spec] Page Page.bringToFront should work", - "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": "[page.spec] Page Page.close should *not* run beforeunload by default", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -713,7 +663,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "BiDi does not support getting a Handle for log args" }, { "testIdPattern": "[page.spec] Page Page.Events.Console should return remote objects", @@ -744,18 +694,11 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[page.spec] Page Page.exposeFunction should work with loading frames", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "Missing request interception" - }, - { "testIdPattern": "[page.spec] Page Page.pdf should respect timeout", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox"], "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "https://github.com/puppeteer/puppeteer/issues/12152" }, { "testIdPattern": "[page.spec] Page Page.setBypassCSP *", @@ -765,13 +708,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[page.spec] Page Page.setCacheEnabled should stay disabled when toggling request interception on/off", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { "testIdPattern": "[page.spec] Page Page.setOfflineMode should emulate navigator.onLine", "platforms": ["darwin", "linux", "win32"], "parameters": ["webDriverBiDi"], @@ -802,6 +738,13 @@ { "testIdPattern": "[prerender.spec] Prerender can screencast", "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome"], + "expectations": ["SKIP"], + "comment": "Currently no reliable ffmpeg downloads for testing https://github.com/puppeteer/puppeteer/issues/12121" + }, + { + "testIdPattern": "[prerender.spec] Prerender can screencast", + "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox"], "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" @@ -849,6 +792,27 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should navigate to URL with hash and fire requests without hash", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "BiDi spec expect the request to not trim the hash" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Request.continue *", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs full support for continueRequest in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1850680" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Request.respond *", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs full support for continueResponse in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1853887" + }, + { "testIdPattern": "[requestinterception.spec] *", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -856,6 +820,55 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should be abortable with custom error codes", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "`HTTPRequest.resourceType()` has no eqivalent in BiDi spec" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should intercept", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "`request.postData()` has no eqivalent in BiDi spec" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should navigate to URL with hash and fire requests without hash", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "BiDi spec and WPT require expect the Hash" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with redirects", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "`HTTPRequest.resourceType()` has no eqivalent in BiDi spec" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with redirects for subresources", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "`HTTPRequest.resourceType()` has no eqivalent in BiDi spec" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Request.continue *", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs full support for continueRequest in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1850680" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Request.respond *", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs full support for continueResponse in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1853887" + }, + { "testIdPattern": "[screencast.spec] Screencasts Page.screencast should validate options", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox"], @@ -953,53 +966,74 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[bfcache.spec] BFCache can navigate to a BFCached page containing an OOPIF and a worker", + "testIdPattern": "[accessibility.spec] Accessibility should work", "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox"], - "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "Change in A11Y tree on Canary" }, { - "testIdPattern": "[browser.spec] Browser specs Browser.isConnected should set the browser connected state", + "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryAllArray $$eval should handle many elements", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["PASS", "TIMEOUT"], + "comment": "times out flakily" + }, + { + "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryOne (Chromium web test) should find by role \"button\"", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "Querying by a11y attributes is not standard behavior" + }, + { + "testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler queryOne (Chromium web test) should find by role \"heading\"", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "Querying by a11y attributes is not standard behavior" + }, + { + "testIdPattern": "[bfcache.spec] BFCache can navigate to a BFCached page containing an OOPIF and a worker", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["cdp", "firefox"], "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[browser.spec] Browser specs Browser.process should not return child_process for remote browser", + "testIdPattern": "[browser.spec] Browser specs Browser.isConnected should set the browser connected state", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[browser.spec] Browser specs Browser.userAgent should include Browser engine", + "testIdPattern": "[browser.spec] Browser specs Browser.process should keep connected after the last page is closed", "platforms": ["darwin", "linux", "win32"], "parameters": ["chrome", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "The new headless does not allow opening a tab after the browser was closed" }, { - "testIdPattern": "[browser.spec] Browser specs Browser.userAgent should include Browser engine", + "testIdPattern": "[browser.spec] Browser specs Browser.process should not return child_process for remote browser", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], + "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[browser.spec] Browser specs Browser.version should return version", + "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should deny permission when not listed", "platforms": ["darwin", "linux", "win32"], - "parameters": ["chrome", "webDriverBiDi"], + "parameters": ["cdp", "firefox"], "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should deny permission when not listed", "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox"], + "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1894217" }, { "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should fail when bad permission is given", @@ -1015,6 +1049,13 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should grant permission when listed", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1894217" + }, + { "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should grant persistent-storage", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -1022,6 +1063,13 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should grant persistent-storage", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1894217" + }, + { "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should isolate permissions between browser contexts", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -1029,6 +1077,13 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should isolate permissions between browser contexts", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1894217" + }, + { "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should reset permissions", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -1036,6 +1091,13 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should reset permissions", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1894217" + }, + { "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should trigger permission onchange", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -1043,10 +1105,11 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[browsercontext.spec] BrowserContext should create new incognito context", + "testIdPattern": "[browsercontext.spec] BrowserContext BrowserContext.overridePermissions should trigger permission onchange", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["PASS"] + "expectations": ["FAIL"], + "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1894217" }, { "testIdPattern": "[browsercontext.spec] BrowserContext should fire target events", @@ -1063,12 +1126,6 @@ "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"], "parameters": ["cdp", "firefox"], @@ -1106,13 +1163,6 @@ { "testIdPattern": "[CDPSession.spec] Target.createCDPSession should respect custom timeout", "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": "[CDPSession.spec] Target.createCDPSession should respect custom timeout", - "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" @@ -1139,13 +1189,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[chromiumonly.spec] Chromium-Specific Page Tests Page.setRequestInterception should work with intervention headers", - "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": "[click.spec] Page.click should click on checkbox label and toggle", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -1160,20 +1203,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[click.spec] Page.click should click the button with deviceScaleFactor set", - "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": "[click.spec] Page.click should click the button with fixed position inside an iframe", - "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": "[click.spec] Page.click should click the button with fixed position inside an iframe", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -1248,7 +1277,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648" + "comment": "Firefox default partition key is inconsistent: #12004" }, { "testIdPattern": "[cookies.spec] Cookie specs Page.deleteCookie should delete cookie", @@ -1269,7 +1298,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648" + "comment": "Firefox default partition key is inconsistent: #12004" }, { "testIdPattern": "[cookies.spec] Cookie specs Page.deleteCookie should not delete cookie for different domain", @@ -1311,7 +1340,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648" + "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { "testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set cookie with reasonable defaults", @@ -1332,7 +1361,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648" + "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { "testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set multiple cookies", @@ -1346,7 +1375,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648" + "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { "testIdPattern": "[cookies.spec] Cookie specs Page.setCookie should set secure same-site cookies from a frame", @@ -1367,7 +1396,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648" + "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { "testIdPattern": "[debugInfo.spec] DebugInfo Browser.debugInfo should work", @@ -1381,7 +1410,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["FAIL", "PASS"], - "comment": "https://github.com/puppeteer/puppeteer/issues/12010" + "comment": "Firefox CDP does not support isolation so this test might fail if other tests set cookies" }, { "testIdPattern": "[defaultbrowsercontext.spec] DefaultBrowserContext page.deleteCookie() should work", @@ -1395,7 +1424,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648" + "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { "testIdPattern": "[defaultbrowsercontext.spec] DefaultBrowserContext page.setCookie() should work", @@ -1409,7 +1438,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=1884648" + "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { "testIdPattern": "[device-request-prompt.spec] device request prompt does not crash", @@ -1594,13 +1623,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[emulation.spec] Emulation Page.viewport should load correct pictures when emulation dpr", - "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": "[emulation.spec] Emulation Page.viewport should support landscape emulation", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -1622,13 +1644,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[emulation.spec] Emulation Page.viewport should update media queries when resoltion changes", - "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": "[evaluation.spec] Evaluation specs Page.evaluate should simulate a user gesture", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -1755,6 +1770,12 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[idle_override.spec] Emulate idle state changing idle state emulation causes change of the IdleDetector state", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["PASS"] + }, + { "testIdPattern": "[ignorehttpserrors.spec] ignoreHTTPSErrors Response.securityDetails Network redirects should report SecurityDetails", "platforms": ["darwin", "linux", "win32"], "parameters": ["chrome", "webDriverBiDi"], @@ -1813,25 +1834,11 @@ { "testIdPattern": "[ignorehttpserrors.spec] ignoreHTTPSErrors should work with request interception", "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": "[ignorehttpserrors.spec] ignoreHTTPSErrors should work with request interception", - "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[ignorehttpserrors.spec] ignoreHTTPSErrors should work with request interception", - "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": "[input.spec] input tests FileChooser.accept should accept single file", "platforms": ["darwin", "linux", "win32"], "parameters": ["chrome", "webDriverBiDi"], @@ -2212,13 +2219,6 @@ { "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Browser.disconnect should reject navigation when browser closes", "platforms": ["darwin", "linux", "win32"], - "parameters": ["chrome", "webDriverBiDi"], - "expectations": ["SKIP"], - "comment": "https://github.com/puppeteer/puppeteer/issues/11849" - }, - { - "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Browser.disconnect should reject navigation when browser closes", - "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["FAIL", "PASS"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" @@ -2228,7 +2228,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "https://github.com/puppeteer/puppeteer/issues/11849" }, { "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.connect should be able to close remote browser", @@ -2350,20 +2350,6 @@ "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"], - "parameters": ["chrome", "webDriverBiDi"], - "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 should be able to launch Firefox", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], @@ -2546,20 +2532,6 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[navigation.spec] navigation Page.goto should navigate to URL with hash and fire requests without hash", - "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": "[navigation.spec] navigation Page.goto should not leak listeners during navigation", - "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": "[navigation.spec] navigation Page.goto should send referer", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -2696,8 +2668,7 @@ "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)" + "expectations": ["PASS"] }, { "testIdPattern": "[network.spec] network Network Events Page.Events.Response", @@ -2742,6 +2713,13 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[network.spec] network Page.authenticate should allow disable authentication", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL", "PASS"], + "comment": "FAIL: The Puppeteer implementation does not expect 2 responseCompleted events (that AuthRequired triggered). PASS: Only one event on late beta (Bug 1893664)." + }, + { "testIdPattern": "[network.spec] network Page.authenticate should fail if wrong credentials", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -2756,6 +2734,13 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[network.spec] network Page.authenticate should not disable caching", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "Firefox returns `fromCache: false`" + }, + { "testIdPattern": "[network.spec] network Page.authenticate should work", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -2763,6 +2748,20 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[network.spec] network Page.authenticate should work", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["FAIL", "PASS"], + "comment": "Flaky see https://github.com/puppeteer/puppeteer/issues/12253" + }, + { + "testIdPattern": "[network.spec] network Page.authenticate should work", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["TIMEOUT"], + "comment": "When navigating to page with authentication the command response (error) never comes without interception" + }, + { "testIdPattern": "[network.spec] network Page.setExtraHTTPHeaders should work", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -2847,13 +2846,6 @@ "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"], "parameters": ["cdp", "firefox"], @@ -2890,13 +2882,6 @@ }, { "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"], "parameters": ["cdp", "firefox"], "expectations": ["SKIP"], @@ -2931,13 +2916,6 @@ "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"], "parameters": ["cdp", "firefox"], @@ -2980,38 +2958,17 @@ "comment": "Failed previously and currently times out" }, { - "testIdPattern": "[oopif.spec] OOPIF should load oopif iframes with subresources and request interception", - "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": "[oopif.spec] OOPIF should load oopif iframes with subresources and request interception", - "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": "[oopif.spec] OOPIF should report google.com frame", - "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": "[oopif.spec] OOPIF should report google.com frame", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], + "expectations": ["FAIL", "TIMEOUT"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { "testIdPattern": "[oopif.spec] OOPIF should support lazy OOP frames", "platforms": ["darwin", "linux", "win32"], "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], + "expectations": ["FAIL", "TIMEOUT"], "comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=187816" }, { @@ -3082,7 +3039,7 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "chrome"], "expectations": ["SKIP"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "See https://github.com/puppeteer/puppeteer/issues/4840" }, { "testIdPattern": "[page.spec] Page Page.addScriptTag should throw when added with content to the CSP page", @@ -3311,6 +3268,13 @@ { "testIdPattern": "[page.spec] Page Page.setCacheEnabled should stay disabled when toggling request interception on/off", "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": "[page.spec] Page Page.setCacheEnabled should stay disabled when toggling request interception on/off", + "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" @@ -3369,14 +3333,14 @@ "platforms": ["darwin", "linux", "win32"], "parameters": ["chrome", "headful"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "only works in the old headless code" }, { "testIdPattern": "[pdf.spec] Page.pdf can print to PDF with outline", "platforms": ["darwin", "linux", "win32"], "parameters": ["chrome", "headless"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "only works in the old headless code" }, { "testIdPattern": "[proxy.spec] request proxy in incognito browser context should proxy requests when configured at context level", @@ -3426,6 +3390,158 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should be able to fetch dataURL and fire dataURL requests", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for data URIs in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1805176" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should be able to remove headers", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs investigation, on Firefox the test is passing even if the origin header is not removed" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should be abortable with custom error codes", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Test relies on chrome-only error code (Firefox currently outputs NS_ERROR_ABORT)" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should cache if cache enabled", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for enabling cache in BiDi without CDP https://github.com/w3c/webdriver-bidi/issues/582" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should cooperatively continue by priority", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs full support for continueRequest in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1850680" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should cooperatively respond by priority", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs full support for continueRequest in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1850680" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should intercept", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs Puppeteer support for BidiHTTPRequest.postData" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should load fonts if cache enabled", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for enabling cache in BiDi without CDP https://github.com/w3c/webdriver-bidi/issues/582" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should navigate to dataURL and fire dataURL requests", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for data URIs in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1805176" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should not cache if cache disabled", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for enabling cache in BiDi without CDP https://github.com/w3c/webdriver-bidi/issues/582" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should send referer", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should show custom HTTP headers", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work when header manipulation headers with redirect", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs investigation, on Firefox the test is passing even if headers are not actually modified" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with custom referer headers", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with encoded server - 2", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for data URIs in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1805176" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with equal requests", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "TODO: Needs investigation, it looks like Firefox lets the request go also to the server" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with file URLs", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for file URIs in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1826210" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with redirects", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for BidiHTTPRequest.resourceType" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with redirects for subresources", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for BidiHTTPRequest.resourceType" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with requests without networkId", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "Test requires CDP" + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Request.continue should work", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["PASS"] + }, + { + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Request.respond should indicate already-handled if an intercept has been handled", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["PASS"] + }, + { "testIdPattern": "[requestinterception-experimental.spec] request interception \"after each\" hook in \"request interception\"", "platforms": ["win32"], "parameters": ["cdp", "chrome"], @@ -3454,6 +3570,55 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should be able to fetch dataURL and fire dataURL requests", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for data URIs in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1805176" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should be able to remove headers", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs investigation, on Firefox the test is passing even if the origin header is not removed" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should be abortable with custom error codes", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Test relies on chrome-only error code (Firefox currently outputs NS_ERROR_ABORT)" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should cache if cache enabled", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for enabling cache in BiDi without CDP https://github.com/w3c/webdriver-bidi/issues/582" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should intercept", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs Puppeteer support for BidiHTTPRequest.postData" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should load fonts if cache enabled", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for enabling cache in BiDi without CDP https://github.com/w3c/webdriver-bidi/issues/582" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should navigate to dataURL and fire dataURL requests", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for data URIs in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1805176" + }, + { "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should navigate to URL with hash and fire requests without hash", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "chrome"], @@ -3461,6 +3626,117 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should not cache if cache disabled", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for enabling cache in BiDi without CDP https://github.com/w3c/webdriver-bidi/issues/582" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should send referer", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should send referer", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should show custom HTTP headers", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should show custom HTTP headers", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work when header manipulation headers with redirect", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs investigation, on Firefox the test is passing even if headers are not actually modified" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with custom referer headers", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with custom referer headers", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "Firefox does not support headers override" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with encoded server - 2", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for data URIs in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1805176" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with equal requests", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "TODO: Needs investigation" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with file URLs", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for file URIs in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1826210" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with redirects", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for BidiHTTPRequest.resourceType" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with redirects for subresources", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "TODO: Needs support for BidiHTTPRequest.resourceType" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with requests without networkId", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "Test requires CDP" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with requests without networkId", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "CDP specific issue, maybe we can support it from BiDi+" + }, + { + "testIdPattern": "[requestinterception.spec] request interception Request.continue should work", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["PASS"] + }, + { "testIdPattern": "[screenshot.spec] Screenshots Cdp should use scale for clip", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "firefox"], @@ -3789,6 +4065,12 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { + "testIdPattern": "[worker.spec] Workers should report errors", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["PASS"] + }, + { "testIdPattern": "[CDPSession.spec] Target.createCDPSession should send events", "platforms": ["win32"], "parameters": ["cdp", "chrome", "headless"], @@ -3810,14 +4092,14 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if asPage is used", + "testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if custom isPageTarget is provided", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "chrome", "chrome-headless-shell"], "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[devtools.spec] DevTools target.page() should return a DevTools page if custom isPageTarget is provided", + "testIdPattern": "[devtools.spec] DevTools target.page() should return Page when calling asPage on DevTools target", "platforms": ["darwin", "linux", "win32"], "parameters": ["cdp", "chrome", "chrome-headless-shell"], "expectations": ["SKIP"], @@ -3845,13 +4127,6 @@ "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"], "parameters": ["cdp", "chrome", "headless"], @@ -3873,52 +4148,52 @@ "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { - "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should be abortable", + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should be abortable with custom error codes", "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "chrome", "headful"], - "expectations": ["FAIL", "PASS"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "parameters": ["chrome", "headless", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "`HTTPRequest.resourceType()` has no eqivalent in BiDi spec" }, { - "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with redirects", - "platforms": ["win32"], - "parameters": ["cdp", "chrome", "headless"], - "expectations": ["FAIL", "PASS"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should intercept", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "headless", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "`request.postData()` has no eqivalent in BiDi spec" }, { - "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with redirects", - "platforms": ["win32"], - "parameters": ["cdp", "chrome", "headful"], - "expectations": ["FAIL", "PASS"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with redirects", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "headless", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "`HTTPRequest.resourceType()` has no eqivalent in BiDi spec" }, { - "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work for an element with an offset", + "testIdPattern": "[requestinterception-experimental.spec] cooperative request interception Page.setRequestInterception should work with redirects for subresources", "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox", "headful"], + "parameters": ["chrome", "headless", "webDriverBiDi"], "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" + "comment": "`HTTPRequest.resourceType()` has no eqivalent in BiDi spec" }, { - "testIdPattern": "[screenshot.spec] Screenshots ElementHandle.screenshot should work for an element with an offset", + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should be abortable", "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox", "headless"], - "expectations": ["FAIL"], + "parameters": ["cdp", "chrome", "headful"], + "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 with a rotated element", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox", "headful"], - "expectations": ["FAIL"], + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with redirects", + "platforms": ["win32"], + "parameters": ["cdp", "chrome", "headless"], + "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 with a rotated element", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox", "headless"], - "expectations": ["FAIL"], + "testIdPattern": "[requestinterception.spec] request interception Page.setRequestInterception should work with redirects", + "platforms": ["win32"], + "parameters": ["cdp", "chrome", "headful"], + "expectations": ["FAIL", "PASS"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, { diff --git a/remote/test/puppeteer/test/TestSuites.json b/remote/test/puppeteer/test/TestSuites.json index 3c36f8d7a4..1b36a3ef4c 100644 --- a/remote/test/puppeteer/test/TestSuites.json +++ b/remote/test/puppeteer/test/TestSuites.json @@ -45,7 +45,7 @@ { "id": "chrome-bidi", "platforms": ["linux"], - "parameters": ["chrome", "chrome-headless-shell", "webDriverBiDi"], + "parameters": ["chrome", "headless", "webDriverBiDi"], "expectedLineCoverage": 56 } ], diff --git a/remote/test/puppeteer/test/golden-chrome/screenshot-element-clip.png b/remote/test/puppeteer/test/golden-chrome/screenshot-element-clip.png Binary files differnew file mode 100644 index 0000000000..609952cd3d --- /dev/null +++ b/remote/test/puppeteer/test/golden-chrome/screenshot-element-clip.png diff --git a/remote/test/puppeteer/test/golden-firefox/screenshot-element-clip.png b/remote/test/puppeteer/test/golden-firefox/screenshot-element-clip.png Binary files differnew file mode 100644 index 0000000000..609952cd3d --- /dev/null +++ b/remote/test/puppeteer/test/golden-firefox/screenshot-element-clip.png diff --git a/remote/test/puppeteer/test/installation/assets/puppeteer-core/launch.js b/remote/test/puppeteer/test/installation/assets/puppeteer-core/launch.js index 4776d7e261..b0982cdd90 100644 --- a/remote/test/puppeteer/test/installation/assets/puppeteer-core/launch.js +++ b/remote/test/puppeteer/test/installation/assets/puppeteer-core/launch.js @@ -13,7 +13,11 @@ import puppeteer from 'puppeteer-core'; executablePath: 'node', }); } catch (error) { - if (error.message.includes('Failed to launch the browser process')) { + if ( + error.message.includes( + 'Browser was not found at the configured executablePath (node)' + ) + ) { process.exit(0); } console.error(error); diff --git a/remote/test/puppeteer/test/installation/package.json b/remote/test/puppeteer/test/installation/package.json index bd21ac4b0a..17ee450391 100644 --- a/remote/test/puppeteer/test/installation/package.json +++ b/remote/test/puppeteer/test/installation/package.json @@ -44,7 +44,7 @@ "assets" ], "dependencies": { - "glob": "10.3.10", - "mocha": "10.3.0" + "glob": "10.3.12", + "mocha": "10.4.0" } } diff --git a/remote/test/puppeteer/test/installation/src/puppeteer-firefox.spec.ts b/remote/test/puppeteer/test/installation/src/puppeteer-firefox.spec.ts index b599af01dc..addaebbbd0 100644 --- a/remote/test/puppeteer/test/installation/src/puppeteer-firefox.spec.ts +++ b/remote/test/puppeteer/test/installation/src/puppeteer-firefox.spec.ts @@ -5,6 +5,8 @@ */ import assert from 'assert'; +import {spawnSync} from 'child_process'; +import {existsSync} from 'fs'; import {readdir} from 'fs/promises'; import {platform} from 'os'; import {join} from 'path'; @@ -49,3 +51,36 @@ import {readAsset} from './util.js'; }); } ); + +describe('Firefox download', () => { + configureSandbox({ + dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'], + env: cwd => { + return { + PUPPETEER_CACHE_DIR: join(cwd, '.cache', 'puppeteer'), + PUPPETEER_SKIP_DOWNLOAD: 'true', + }; + }, + }); + + it('can download Firefox stable', async function () { + assert.ok(!existsSync(join(this.sandbox, '.cache', 'puppeteer'))); + const result = spawnSync( + 'npx', + ['puppeteer', 'browsers', 'install', 'firefox@stable'], + { + // npx is not found without the shell flag on Windows. + shell: process.platform === 'win32', + cwd: this.sandbox, + env: { + ...process.env, + PUPPETEER_CACHE_DIR: join(this.sandbox, '.cache', 'puppeteer'), + }, + } + ); + assert.strictEqual(result.status, 0); + const files = await readdir(join(this.sandbox, '.cache', 'puppeteer')); + assert.equal(files.length, 1); + assert.equal(files[0], 'firefox'); + }); +}); diff --git a/remote/test/puppeteer/test/src/ariaqueryhandler.spec.ts b/remote/test/puppeteer/test/src/ariaqueryhandler.spec.ts index 0ffb8ae6a5..4ab1df3a0a 100644 --- a/remote/test/puppeteer/test/src/ariaqueryhandler.spec.ts +++ b/remote/test/puppeteer/test/src/ariaqueryhandler.spec.ts @@ -697,20 +697,13 @@ describe('AriaQueryHandler', () => { ElementHandle<HTMLButtonElement> >; const ids = await getIds(found); - expect(ids).toEqual([ - 'node5', - 'node6', - 'node7', - 'node8', - 'node10', - 'node21', - ]); + expect(ids).toEqual(['node5', 'node6', 'node8', 'node10', 'node21']); }); it('should find by role "heading"', async () => { const {page} = await setupPage(); const found = await page.$$('aria/[role="heading"]'); const ids = await getIds(found); - expect(ids).toEqual(['shown', 'hidden', 'node11', 'node13']); + expect(ids).toEqual(['shown', 'node11', 'node13']); }); it('should find both ignored and unignored', async () => { const {page} = await setupPage(); diff --git a/remote/test/puppeteer/test/src/browser.spec.ts b/remote/test/puppeteer/test/src/browser.spec.ts index b8e0c8bb07..edfa075c4d 100644 --- a/remote/test/puppeteer/test/src/browser.spec.ts +++ b/remote/test/puppeteer/test/src/browser.spec.ts @@ -6,7 +6,7 @@ import expect from 'expect'; -import {getTestState, setupTestBrowserHooks} from './mocha-utils.js'; +import {getTestState, launch, setupTestBrowserHooks} from './mocha-utils.js'; describe('Browser specs', function () { setupTestBrowserHooks(); @@ -64,6 +64,23 @@ describe('Browser specs', function () { expect(remoteBrowser.process()).toBe(null); await remoteBrowser.disconnect(); }); + it('should keep connected after the last page is closed', async () => { + const {browser, close} = await launch({}, {createContext: false}); + try { + const pages = await browser.pages(); + await Promise.all( + pages.map(page => { + return page.close(); + }) + ); + // Verify the browser is still connected. + expect(browser.connected).toBe(true); + // Verify the browser can open a new page. + await browser.newPage(); + } finally { + await close(); + } + }); }); describe('Browser.isConnected', () => { diff --git a/remote/test/puppeteer/test/src/cdp/CDPSession.spec.ts b/remote/test/puppeteer/test/src/cdp/CDPSession.spec.ts index 887152f097..01b0009433 100644 --- a/remote/test/puppeteer/test/src/cdp/CDPSession.spec.ts +++ b/remote/test/puppeteer/test/src/cdp/CDPSession.spec.ts @@ -134,7 +134,7 @@ describe('Target.createCDPSession', function () { } ) ).rejects.toThrowError( - `Runtime.evaluate timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.` + /Increase the 'protocolTimeout' setting in launch\/connect calls for a higher timeout if needed./gi ); }); diff --git a/remote/test/puppeteer/test/src/cdp/devtools.spec.ts b/remote/test/puppeteer/test/src/cdp/devtools.spec.ts index c48b4c353b..0f9330d15f 100644 --- a/remote/test/puppeteer/test/src/cdp/devtools.spec.ts +++ b/remote/test/puppeteer/test/src/cdp/devtools.spec.ts @@ -67,9 +67,9 @@ describe('DevTools', function () { return 2 * 3; }) ).toBe(6); - expect(await browser.pages()).toContainEqual(page); + expect(await browser.pages()).toContain(page); }); - it('target.page() should return a DevTools page if asPage is used', async function () { + it('target.page() should return Page when calling asPage on DevTools target', async function () { const {puppeteer} = await getTestState({skipLaunch: true}); const originalBrowser = await launchBrowser(launchOptions); @@ -87,7 +87,8 @@ describe('DevTools', function () { return 2 * 3; }) ).toBe(6); - expect(await browser.pages()).toContainEqual(page); + // The page won't be part of browser.pages() if a custom isPageTarget is not provided + expect(await browser.pages()).not.toContain(page); }); it('should open devtools when "devtools: true" option is given', async () => { const browser = await launchBrowser( diff --git a/remote/test/puppeteer/test/src/elementhandle.spec.ts b/remote/test/puppeteer/test/src/elementhandle.spec.ts index e0f1e41878..434ac9ca40 100644 --- a/remote/test/puppeteer/test/src/elementhandle.spec.ts +++ b/remote/test/puppeteer/test/src/elementhandle.spec.ts @@ -385,8 +385,15 @@ describe('ElementHandle specs', function () { await page.setContent( `<iframe name='frame' style='position: absolute; left: -100px' srcdoc="<button style='width: 10px; height: 10px;'></button>"></iframe>` ); - const frame = await page.waitForFrame(frame => { - return frame.name() === 'frame'; + const frame = await page.waitForFrame(async frame => { + using element = await frame.frameElement(); + if (!element) { + return false; + } + const name = await element.evaluate(frame => { + return frame.name; + }); + return name === 'frame'; }); using handle = await frame.locator('button').waitHandle(); @@ -395,8 +402,15 @@ describe('ElementHandle specs', function () { await page.setContent( `<iframe name='frame2' style='position: absolute; top: -100px' srcdoc="<button style='width: 10px; height: 10px;'></button>"></iframe>` ); - const frame2 = await page.waitForFrame(frame => { - return frame.name() === 'frame2'; + const frame2 = await page.waitForFrame(async frame => { + using element = await frame.frameElement(); + if (!element) { + return false; + } + const name = await element.evaluate(frame => { + return frame.name; + }); + return name === 'frame2'; }); using handle2 = await frame2.locator('button').waitHandle(); diff --git a/remote/test/puppeteer/test/src/frame.spec.ts b/remote/test/puppeteer/test/src/frame.spec.ts index a49fb19482..758725f932 100644 --- a/remote/test/puppeteer/test/src/frame.spec.ts +++ b/remote/test/puppeteer/test/src/frame.spec.ts @@ -7,6 +7,7 @@ import expect from 'expect'; import {CDPSession} from 'puppeteer-core/internal/api/CDPSession.js'; import type {Frame} from 'puppeteer-core/internal/api/Frame.js'; +import {assert} from 'puppeteer-core/internal/util/assert.js'; import {getTestState, setupTestBrowserHooks} from './mocha-utils.js'; import { @@ -78,7 +79,7 @@ describe('Frame specs', function () { const {page, server} = await getTestState(); await page.goto(server.PREFIX + '/frames/nested-frames.html'); - expect(dumpFrames(page.mainFrame())).toEqual([ + expect(await dumpFrames(page.mainFrame())).toEqual([ 'http://localhost:<PORT>/frames/nested-frames.html', ' http://localhost:<PORT>/frames/two-frames.html (2frames)', ' http://localhost:<PORT>/frames/frame.html (uno)', @@ -232,23 +233,6 @@ describe('Frame specs', function () { expect(page.frames()).toHaveLength(2); expect(page.frames()[1]!.url()).toBe(server.EMPTY_PAGE); }); - it('should report frame.name()', async () => { - const {page, server} = await getTestState(); - - await attachFrame(page, 'theFrameId', server.EMPTY_PAGE); - await page.evaluate((url: string) => { - const frame = document.createElement('iframe'); - frame.name = 'theFrameName'; - frame.src = url; - document.body.appendChild(frame); - return new Promise(x => { - return (frame.onload = x); - }); - }, server.EMPTY_PAGE); - expect(page.frames()[0]!.name()).toBe(''); - expect(page.frames()[1]!.name()).toBe('theFrameId'); - expect(page.frames()[2]!.name()).toBe('theFrameName'); - }); it('should report frame.parent()', async () => { const {page, server} = await getTestState(); @@ -306,4 +290,35 @@ describe('Frame specs', function () { expect(page.mainFrame().client).toBeInstanceOf(CDPSession); }); }); + + describe('Frame.prototype.frameElement', function () { + it('should work', async () => { + const {page, server} = await getTestState(); + + await attachFrame(page, 'theFrameId', server.EMPTY_PAGE); + await page.evaluate((url: string) => { + const frame = document.createElement('iframe'); + frame.name = 'theFrameName'; + frame.src = url; + document.body.appendChild(frame); + return new Promise(x => { + return (frame.onload = x); + }); + }, server.EMPTY_PAGE); + using frame0 = await page.frames()[0]?.frameElement(); + assert(!frame0); + using frame1 = await page.frames()[1]?.frameElement(); + assert(frame1); + using frame2 = await page.frames()[2]?.frameElement(); + assert(frame2); + const name1 = await frame1.evaluate(frame => { + return frame.id; + }); + expect(name1).toBe('theFrameId'); + const name2 = await frame2.evaluate(frame => { + return frame.name; + }); + expect(name2).toBe('theFrameName'); + }); + }); }); diff --git a/remote/test/puppeteer/test/src/jshandle.spec.ts b/remote/test/puppeteer/test/src/jshandle.spec.ts index 28097811e4..0c5de6cde0 100644 --- a/remote/test/puppeteer/test/src/jshandle.spec.ts +++ b/remote/test/puppeteer/test/src/jshandle.spec.ts @@ -326,6 +326,16 @@ describe('JSHandle', function () { 'JSHandle@proxy' ); }); + it('should work with window subtypes', async () => { + const {page} = await getTestState(); + + expect((await page.evaluateHandle('window')).toString()).toBe( + 'JSHandle@window' + ); + expect((await page.evaluateHandle('globalThis')).toString()).toBe( + 'JSHandle@window' + ); + }); }); describe('JSHandle[Symbol.dispose]', () => { diff --git a/remote/test/puppeteer/test/src/keyboard.spec.ts b/remote/test/puppeteer/test/src/keyboard.spec.ts index 9157465242..c6cc78c68b 100644 --- a/remote/test/puppeteer/test/src/keyboard.spec.ts +++ b/remote/test/puppeteer/test/src/keyboard.spec.ts @@ -186,8 +186,15 @@ describe('Keyboard', function () { await page.setContent(` <iframe srcdoc="<iframe name='test' srcdoc='<textarea></textarea>'></iframe>"</iframe> `); - const frame = await page.waitForFrame(frame => { - return frame.name() === 'test'; + const frame = await page.waitForFrame(async frame => { + using element = await frame.frameElement(); + if (!element) { + return false; + } + const name = await element.evaluate(frame => { + return frame.name; + }); + return name === 'test'; }); await frame.focus('textarea'); diff --git a/remote/test/puppeteer/test/src/launcher.spec.ts b/remote/test/puppeteer/test/src/launcher.spec.ts index 876f8d1624..e1eefaceb1 100644 --- a/remote/test/puppeteer/test/src/launcher.spec.ts +++ b/remote/test/puppeteer/test/src/launcher.spec.ts @@ -116,6 +116,30 @@ describe('Launcher specs', function () { const {close} = await launch({}); await close(); }); + + it('can launch multiple instances without node warnings', async () => { + const instances = []; + let warning = null; + const warningHandler: NodeJS.WarningListener = w => { + return (warning = w); + }; + process.on('warning', warningHandler); + process.setMaxListeners(1); + try { + for (let i = 0; i < 2; i++) { + instances.push(launch({})); + } + await Promise.all( + (await Promise.all(instances)).map(instance => { + return instance.close(); + }) + ); + } finally { + process.setMaxListeners(10); + } + process.off('warning', warningHandler); + expect(warning).toBe(null); + }); it('should have default url when launching browser', async function () { const {browser, close} = await launch({}, {createContext: false}); try { @@ -166,7 +190,9 @@ describe('Launcher specs', function () { }).catch(error => { return (waitError = error); }); - expect(waitError.message).toContain('Failed to launch'); + expect(waitError.message).toBe( + 'Browser was not found at the configured executablePath (random-invalid-path)' + ); }); it('userDataDir option', async () => { const userDataDir = await mkdtemp(TMP_FOLDER); @@ -591,6 +617,20 @@ describe('Launcher specs', function () { }); expect(error.message).toContain('either pipe or debugging port'); }); + + it('throws an error if executable path is not valid with pipe=true', async () => { + const options = { + executablePath: '/tmp/does-not-exist', + pipe: true, + }; + let error!: Error; + await launch(options).catch(error_ => { + return (error = error_); + }); + expect(error.message).toContain( + 'Browser was not found at the configured executablePath (/tmp/does-not-exist)' + ); + }); }); describe('Puppeteer.launch', function () { @@ -793,7 +833,7 @@ describe('Launcher specs', function () { const restoredPage = pages.find(page => { return page.url() === server.PREFIX + '/frames/nested-frames.html'; })!; - expect(dumpFrames(restoredPage.mainFrame())).toEqual([ + expect(await dumpFrames(restoredPage.mainFrame())).toEqual([ 'http://localhost:<PORT>/frames/nested-frames.html', ' http://localhost:<PORT>/frames/two-frames.html (2frames)', ' http://localhost:<PORT>/frames/frame.html (uno)', diff --git a/remote/test/puppeteer/test/src/navigation.spec.ts b/remote/test/puppeteer/test/src/navigation.spec.ts index dd59c98349..927dd02cd5 100644 --- a/remote/test/puppeteer/test/src/navigation.spec.ts +++ b/remote/test/puppeteer/test/src/navigation.spec.ts @@ -112,6 +112,27 @@ describe('navigation', function () { const response = await page.goto(server.PREFIX + '/grid.html'); expect(response!.status()).toBe(200); }); + it('should work when reload causes history API in beforeunload', async () => { + const {page, server} = await getTestState(); + + await page.goto(server.EMPTY_PAGE); + await page.evaluate(() => { + window.addEventListener( + 'beforeunload', + () => { + return history.replaceState(null, 'initial', window.location.href); + }, + false + ); + }); + await page.reload(); + // Evaluate still works. + expect( + await page.evaluate(() => { + return 1; + }) + ).toBe(1); + }); it('should navigate to empty page with networkidle0', async () => { const {page, server} = await getTestState(); diff --git a/remote/test/puppeteer/test/src/network.spec.ts b/remote/test/puppeteer/test/src/network.spec.ts index c6f51a3412..9d5b28d0c3 100644 --- a/remote/test/puppeteer/test/src/network.spec.ts +++ b/remote/test/puppeteer/test/src/network.spec.ts @@ -722,7 +722,7 @@ describe('network', function () { } catch (error) { // In headful, an error is thrown instead of 401. if ( - !(error as Error).message.startsWith( + !(error as Error).message?.includes( 'net::ERR_INVALID_AUTH_CREDENTIALS' ) ) { @@ -772,7 +772,7 @@ describe('network', function () { } catch (error) { // In headful, an error is thrown instead of 401. if ( - !(error as Error).message.startsWith( + !(error as Error).message?.includes( 'net::ERR_INVALID_AUTH_CREDENTIALS' ) ) { diff --git a/remote/test/puppeteer/test/src/page.spec.ts b/remote/test/puppeteer/test/src/page.spec.ts index d83920d3ff..bc07b1d259 100644 --- a/remote/test/puppeteer/test/src/page.spec.ts +++ b/remote/test/puppeteer/test/src/page.spec.ts @@ -506,11 +506,14 @@ describe('Page', function () { console.log(1, 2, 3, globalThis); }); const log = await logPromise; - expect(log.text()).toBe('1 2 3 JSHandle@object'); + + expect(log.text()).atLeastOneToContain([ + '1 2 3 JSHandle@object', + '1 2 3 JSHandle@window', + ]); expect(log.args()).toHaveLength(4); - expect(await (await log.args()[3]!.getProperty('test')).jsonValue()).toBe( - 1 - ); + using property = await log.args()[3]!.getProperty('test'); + expect(await property.jsonValue()).toBe(1); }); it('should trigger correct Log', async () => { const {page, server, isChrome} = await getTestState(); @@ -1210,13 +1213,15 @@ describe('Page', function () { expect(result).toBe(36); await page.removeExposedFunction('compute'); - let error: Error | null = null; - await page + const error = await page .evaluate(async function () { return (globalThis as any).compute(9, 4); }) - .catch(_error => { - return (error = _error); + .then(() => { + return null; + }) + .catch(error => { + return error; }); expect(error).toBeTruthy(); }); diff --git a/remote/test/puppeteer/test/src/requestinterception-experimental.spec.ts b/remote/test/puppeteer/test/src/requestinterception-experimental.spec.ts index 966554fd5d..ce3429f0b7 100644 --- a/remote/test/puppeteer/test/src/requestinterception-experimental.spec.ts +++ b/remote/test/puppeteer/test/src/requestinterception-experimental.spec.ts @@ -23,8 +23,7 @@ describe('cooperative request interception', function () { describe('Page.setRequestInterception', function () { const expectedActions: ActionResult[] = ['abort', 'continue', 'respond']; - while (expectedActions.length > 0) { - const expectedAction = expectedActions.pop(); + for (const expectedAction of expectedActions) { it(`should cooperatively ${expectedAction} by priority`, async () => { const {page, server} = await getTestState(); @@ -94,24 +93,36 @@ describe('cooperative request interception', function () { const {page, server} = await getTestState(); await page.setRequestInterception(true); + let requestError; page.on('request', request => { if (isFavicon(request)) { void request.continue({}, 0); return; } - expect(request.url()).toContain('empty.html'); - expect(request.headers()['user-agent']).toBeTruthy(); - expect(request.method()).toBe('GET'); - expect(request.postData()).toBe(undefined); - expect(request.isNavigationRequest()).toBe(true); - expect(request.resourceType()).toBe('document'); - expect(request.frame() === page.mainFrame()).toBe(true); - expect(request.frame()!.url()).toBe('about:blank'); - void request.continue({}, 0); + try { + expect(request).toBeTruthy(); + expect(request.url()).toContain('empty.html'); + expect(request.headers()['user-agent']).toBeTruthy(); + expect(request.method()).toBe('GET'); + expect(request.postData()).toBe(undefined); + expect(request.isNavigationRequest()).toBe(true); + expect(request.resourceType()).toBe('document'); + expect(request.frame()!.url()).toBe('about:blank'); + expect(request.frame() === page.mainFrame()).toBe(true); + } catch (error) { + requestError = error; + } finally { + void request.continue({}, 0); + } }); + const response = (await page.goto(server.EMPTY_PAGE))!; - expect(response!.ok()).toBe(true); - expect(response!.remoteAddress().port).toBe(server.PORT); + if (requestError) { + throw requestError; + } + + expect(response.ok()).toBe(true); + expect(response.remoteAddress().port).toBe(server.PORT); }); // @see https://github.com/puppeteer/puppeteer/pull/3105 it('should work when POST is redirected with 302', async () => { @@ -141,16 +152,24 @@ describe('cooperative request interception', function () { server.setRedirect('/rrredirect', '/empty.html'); await page.setRequestInterception(true); + let requestError; page.on('request', request => { const headers = Object.assign({}, request.headers(), { foo: 'bar', }); void request.continue({headers}, 0); - - expect(request.continueRequestOverrides()).toEqual({headers}); + try { + expect(request.continueRequestOverrides()).toEqual({headers}); + } catch (error) { + requestError = error; + } }); // Make sure that the goto does not time out. await page.goto(server.PREFIX + '/rrredirect'); + + if (requestError) { + throw requestError; + } }); // @see https://github.com/puppeteer/puppeteer/issues/4743 it('should be able to remove headers', async () => { @@ -220,11 +239,20 @@ describe('cooperative request interception', function () { foo: 'bar', }); await page.setRequestInterception(true); + let requestError; page.on('request', request => { - expect(request.headers()['foo']).toBe('bar'); - void request.continue({}, 0); + try { + expect(request.headers()['foo']).toBe('bar'); + } catch (error) { + requestError = error; + } finally { + void request.continue({}, 0); + } }); const response = await page.goto(server.EMPTY_PAGE); + if (requestError) { + throw requestError; + } expect(response!.ok()).toBe(true); }); // @see https://github.com/puppeteer/puppeteer/issues/4337 @@ -250,11 +278,20 @@ describe('cooperative request interception', function () { await page.setExtraHTTPHeaders({referer: server.EMPTY_PAGE}); await page.setRequestInterception(true); + let requestError; page.on('request', request => { - expect(request.headers()['referer']).toBe(server.EMPTY_PAGE); - void request.continue({}, 0); + try { + expect(request.headers()['referer']).toBe(server.EMPTY_PAGE); + } catch (error) { + requestError = error; + } finally { + void request.continue({}, 0); + } }); const response = await page.goto(server.EMPTY_PAGE); + if (requestError) { + throw requestError; + } expect(response!.ok()).toBe(true); }); it('should be abortable', async () => { @@ -340,7 +377,7 @@ describe('cooperative request interception', function () { if (isChrome) { expect(error.message).toContain('net::ERR_FAILED'); } else { - expect(error.message).toContain('NS_ERROR_FAILURE'); + expect(error.message).toContain('NS_ERROR_ABORT'); } }); it('should work with redirects', async () => { @@ -947,14 +984,26 @@ describe('cooperative request interception', function () { page.on('request', request => { void request.continue(); }); + let requestError; page.on('request', request => { - expect(request.isInterceptResolutionHandled()).toBeTruthy(); + try { + expect(request.isInterceptResolutionHandled()).toBeTruthy(); + } catch (error) { + requestError = error; + } }); page.on('request', request => { const {action} = request.interceptResolutionState(); - expect(action).toBe(InterceptResolutionAction.AlreadyHandled); + try { + expect(action).toBe(InterceptResolutionAction.AlreadyHandled); + } catch (error) { + requestError = error; + } }); await page.goto(server.EMPTY_PAGE); + if (requestError) { + throw requestError; + } }); }); }); diff --git a/remote/test/puppeteer/test/src/requestinterception.spec.ts b/remote/test/puppeteer/test/src/requestinterception.spec.ts index 4b88d30a3b..2f73ae6974 100644 --- a/remote/test/puppeteer/test/src/requestinterception.spec.ts +++ b/remote/test/puppeteer/test/src/requestinterception.spec.ts @@ -22,23 +22,34 @@ describe('request interception', function () { const {page, server} = await getTestState(); await page.setRequestInterception(true); + let requestError; page.on('request', request => { if (isFavicon(request)) { void request.continue(); return; } - expect(request.url()).toContain('empty.html'); - expect(request.headers()['user-agent']).toBeTruthy(); - expect(request.headers()['accept']).toBeTruthy(); - expect(request.method()).toBe('GET'); - expect(request.postData()).toBe(undefined); - expect(request.isNavigationRequest()).toBe(true); - expect(request.resourceType()).toBe('document'); - expect(request.frame() === page.mainFrame()).toBe(true); - expect(request.frame()!.url()).toBe('about:blank'); - void request.continue(); + try { + expect(request).toBeTruthy(); + expect(request.url()).toContain('empty.html'); + expect(request.headers()['user-agent']).toBeTruthy(); + expect(request.method()).toBe('GET'); + expect(request.postData()).toBe(undefined); + expect(request.isNavigationRequest()).toBe(true); + expect(request.resourceType()).toBe('document'); + expect(request.frame()!.url()).toBe('about:blank'); + expect(request.frame() === page.mainFrame()).toBe(true); + } catch (error) { + requestError = error; + } finally { + void request.continue(); + } }); + const response = (await page.goto(server.EMPTY_PAGE))!; + if (requestError) { + throw requestError; + } + expect(response.ok()).toBe(true); expect(response.remoteAddress().port).toBe(server.PORT); }); @@ -76,7 +87,11 @@ describe('request interception', function () { }); void request.continue({headers}); }); - await page.goto(server.PREFIX + '/rrredirect'); + const [request] = await Promise.all([ + server.waitForRequest('/empty.html'), + page.goto(server.PREFIX + '/rrredirect'), + ]); + expect(request.headers['foo']).toBe('bar'); }); // @see https://github.com/puppeteer/puppeteer/issues/4743 it('should be able to remove headers', async () => { @@ -162,11 +177,21 @@ describe('request interception', function () { foo: 'bar', }); await page.setRequestInterception(true); + let requestError; page.on('request', request => { - expect(request.headers()['foo']).toBe('bar'); - void request.continue(); + try { + expect(request.headers()['foo']).toBe('bar'); + } catch (error) { + requestError = error; + } finally { + void request.continue(); + } }); + const response = (await page.goto(server.EMPTY_PAGE))!; + if (requestError) { + throw requestError; + } expect(response.ok()).toBe(true); }); // @see https://github.com/puppeteer/puppeteer/issues/4337 @@ -192,11 +217,13 @@ describe('request interception', function () { await page.setExtraHTTPHeaders({referer: server.EMPTY_PAGE}); await page.setRequestInterception(true); - page.on('request', request => { - expect(request.headers()['referer']).toBe(server.EMPTY_PAGE); + let request!: HTTPRequest; + page.on('request', req => { + request = req; void request.continue(); }); const response = (await page.goto(server.EMPTY_PAGE))!; + expect(request.headers()['referer']).toBe(server.EMPTY_PAGE); expect(response.ok()).toBe(true); }); it('should be abortable', async () => { @@ -267,7 +294,7 @@ describe('request interception', function () { if (isChrome) { expect(error.message).toContain('net::ERR_FAILED'); } else { - expect(error.message).toContain('NS_ERROR_FAILURE'); + expect(error.message).toContain('NS_ERROR_ABORT'); } }); it('should work with redirects', async () => { @@ -493,7 +520,7 @@ describe('request interception', function () { ))!; expect(response.status()).toBe(200); }); - it('should work wit h encoded server - 2', async () => { + it('should work with encoded server - 2', async () => { const {page, server} = await getTestState(); // The requestWillBeSent will report URL as-is, whereas interception will diff --git a/remote/test/puppeteer/test/src/screenshot.spec.ts b/remote/test/puppeteer/test/src/screenshot.spec.ts index 9176d0c920..9880581217 100644 --- a/remote/test/puppeteer/test/src/screenshot.spec.ts +++ b/remote/test/puppeteer/test/src/screenshot.spec.ts @@ -393,6 +393,33 @@ describe('Screenshots', function () { await context.close(); }); + + it('should use element clip', async () => { + const {page} = await getTestState(); + + await page.setViewport({width: 500, height: 500}); + await page.setContent(` + something above + <style>div { + border: 2px solid blue; + background: green; + width: 50px; + height: 50px; + } + </style> + <div></div> + `); + using elementHandle = (await page.$('div'))!; + const screenshot = await elementHandle.screenshot({ + clip: { + x: 10, + y: 10, + width: 20, + height: 20, + }, + }); + expect(screenshot).toBeGolden('screenshot-element-clip.png'); + }); }); describe('Cdp', () => { diff --git a/remote/test/puppeteer/test/src/utils.ts b/remote/test/puppeteer/test/src/utils.ts index d1bad65a16..d0dc08c33b 100644 --- a/remote/test/puppeteer/test/src/utils.ts +++ b/remote/test/puppeteer/test/src/utils.ts @@ -112,15 +112,24 @@ export async function navigateFrame( } } -export const dumpFrames = (frame: Frame, indentation?: string): string[] => { +export const dumpFrames = async ( + frame: Frame, + indentation?: string +): Promise<string[]> => { indentation = indentation || ''; let description = frame.url().replace(/:\d{4,5}\//, ':<PORT>/'); - if (frame.name()) { - description += ' (' + frame.name() + ')'; + using element = await frame.frameElement(); + if (element) { + const nameOrId = await element.evaluate(frame => { + return frame.name || frame.id; + }); + if (nameOrId) { + description += ' (' + nameOrId + ')'; + } } const result = [indentation + description]; for (const child of frame.childFrames()) { - result.push(...dumpFrames(child, ' ' + indentation)); + result.push(...(await dumpFrames(child, ' ' + indentation))); } return result; }; |