-
Notifications
You must be signed in to change notification settings - Fork 4.2k
chore: move Copy Prompt rendering to UI #36089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"4 failed 7 flaky39248 passed, 808 skipped Merge workflow run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this PR is too large to be reviewed effectively. Could you please split it up?
@@ -4,8 +4,12 @@ | |||
"version": "0.0.0", | |||
"scripts": {}, | |||
"dependencies": { | |||
"@babel/code-frame": "^7.27.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we are brining babel into our web properties. How large is this one? Does it run in the browser?
"version": "7.26.2", | ||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", | ||
"integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", | ||
"version": "7.27.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we stick with the old version we already had to avoid unnecessary deps churn?
@@ -223,7 +223,6 @@ test('should record trace', async ({ runInlineTest }) => { | |||
'After Hooks', | |||
'Fixture "page"', | |||
'Fixture "context"', | |||
'Attach "error-context-0"', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened here?
@@ -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"', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am missing where all the changes to the steps are coming from.
@@ -358,9 +358,6 @@ test('should report parallelIndex', async ({ runInlineTest }, testInfo) => { | |||
|
|||
test('attaches error context', async ({ runInlineTest }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this test brings any value. Why is it in reporter-json
of all things?
metadata, | ||
errorContextContent, | ||
async file => { | ||
const response = await fetch('trace/file?' + new URLSearchParams({ path: `${rootDir}/${file}` })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer that html report does not know about rootDir
or anything filesystem-related. Can we instead fetch sources while building the report, and include them explicitly? This way, you can also open the report from anywhere at any time, and things will work.
</CodeSnippet> | ||
); | ||
}> = ({ error, testId }) => { | ||
return <CodeSnippet code={error} testId={testId}/>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need this component now? Even better, inline CodeSnippet
here?
const otherAttachments = new Set<TestAttachment>(attachments); | ||
[...screenshots, ...videos, ...traces].forEach(a => otherAttachments.delete(a)); | ||
if (errorContext) | ||
otherAttachments.delete(errorContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to hide the error-context
from the list of attachments I can download? Why do that?
}, [result]); | ||
|
||
const prompt = useAsyncMemo( | ||
async () => { | ||
const errorContextContent = errorContext?.path ? await fetch(errorContext.path).then(r => r.text()) : errorContext?.body; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this using fetch()
instead of LoadedReport.entry()
?
@@ -56,7 +57,8 @@ export const Workbench: React.FunctionComponent<{ | |||
inert?: boolean, | |||
onOpenExternally?: (location: modelUtil.SourceLocation) => void, | |||
revealSource?: boolean, | |||
}> = ({ model, showSourcesFirst, rootDir, fallbackLocation, isLive, hideTimeline, status, annotations, inert, onOpenExternally, revealSource }) => { | |||
metadata?: MetadataWithCommitInfo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this testRunMetadata
to differentiate from "Metadata" tab in the trace viewer.
Splitting it up! |
Trims down the
error-context
attachment to the actual context bit, which is only the page snapshot. All other parts are dropped.The error context can be rendered into a "Copy Prompt" prompt with the
copyPrompt
function. This now lives inpackages/web
and is shared by Trace Viewer and HTML report.Here's how we change behaviour:
# Test source
section when opened on remote server anymore, because we don't attach the sources and it can only get it via the local server# Test Info
sectionThe VS Code extension can take the
error-context
attachment and blindly tack it onto the error message.