Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(ui): ensure that --ignore-snapshots is respected (#32875)

Simon Knottc67a7335ab46
diff --git a/tests/playwright-test/ui-mode-test-run.spec.ts b/tests/playwright-test/ui-mode-test-run.spec.ts
index 81316f42ee..5ead1889f0 100644
--- a/tests/playwright-test/ui-mode-test-run.spec.ts
+++ b/tests/playwright-test/ui-mode-test-run.spec.ts
@@ -502,4 +502,24 @@ test('should respect --tsconfig option', {
`);
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
-});
\ No newline at end of file
+});
+
+test('should respect --ignore-snapshots option', {
+ annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32868' }
+}, async ({ runUITest }) => {
+ const { page } = await runUITest({
+ 'a.test.ts': `
+ import { test, expect } from '@playwright/test';
+ test('snapshot', () => {
+ expect('foo').toMatchSnapshot(); // fails because no snapshot is present
+ });
+ `,
+ }, undefined, { additionalArgs: ['--ignore-snapshots'] });
+
+ await page.getByTitle('Run all').click();
+
+ await expect.poll(dumpTestTree(page)).toBe(`
+ ▼ ✅ a.test.ts
+ ✅ snapshot
+ `);
+});