Skip to content

Commit adc4d01

Browse files
chore(driver): roll to 1.66.0-next (a804c19356) (#2075)
Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
1 parent b8c484d commit adc4d01

9 files changed

Lines changed: 85 additions & 7 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
1010

1111
| | Linux | macOS | Windows |
1212
| :--- | :---: | :---: | :---: |
13-
| Chromium <!-- GEN:chromium-version -->159.0.8154.13<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13+
| Chromium <!-- GEN:chromium-version -->159.0.8154.33<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1414
| WebKit <!-- GEN:webkit-version -->27.2<!-- GEN:stop --> | ✅ | ✅ | ✅ |
15-
| Firefox <!-- GEN:firefox-version -->159.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
15+
| Firefox <!-- GEN:firefox-version -->160.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1616

1717
## Documentation
1818

‎playwright/src/main/java/com/microsoft/playwright/impl/BrowserTypeImpl.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ private BrowserImpl browserFromConnectResult(BrowserTypeConnectOverCDPResult res
186186
BrowserImpl browser = result.browser;
187187
browser.connectToBrowserType(this, new LaunchOptions(), null);
188188
if (result.defaultContext != null) {
189-
instrumentation.runAfterCreateBrowserContext(result.defaultContext);
189+
BrowserContextImpl context = result.defaultContext;
190+
playwright.selectors.registerOnContext(context);
191+
instrumentation.runAfterCreateBrowserContext(context);
190192
}
191193
return browser;
192194
}

‎playwright/src/main/java/com/microsoft/playwright/impl/SelectorsImpl.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ private void registerImpl(String name, Object script, RegisterOptions options) {
6969
selectorEngines.add(engine);
7070
}
7171

72+
void registerOnContext(BrowserContextImpl context) {
73+
for (SelectorEngine selectorEngine : selectorEngines) {
74+
BrowserContextRegisterSelectorEngineParams params = new BrowserContextRegisterSelectorEngineParams();
75+
params.selectorEngine = selectorEngine;
76+
context.channel.registerSelectorEngine(params, NO_TIMEOUT);
77+
}
78+
if (testIdAttributeName != null) {
79+
BrowserContextSetTestIdAttributeNameParams params = new BrowserContextSetTestIdAttributeNameParams();
80+
params.testIdAttributeName = testIdAttributeName;
81+
context.channel.setTestIdAttributeName(params, NO_TIMEOUT);
82+
}
83+
}
84+
7285
@Override
7386
public void setTestIdAttribute(String attributeName) {
7487
if (attributeName == null) {

‎playwright/src/test/java/com/microsoft/playwright/tests/library/TestCapabilities.java‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.microsoft.playwright.Browser;
2020
import com.microsoft.playwright.BrowserContext;
21+
import com.microsoft.playwright.BrowserType;
2122
import com.microsoft.playwright.FileChooser;
2223
import com.microsoft.playwright.Frame;
2324
import com.microsoft.playwright.Locator;
@@ -30,14 +31,18 @@
3031
import com.microsoft.playwright.fixtures.DisabledOnBrowser;
3132
import com.microsoft.playwright.fixtures.EnabledOnBrowser;
3233
import com.microsoft.playwright.fixtures.Env;
34+
import com.microsoft.playwright.fixtures.Fixture;
3335
import com.microsoft.playwright.fixtures.HttpsTestServer;
3436
import com.microsoft.playwright.fixtures.PlaywrightTest;
37+
import com.microsoft.playwright.fixtures.Scope;
3538
import com.microsoft.playwright.fixtures.TestServer;
3639
import com.microsoft.playwright.options.BoundingBox;
3740
import org.junit.jupiter.api.DisplayName;
3841

3942
import java.nio.file.Path;
4043
import java.util.Arrays;
44+
import java.util.HashMap;
45+
import java.util.Map;
4146
import java.util.concurrent.CompletableFuture;
4247
import java.util.regex.Pattern;
4348

@@ -51,6 +56,20 @@
5156

5257
/** Port of tests/library/capabilities.spec.ts. */
5358
public class TestCapabilities {
59+
@Fixture(scope = Scope.WORKER)
60+
static BrowserType.LaunchOptions launchOptions(BrowserType.LaunchOptions launchOptions, BrowserName browserName) {
61+
if (browserName == BrowserName.FIREFOX) {
62+
Map<String, Object> firefoxUserPrefs = new HashMap<>();
63+
if (launchOptions.firefoxUserPrefs != null) {
64+
firefoxUserPrefs.putAll(launchOptions.firefoxUserPrefs);
65+
}
66+
// Test DOM fullscreen without requiring a window manager under Xvfb.
67+
firefoxUserPrefs.put("full-screen-api.ignore-widgets", true);
68+
return com.microsoft.playwright.impl.Utils.clone(launchOptions).setFirefoxUserPrefs(firefoxUserPrefs);
69+
}
70+
return launchOptions;
71+
}
72+
5473
@PlaywrightTest
5574
@DisplayName("CA-001 SharedArrayBuffer should work @smoke")
5675
void sharedArrayBufferShouldWork(ContextFactory contextFactory, HttpsTestServer httpsServer) {
@@ -316,8 +335,7 @@ void windowGestureEventInWebKit(Page page, TestServer server, BrowserName browse
316335

317336
@PlaywrightTest
318337
@DisplayName("CA-020 requestFullscreen")
319-
@DisabledOnBrowser(value = BrowserName.FIREFOX, headed = true, reason = "fixme: Error: Request for fullscreen was denied because requesting element is not in the currently focused tab")
320-
void requestFullscreen(Page page, TestServer server) {
338+
void requestFullscreen(Page page, TestServer server, BrowserName browserName) {
321339
page.navigate(server.EMPTY_PAGE);
322340
page.evaluate("() => {\n" +
323341
" const result = new Promise(resolve => document.addEventListener('fullscreenchange', resolve));\n" +
@@ -332,6 +350,8 @@ void requestFullscreen(Page page, TestServer server) {
332350
"}");
333351
assertEquals(false, page.evaluate("() => !!document.fullscreenElement"));
334352

353+
assumeFalse(browserName == BrowserName.WEBKIT && !Env.isLinux,
354+
"fixme: requestFullscreen() in a popup rejects with InvalidStateError on Windows and hangs the context teardown on macOS");
335355
Page popup = page.waitForPopup(() -> page.evaluate("url => window.open(url, 'popup', 'popup')", server.EMPTY_PAGE));
336356
popup.waitForLoadState();
337357
popup.evaluate("() => {\n" +

‎playwright/src/test/java/com/microsoft/playwright/tests/library/chromium/TestConnectOverCdp.java‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,46 @@ void shouldReturnValidBrowserFromContextBrowser(BrowserType browserType) {
472472
}
473473
}
474474

475+
@PlaywrightTest
476+
@DisplayName("CD-055 should work with registered selector engines")
477+
void shouldWorkWithRegisteredSelectorEngines(Playwright playwright, BrowserType browserType) {
478+
int port = findFreePort();
479+
Browser browserServer = browserType.launch(remoteDebuggingPort(port));
480+
try {
481+
// Java: invoke the factory, since register accepts script source rather than a JavaScript function.
482+
playwright.selectors().register("cdpTag", "(() => ({\n" +
483+
" query: (root, selector) => root.querySelector(selector),\n" +
484+
" queryAll: (root, selector) => Array.from(root.querySelectorAll(selector)),\n" +
485+
"}))()");
486+
Browser cdpBrowser = browserType.connectOverCDP("http://127.0.0.1:" + port + "/");
487+
Page page = cdpBrowser.contexts().get(0).newPage();
488+
page.setContent("<div>hello</div>");
489+
assertEquals("hello", page.locator("cdpTag=div").textContent());
490+
cdpBrowser.close();
491+
} finally {
492+
browserServer.close();
493+
}
494+
}
495+
496+
@PlaywrightTest
497+
@DisplayName("CD-056 should respect the test id attribute in strict mode errors")
498+
void shouldRespectTheTestIdAttributeInStrictModeErrors(Playwright playwright, BrowserType browserType) {
499+
int port = findFreePort();
500+
Browser browserServer = browserType.launch(remoteDebuggingPort(port));
501+
try {
502+
playwright.selectors().setTestIdAttribute("data-foo");
503+
Browser cdpBrowser = browserType.connectOverCDP("http://127.0.0.1:" + port + "/");
504+
Page page = cdpBrowser.contexts().get(0).newPage();
505+
page.setContent("<button data-foo=\"a\">x</button><button data-foo=\"b\">x</button>");
506+
PlaywrightException error = assertThrows(PlaywrightException.class, () -> page.locator("button").click());
507+
assertTrue(error.getMessage().contains("aka getByTestId(\"a\")"));
508+
cdpBrowser.close();
509+
} finally {
510+
playwright.selectors().setTestIdAttribute("data-testid");
511+
browserServer.close();
512+
}
513+
}
514+
475515
@PlaywrightTest
476516
@DisplayName("CD-020 should report an expected error when the endpointURL returns a non-expected status code")
477517
void shouldReportAnExpectedErrorWhenTheEndpointURLReturnsANonExpectedStatusCode(BrowserType browserType, TestServer server) {

‎playwright/src/test/java/com/microsoft/playwright/tests/page/TestPageScreenshot.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ void shouldRemoveElementsBasedOnAttr(Page page, TestServer server, TestInfo test
721721
}
722722

723723
@Nested
724+
@DisabledOnBrowser(value = BrowserName.FIREFOX, headed = true, reason = "Firefox headed produces a different image: https://github.com/microsoft/playwright-browsers/issues/2714")
724725
class PageScreenshotAnimations {
725726
@PlaywrightTest
726727
@DisplayName("SS-098 should preserve scroll animation progress during screenshots")

‎playwright/src/test/upstream_base.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# git log <commit>..main --oneline -- tests/page tests/library tests/registry.md
66
# git diff <commit>..main -- tests/page tests/library tests/registry.md
77
# and move this line forward together with the registry copy and the ports.
8-
b0e0b7b555e637cc8c0ce94dd98c3be153861333 2026-11-24 fix(test): watch external dependencies of test directories (#44317)
8+
a804c193562095b0da20e5d4679fa87e4c8e5563 2026-11-27 docs(python): fix async/sync mistakes in Python code snippets (#44410)

‎playwright/src/test/upstream_registry.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ subsystem, add a row to the Subsystems table. Then update this file:
766766
| `CD-052` | `library/chromium/session.spec.ts` | should work with newBrowserCDPSession |
767767
| `CD-053` | `library/chromium/connect-over-cdp.spec.ts` | should connect when another client inspects a terminated shared worker |
768768
| `CD-054` | `library/chromium/connect-over-cdp.spec.ts` | should not wait for a busy page longer than maxPageAttachTime |
769+
| `CD-055` | `library/chromium/connect-over-cdp.spec.ts` | should work with registered selector engines |
770+
| `CD-056` | `library/chromium/connect-over-cdp.spec.ts` | should respect the test id attribute in strict mode errors |
769771

770772
### CF — Code frame
771773

‎scripts/DRIVER_VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b0e0b7b555e637cc8c0ce94dd98c3be153861333
1+
a804c193562095b0da20e5d4679fa87e4c8e5563

0 commit comments

Comments
 (0)