v1.28.0

microsoft/playwrightv1.28.0Nov 16, 2022by aslushnikov

AI Summary

Significant enhancements to the VSCode extension including recording at cursor and live locators, plus new test runner configuration options.

Key Highlights

  • Record at Cursor feature in VSCode extension.
  • Live Locators in VSCode and CodeGen for interactive debugging.
  • New `test.describe.configure()` for setting retries and timeouts per file.
  • New snapshot path templates for screenshot management.

New Features

  • Record at Cursor in VSCode
  • Live Locators in VSCode
  • Test retries and timeout configuration
  • Snapshot path templates
  • New locator methods (blur, clear)
  • New Android methods (launchServer, connect, on('close'))

Full Release Notes

## Playwright Tools

* **Record at Cursor in VSCode.** You can run the test, position the cursor at the end of the test and continue generating the test.

<img alt="New VSCode Extension" width=600 src="https://user-images.githubusercontent.com/746130/202005839-aba2eeba-217b-424d-8496-8b4f5fa72f41.png">

* **Live Locators in VSCode.** You can hover and edit locators in VSCode to get them  highlighted in the opened browser.
* **Live Locators in CodeGen.** Generate a locator for any element on the page using "Explore" tool.

<img alt="Locator Explorer" src="https://user-images.githubusercontent.com/746130/201796876-01567a0b-ca61-4a9d-b12b-04786c471671.png" width=600>

* **Codegen and Trace Viewer Dark Theme.** Automatically picked up from operating system settings.

<img alt="Dark Theme" src="https://user-images.githubusercontent.com/746130/201797969-603f74df-d7cf-4c56-befd-798dbd269796.png" width=600>


### Test Runner

* Configure retries and test timeout for a file or a test with [`test.describe.configure([options])`](https://playwright.dev/docs/api/class-test#test-describe-configure).

    ```js
    // Each test in the file will be retried twice and have a timeout of 20 seconds.
    test.describe.configure({ retries: 2, timeout: 20_000 });
    test('runs first', async ({ page }) => {});
    test('runs second', async ({ page }) => {});
    ```

* Use [`testProject.snapshotPathTemplate`](https://playwright.dev/docs/api/class-testproject#test-project-snapshot-path-template) and [`testConfig.snapshotPathTemplate`](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template) to configure a template controlling location of snapshots generated by [`expect(page).toHaveScreenshot(name[, options])`](https://playwright.dev/docs/test-assertions#page-assertions-to-have-screenshot-1) and [`expect(screenshot).toMatchSnapshot(name[, options])`](https://playwright.dev/docs/test-assertions#screenshot-assertions-to-match-snapshot-1).

    ```js
    // playwright.config.ts
    import type { PlaywrightTestConfig } from '@playwright/test';

    const config: PlaywrightTestConfig = {
      testDir: './tests',
      snapshotPathTemplate: '{testDir}/__screenshots__/{testFilePath}/{arg}{ext}',
    };

    export default config;
    ```

### New APIs

- [`locator.blur([options])`](https://playwright.dev/docs/api/class-locator#locator-blur)
- [`locator.clear([options])`](https://playwright.dev/docs/api/class-locator#locator-clear)
- [`android.launchServer([options])`](https://playwright.dev/docs/api/class-android#android-launch-server) and [`android.connect(wsEndpoint[, options])`](https://playwright.dev/docs/api/class-android#android-connect)
- [`androidDevice.on('close')`](https://playwright.dev/docs/api/class-androiddevice#android-device-event-close)

### Browser Versions

* Chromium 108.0.5359.29
* Mozilla Firefox 106.0
* WebKit 16.4

This version was also tested against the following stable channels:

* Google Chrome 107
* Microsoft Edge 107