+
+ {prompt && }
+
{[...errorsModel.errors.entries()].map(([message, error]) => {
const errorId = `error-${wallTime}-${message}`;
return
;
diff --git a/packages/trace-viewer/src/ui/modelUtil.ts b/packages/trace-viewer/src/ui/modelUtil.ts
index a15167527e..1e036d525e 100644
--- a/packages/trace-viewer/src/ui/modelUtil.ts
+++ b/packages/trace-viewer/src/ui/modelUtil.ts
@@ -54,7 +54,6 @@ export type ErrorDescription = {
action?: ActionTraceEventInContext;
stack?: StackFrame[];
message: string;
- context?: trace.AfterActionTraceEventAttachment & { traceUrl: string };
};
export type Attachment = trace.AfterActionTraceEventAttachment & { traceUrl: string };
@@ -139,7 +138,6 @@ export class MultiTraceModel {
return this.errors.filter(e => !!e.message).map((error, i) => ({
stack: error.stack,
message: error.message,
- context: this.attachments.find(a => a.name === `error-context-${i}`),
}));
}
}
diff --git a/packages/trace-viewer/src/ui/workbench.tsx b/packages/trace-viewer/src/ui/workbench.tsx
index f533eefb0f..fd02499643 100644
--- a/packages/trace-viewer/src/ui/workbench.tsx
+++ b/packages/trace-viewer/src/ui/workbench.tsx
@@ -190,7 +190,7 @@ export const Workbench: React.FunctionComponent<{
id: 'errors',
title: 'Errors',
errorCount: errorsModel.errors.size,
- render: () =>
{
+ render: () => {
if (error.action)
setSelectedAction(error.action);
else
diff --git a/tests/playwright-test/playwright.connect.spec.ts b/tests/playwright-test/playwright.connect.spec.ts
index 34575c0ced..7039b2a128 100644
--- a/tests/playwright-test/playwright.connect.spec.ts
+++ b/tests/playwright-test/playwright.connect.spec.ts
@@ -167,7 +167,7 @@ test('should print debug log when failed to connect', async ({ runInlineTest })
expect(result.exitCode).toBe(1);
expect(result.failed).toBe(1);
expect(result.output).toContain('b-debug-log-string');
- expect(result.results[0].attachments).toEqual([expect.objectContaining({ name: 'error-context-0' })]);
+ expect(result.results[0].attachments).toEqual([]);
});
test('should record trace', async ({ runInlineTest }) => {
@@ -223,7 +223,6 @@ test('should record trace', async ({ runInlineTest }) => {
'After Hooks',
'Fixture "page"',
'Fixture "context"',
- 'Attach "error-context-0"',
'Worker Cleanup',
'Fixture "browser"',
]);
diff --git a/tests/playwright-test/playwright.spec.ts b/tests/playwright-test/playwright.spec.ts
index c9e2481c9a..520fcfb7f1 100644
--- a/tests/playwright-test/playwright.spec.ts
+++ b/tests/playwright-test/playwright.spec.ts
@@ -516,7 +516,7 @@ test('should work with video: on-first-retry', async ({ runInlineTest }) => {
const videoFailRetry = fs.readdirSync(dirRetry).find(file => file.endsWith('webm'));
expect(videoFailRetry).toBeTruthy();
- const errorPrompt = expect.objectContaining({ name: 'error-context-0' });
+ const errorPrompt = expect.objectContaining({ name: 'error-context' });
expect(result.report.suites[0].specs[1].tests[0].results[0].attachments).toEqual([errorPrompt]);
expect(result.report.suites[0].specs[1].tests[0].results[1].attachments).toEqual([{
name: 'video',
diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.ts
index c65a8c8907..47598cf9d0 100644
--- a/tests/playwright-test/playwright.trace.spec.ts
+++ b/tests/playwright-test/playwright.trace.spec.ts
@@ -127,7 +127,6 @@ test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
' Fixture "page"',
' Fixture "context"',
' Fixture "request"',
- 'Attach "error-context-0"',
'Worker Cleanup',
' Fixture "browser"',
]);
@@ -992,6 +991,7 @@ test('should record nested steps, even after timeout', async ({ runInlineTest },
' Expect "barPage teardown"',
' Step "step in barPage teardown"',
' Close context',
+ 'Attach "error-context"',
'Worker Cleanup',
' Fixture "browser"',
]);
@@ -1188,7 +1188,6 @@ test('should not corrupt actions when no library trace is present', async ({ run
'After Hooks',
' Fixture "foo"',
' Expect "toBe"',
- 'Attach "error-context-0"',
'Worker Cleanup',
]);
});
@@ -1219,7 +1218,6 @@ test('should record trace for manually created context in a failed test', async
'Set content',
'Expect "toBe"',
'After Hooks',
- 'Attach "error-context-0"',
'Worker Cleanup',
' Fixture "browser"',
]);
diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.ts
index 1a37a6f3ca..ee701969d9 100644
--- a/tests/playwright-test/reporter-html.spec.ts
+++ b/tests/playwright-test/reporter-html.spec.ts
@@ -2874,7 +2874,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
await expect(page.locator('.tree-item', { hasText: 'stdout' })).toHaveCount(1);
});
- test('should include diff in AI prompt', async ({ runInlineTest, writeFiles, showReport, page }) => {
+ test.fixme('should include diff in AI prompt', async ({ runInlineTest, writeFiles, showReport, page }) => {
const files = {
'uncommitted.txt': `uncommitted file`,
'playwright.config.ts': `export default {}`,
@@ -2919,22 +2919,6 @@ for (const useIntermediateMergeReport of [true, false] as const) {
expect(prompt, 'contains diff').toContain(`+ expect(2).toBe(3);`);
});
- test('should not show prompt for empty timeout error', async ({ runInlineTest, showReport, page }) => {
- const result = await runInlineTest({
- 'example.spec.ts': `
- import { test, expect } from '@playwright/test';
- test('sample', async ({ page }) => {
- test.setTimeout(2000);
- await page.setChecked('input', true);
- });
- `,
- }, { reporter: 'dot,html' }, { PLAYWRIGHT_HTML_OPEN: 'never' });
- expect(result.exitCode).toBe(1);
- await showReport();
- await page.getByRole('link', { name: 'sample' }).click();
- await expect(page.getByRole('button', { name: 'Copy prompt' })).toHaveCount(1);
- });
-
test('should include snapshot when page wasnt closed', async ({ runInlineTest, showReport, page }) => {
const result = await runInlineTest({
'example.spec.ts': `
diff --git a/tests/playwright-test/reporter-line.spec.ts b/tests/playwright-test/reporter-line.spec.ts
index 1d7ff8b078..6bb45340fd 100644
--- a/tests/playwright-test/reporter-line.spec.ts
+++ b/tests/playwright-test/reporter-line.spec.ts
@@ -15,7 +15,6 @@
*/
import path from 'path';
-import fs from 'fs';
import { test, expect } from './playwright-test-fixtures';
for (const useIntermediateMergeReport of [false, true] as const) {
@@ -195,7 +194,8 @@ for (const useIntermediateMergeReport of [false, true] as const) {
const result = await runInlineTest({
'a.test.js': `
const { test, expect } = require('@playwright/test');
- test('one', async ({}) => {
+ test('one', async ({ page }) => {
+ await page.setContent('hello
');
expect(1).toBe(0);
});
`,
@@ -207,26 +207,5 @@ for (const useIntermediateMergeReport of [false, true] as const) {
expect(text).toContain(`Error Context: ${path.join('test-results', 'a-one', 'error-context.md')}`);
expect(result.exitCode).toBe(1);
});
-
- test('should show error context if exception contains non-existent file', async ({ runInlineTest, useIntermediateMergeReport }) => {
- const result = await runInlineTest({
- 'a.test.js': `
- const { test, expect } = require('@playwright/test');
- test('one', async ({ page }) => {
- await page.evaluate(() => {
- throw new Error('error');
- });
- });
- `,
- }, { reporter: 'line' });
- if (useIntermediateMergeReport)
- expect(result.output).toContain(`Error Context: ${path.join('blob-report', 'resources')}`);
- else
- expect(result.output).toContain(`Error Context: ${path.join('test-results', 'a-one', 'error-context.md')}`);
- const file = /Error Context: (.*)/.exec(result.output)?.[1];
- const content = await fs.promises.readFile(path.join(result.report.config.rootDir, file), 'utf8');
- expect(content).toContain('^ Error: page.evaluate: Error: error');
- expect(result.exitCode).toBe(1);
- });
});
}
diff --git a/tests/playwright-test/ui-mode-trace.spec.ts b/tests/playwright-test/ui-mode-trace.spec.ts
index abf82ccf64..0daec1b51e 100644
--- a/tests/playwright-test/ui-mode-trace.spec.ts
+++ b/tests/playwright-test/ui-mode-trace.spec.ts
@@ -73,7 +73,7 @@ test('should merge web assertion events', async ({ runUITest }, testInfo) => {
]);
});
-test('should merge screenshot assertions', async ({ runUITest }, testInfo) => {
+test('should merge screenshot assertions', async ({ runUITest }) => {
const { page } = await runUITest({
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -95,6 +95,7 @@ test('should merge screenshot assertions', async ({ runUITest }, testInfo) => {
/Set content/,
/Expect "toHaveScreenshot"[\d.]+m?s/,
/After Hooks[\d.]+m?s/,
+ /Attach "error-context"/,
/Worker Cleanup[\d.]+m?s/,
]);
});
@@ -554,7 +555,7 @@ test('skipped steps should have an indicator', async ({ runUITest }) => {
await expect(skippedMarker).toHaveAccessibleName('skipped');
});
-test('should show copy prompt button in errors tab', async ({ runUITest }) => {
+test.fixme('should show copy prompt button in errors tab', async ({ runUITest }) => {
const { page } = await runUITest({
'a.spec.ts': `
import { test, expect } from '@playwright/test';