disable page snapshots for existing tests

This commit is contained in:
Simon Knott 2025-02-07 14:51:51 +01:00
parent c87d326943
commit 18bf687c0f
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
5 changed files with 44 additions and 15 deletions

View file

@ -128,7 +128,7 @@ test('should work with screenshot: on', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
module.exports = { use: { screenshot: 'on' } };
module.exports = { use: { screenshot: 'on', pageSnapshot: 'off' } };
`,
}, { workers: 1 });
@ -168,7 +168,7 @@ test('should work with screenshot: only-on-failure', async ({ runInlineTest }, t
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
module.exports = { use: { screenshot: 'only-on-failure' } };
module.exports = { use: { screenshot: 'only-on-failure', pageSnapshot: 'off' } };
`,
}, { workers: 1 });
@ -204,7 +204,7 @@ test('should work with screenshot: on-first-failure', async ({ runInlineTest },
'playwright.config.ts': `
module.exports = {
retries: 1,
use: { screenshot: 'on-first-failure' }
use: { screenshot: 'on-first-failure', pageSnapshot: 'off' }
};
`,
}, { workers: 1 });
@ -231,7 +231,7 @@ test('should work with screenshot: only-on-failure & fullPage', async ({ runInli
});
`,
'playwright.config.ts': `
module.exports = { use: { screenshot: { mode: 'only-on-failure', fullPage: true } } };
module.exports = { use: { screenshot: { mode: 'only-on-failure', fullPage: true }, pageSnapshot: 'off' } };
`,
}, { workers: 1 });
expect(result.exitCode).toBe(1);
@ -252,7 +252,7 @@ test('should work with trace: on', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
module.exports = { use: { trace: 'on' } };
module.exports = { use: { trace: 'on', pageSnapshot: 'off' } };
`,
}, { workers: 1 });
@ -288,7 +288,7 @@ test('should work with trace: retain-on-failure', async ({ runInlineTest }, test
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
module.exports = { use: { trace: 'retain-on-failure' } };
module.exports = { use: { trace: 'retain-on-failure', pageSnapshot: 'off' } };
`,
}, { workers: 1 });
@ -314,7 +314,7 @@ test('should work with trace: on-first-retry', async ({ runInlineTest }, testInf
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
module.exports = { use: { trace: 'on-first-retry' } };
module.exports = { use: { trace: 'on-first-retry', pageSnapshot: 'off' } };
`,
}, { workers: 1, retries: 1 });
@ -340,7 +340,7 @@ test('should work with trace: on-all-retries', async ({ runInlineTest }, testInf
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
module.exports = { use: { trace: 'on-all-retries' } };
module.exports = { use: { trace: 'on-all-retries', pageSnapshot: 'off' } };
`,
}, { workers: 1, retries: 2 });
@ -376,7 +376,7 @@ test('should work with trace: retain-on-first-failure', async ({ runInlineTest }
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
module.exports = { use: { trace: 'retain-on-first-failure' } };
module.exports = { use: { trace: 'retain-on-first-failure', pageSnapshot: 'off' } };
`,
}, { workers: 1, retries: 2 });

View file

@ -485,7 +485,7 @@ test('should work with video: retain-on-failure', async ({ runInlineTest }) => {
test('should work with video: on-first-retry', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { video: 'on-first-retry' }, retries: 1, name: 'chromium' };
module.exports = { use: { video: 'on-first-retry', pageSnapshot: 'off' }, retries: 1, name: 'chromium' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';

View file

@ -59,7 +59,7 @@ test('should stop tracing with trace: on-first-retry, when not retrying', async
test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { trace: 'on' } };
module.exports = { use: { trace: 'on', pageSnapshot: 'off' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@ -290,7 +290,7 @@ test('should work in serial mode', async ({ runInlineTest }, testInfo) => {
test('should not override trace file in afterAll', async ({ runInlineTest, server }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { trace: 'retain-on-failure' } };
module.exports = { use: { trace: 'retain-on-failure', , pageSnapshot: 'off' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@ -642,7 +642,7 @@ test('should expand expect.toPass', async ({ runInlineTest }, testInfo) => {
test('should show non-expect error in trace', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { trace: { mode: 'on' } } };
module.exports = { use: { trace: { mode: 'on', pageSnapshot: 'off' } } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@ -850,7 +850,7 @@ test('should record nested steps, even after timeout', async ({ runInlineTest },
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = {
use: { trace: { mode: 'on' } },
use: { trace: { mode: 'on', pageSnapshot: 'off' } },
timeout: 5000,
};
`,
@ -1156,6 +1156,9 @@ test('should record trace for manually created context in a failed test', async
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31541' });
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { pageSnapshot: 'off' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
test('fail', async ({ browser }) => {
@ -1234,6 +1237,9 @@ test('should record trace after fixture teardown timeout', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30718' },
}, async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { pageSnapshot: 'off' } };
`,
'a.spec.ts': `
import { test as base, expect } from '@playwright/test';
const test = base.extend({

View file

@ -192,6 +192,9 @@ test('should not report nested after hooks', async ({ runInlineTest }) => {
'playwright.config.ts': `
module.exports = {
reporter: './reporter',
use: {
pageSnapshot: 'off',
}
};
`,
'a.test.ts': `
@ -577,6 +580,9 @@ test('should not mark page.close as failed when page.click fails', async ({ runI
'playwright.config.ts': `
module.exports = {
reporter: './reporter',
use: {
pageSnapshot: 'off',
}
};
`,
'a.test.ts': `
@ -1230,6 +1236,9 @@ test('should report api step failure', async ({ runInlineTest }) => {
'playwright.config.ts': `
module.exports = {
reporter: './reporter',
use: {
pageSnapshot: 'off',
}
};
`,
'a.test.ts': `

View file

@ -619,6 +619,9 @@ test('should write missing expectations locally twice and attach them', async ({
const result = await runInlineTest({
...playwrightConfig({
snapshotPathTemplate: '__screenshots__/{testFilePath}/{arg}{ext}',
use: {
pageSnapshot: 'off',
},
}),
'a.spec.js': `
const { test, expect } = require('@playwright/test');
@ -688,7 +691,12 @@ test('should attach missing expectations to right step', async ({ runInlineTest
}
module.exports = Reporter;
`,
...playwrightConfig({ reporter: [['dot'], ['./reporter']] }),
...playwrightConfig({
reporter: [['dot'], ['./reporter']],
use: {
pageSnapshot: 'off',
}
}),
'a.spec.js': `
const { test, expect } = require('@playwright/test');
test('is a test', async ({ page }) => {
@ -1118,6 +1126,9 @@ test('should attach expected/actual/diff when sizes are different', async ({ run
const result = await runInlineTest({
...playwrightConfig({
snapshotPathTemplate: '__screenshots__/{testFilePath}/{arg}{ext}',
use: {
pageSnapshot: 'off',
},
}),
'__screenshots__/a.spec.js/snapshot.png': createImage(2, 2),
'a.spec.js': `
@ -1376,6 +1387,9 @@ test('should trim+sanitize attachment names and paths', async ({ runInlineTest }
const result = await runInlineTest({
...playwrightConfig({
snapshotPathTemplate: '__screenshots__/{testFilePath}/{arg}{ext}',
use: {
pageSnapshot: 'off',
}
}),
'a.spec.js': `
const { test, expect } = require('@playwright/test');