fix: merge issue.

This commit is contained in:
Stevan Freeborn 2024-02-23 20:16:52 -06:00
parent bd021abf4e
commit 7c6466d55a

View file

@ -401,7 +401,6 @@ test('should respect PW_TEST_DISABLE_TRACING', async ({ runInlineTest }, testInf
expect(fs.existsSync(testInfo.outputPath('test-results', 'a-test-1', 'trace.zip'))).toBe(false);
});
for (const mode of ['off', 'retain-on-failure', 'on-first-retry', 'on-all-retries', 'on-first-failure']) {
for (const mode of ['off', 'retain-on-failure', 'on-first-retry', 'on-all-retries', 'on-first-failure']) {
test(`trace:${mode} should not create trace zip artifact if page test passed`, async ({ runInlineTest }) => {
const result = await runInlineTest({
@ -1035,68 +1034,6 @@ test('should attribute worker fixture teardown to the right test', async ({ runI
]);
});
test('trace:on-first-failure should create trace if context is closed before failure in the test', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { trace: 'on-first-failure' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
test('passing test', async ({ page, context }) => {
await page.goto('about:blank');
await context.close();
expect(1).toBe(2);
});
`,
}, { trace: 'retain-on-failure' });
const tracePath = test.info().outputPath('test-results', 'a-passing-test', 'trace.zip');
const trace = await parseTrace(tracePath);
expect(trace.apiNames).toContain('page.goto');
expect(result.failed).toBe(1);
});
test('trace:on-first-failure should create trace if context is closed before failure in afterEach', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { trace: 'on-first-failure' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
test('passing test', async ({ page, context }) => {
});
test.afterEach(async ({ page, context }) => {
await page.goto('about:blank');
await context.close();
expect(1).toBe(2);
});
`,
}, { trace: 'retain-on-failure' });
const tracePath = test.info().outputPath('test-results', 'a-passing-test', 'trace.zip');
const trace = await parseTrace(tracePath);
expect(trace.apiNames).toContain('page.goto');
expect(result.failed).toBe(1);
});
test('trace:on-first-failure should create trace if request context is disposed before failure', async ({ runInlineTest, server }) => {
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { trace: 'on-first-failure' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
test('passing test', async ({ request }) => {
expect(await request.get('${server.EMPTY_PAGE}')).toBeOK();
await request.dispose();
expect(1).toBe(2);
});
`,
}, { trace: 'retain-on-failure' });
const tracePath = test.info().outputPath('test-results', 'a-passing-test', 'trace.zip');
const trace = await parseTrace(tracePath);
expect(trace.apiNames).toContain('apiRequestContext.get');
expect(result.failed).toBe(1);
});
test('trace:on-first-failure should create trace but only on first failure', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.spec.ts': `