From 4cb2431c33d2a5e96f26f99abfdf9fe933808cde Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Wed, 28 May 2025 15:10:24 +0200 Subject: [PATCH] chore: trim error context and make it singular (#36117) --- packages/html-reporter/src/testErrorView.tsx | 23 +-- packages/html-reporter/src/testFilesView.tsx | 4 +- packages/html-reporter/src/testResultView.tsx | 21 ++- packages/playwright/src/errorContext.ts | 158 ------------------ packages/playwright/src/index.ts | 20 ++- packages/playwright/src/reporters/base.ts | 2 +- packages/trace-viewer/src/ui/errorsTab.tsx | 25 +-- packages/trace-viewer/src/ui/modelUtil.ts | 2 - packages/trace-viewer/src/ui/workbench.tsx | 2 +- .../playwright.connect.spec.ts | 3 +- tests/playwright-test/playwright.spec.ts | 2 +- .../playwright-test/playwright.trace.spec.ts | 4 +- tests/playwright-test/reporter-html.spec.ts | 18 +- tests/playwright-test/reporter-line.spec.ts | 25 +-- tests/playwright-test/ui-mode-trace.spec.ts | 5 +- 15 files changed, 60 insertions(+), 254 deletions(-) delete mode 100644 packages/playwright/src/errorContext.ts diff --git a/packages/html-reporter/src/testErrorView.tsx b/packages/html-reporter/src/testErrorView.tsx index d7a979a9d9..751a263263 100644 --- a/packages/html-reporter/src/testErrorView.tsx +++ b/packages/html-reporter/src/testErrorView.tsx @@ -22,22 +22,6 @@ import { ImageDiffView } from '@web/shared/imageDiffView'; import { TestAttachment } from './types'; import { fixTestInstructions } from '@web/prompts'; -export const TestErrorView: React.FC<{ - error: string; - testId?: string; - context?: TestAttachment; -}> = ({ error, testId, context }) => { - return ( - - {context && ( -
- -
- )} -
- ); -}; - export const CodeSnippet = ({ code, children, testId }: React.PropsWithChildren<{ code: string; testId?: string; }>) => { const html = React.useMemo(() => ansiErrorToHtml(code), [code]); return ( @@ -48,14 +32,15 @@ export const CodeSnippet = ({ code, children, testId }: React.PropsWithChildren< ); }; -const PromptButton: React.FC<{ context: TestAttachment }> = ({ context }) => { +export const PromptButton: React.FC<{ context?: TestAttachment }> = ({ context }) => { const [copied, setCopied] = React.useState(false); return