v1.45.0
Clock
Utilizing the new Clock API allows to manipulate and control time within tests to verify time-related behavior. This API covers many common scenarios, including:
- testing with predefined time;
- keeping consistent time and timers;
- monitoring inactivity;
- ticking through time manually.
// Initialize clock with some time before the test time and let the page load
// naturally. `Date.now` will progress as the timers fire.
page.clock().install(new Clock.InstallOptions().setTime("2024-02-02T08:00:00"));
page.navigate("http://localhost:3333");
Locator locator = page.getByTestId("current-time");
// Pretend that the user closed the laptop lid and opened it again at 10am.
// Pause the time once reached that point.
page.clock().pauseAt("2024-02-02T10:00:00");
// Assert the page state.
assertThat(locator).hasText("2/2/2024, 10:00:00 AM");
// Close the laptop lid again and open it at 10:30am.
page.clock().fastForward("30:00");
assertThat(locator).hasText("2/2/2024, 10:30:00 AM");
See the clock guide for more details.
Miscellaneous
-
Method locator.setInputFiles() now supports uploading a directory for
<input type=file webkitdirectory>
elements.page.getByLabel("Upload directory").setInputFiles(Paths.get("mydir"));
-
Multiple methods like locator.click() or locator.press() now support a
ControlOrMeta
modifier key. This key maps toMeta
on macOS and maps toControl
on Windows and Linux.// Press the common keyboard shortcut Control+S or Meta+S to trigger a "Save" operation. page.keyboard.press("ControlOrMeta+S");
-
New property
httpCredentials.send
in apiRequest.newContext() that allows to either always send theAuthorization
header or only send it in response to401 Unauthorized
. -
Playwright now supports Chromium, Firefox and WebKit on Ubuntu 24.04.
-
v1.45 is the last release to receive WebKit update for macOS 12 Monterey. Please update macOS to keep using the latest WebKit.
Browser Versions
- Chromium 127.0.6533.5
- Mozilla Firefox 127.0
- WebKit 17.4
This version was also tested against the following stable channels:
- Google Chrome 126
- Microsoft Edge 126