Playwright 1.51, released on March 6, 2025, introduces several enhancements aimed at improving debugging, reporting, and testing workflows.
Copy Prompt for AI Integration
A notable addition is the “Copy Prompt” feature, designed to facilitate AI integrations. This feature allows users to copy prompts directly from the Playwright Inspector, streamlining the process of incorporating AI-driven testing strategies.
Enhanced Git Information in Reports
The Playwright update also enriches test reports with detailed Git information. By embedding commit details and repository status into reports, teams can better trace test results back to specific code changes, enhancing collaboration and traceability. Set option testConfig.captureGitInfo to capture git information into testConfig.metadata.
import { defineConfig } from '@playwright/test';
export default defineConfig({
captureGitInfo: { commit: true, diff: true }
});
Test Steps in HTML Reports
Playwright 1.51 introduces the display of individual test steps within HTML reports. This enhancement provides clearer insights into test executions, making it easier to identify and debug issues at specific steps.
New ‘visible’ Option for Locator Filtering
A new ‘visible’ option has been added to the locator.filter()
method, allowing developers to match only visible elements. This simplifies interactions with elements that might be present in the DOM but not visible to users.
test('some test', async ({ page }) => {
// Ignore invisible todo items.
const todoItems = page.getByTestId('todo-item').filter({ visible: true });
// Check there are exactly 3 visible ones.
await expect(todoItems).toHaveCount(3);
});
Breaking Changes
The release notes highlight a breaking change where the chrome
and msedge
channels switch to a new headless mode. Users utilizing these channels in their configurations should verify compatibility and adjust their setups accordingly.
For a comprehensive overview of all updates and changes in Playwright 1.51, refer to the official release notes. These enhancements reflect Playwright’s commitment to providing robust tools for modern web testing and automation needs.