Skip to content

Instantly share code, notes, and snippets.

@up1
Last active September 16, 2026 16:32
Show Gist options
  • Select an option

  • Save up1/4a4eb4dcabb3bdc2f2629b8e379914e9 to your computer and use it in GitHub Desktop.

Select an option

Save up1/4a4eb4dcabb3bdc2f2629b8e379914e9 to your computer and use it in GitHub Desktop.
Playwright 1.63
// Visual comparisons store the golden snapshot as lossless WebP.
await expect(page).toHaveScreenshot('homepage.webp');
// Standalone screenshots can trade quality for size with lossy WebP.
await page.screenshot({ path: 'homepage.webp', quality: 50 });
test('click should expand', async ({ mount }) => {
const component = await mount('components/Expandable/Stateful');
await component.getByRole('button').click();
await expect(component.getByTestId('expanded')).toHaveValue('true');
});
// playwright.config.ts
export default defineConfig({
retries: 2,
retryStrategy: 'isolated',
});
// Test A
test('update user settings', { lock: 'user-settings' }, async ({ page }) => {
// ...
});
// Test B
// Never runs concurrently with 'update user settings' above,
// even in a different project.
test('rename user', { lock: 'user-settings' }, async ({ page }) => {
// ...
});
// Test C
test('reset the database', { lock: ['database', 'external-api'] }, async () => {
// ...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment