Skip to content
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

bug(trace-viewer): update trace file on trace viewer when test completes #498

Merged

Conversation

ruifigueira
Copy link
Contributor

@pavelfeldman
Copy link
Member

I don't think the error that you see in console is related to the behavior that you are changing. What's the idea behind this change, could you verbalize it?

@ruifigueira
Copy link
Contributor Author

ruifigueira commented Jun 14, 2024

This change updates the trace displayed in the trace viewer when a test in a multiple test run completes (basically, it replaces the live json trace file, which is being polled during live mode, with the final zip trace file). Otherwise, VSCode TraceViewer instance doesn't send the new trace file to _traceViewerProcess, which will continue to send loadTraceRequested messages via websocket to the traceviewer webapp with the old json trace path.

In my tests, it fixed the issue.

@ruifigueira
Copy link
Contributor Author

BTW, the reason why it works with one single test running and fails with more than one is because enqueuedSingleTest is true and so it calls the showTrace:

https://github.com/microsoft/playwright-vscode/blob/main/src/extension.ts#L486-L487

The check I added there is just to ensure that the trace viewer is showing the trace for the right test item. If they are the same, the trace viewer must be displaying the old trace value that is now being updated.

src/extension.ts Show resolved Hide resolved
src/traceViewer.ts Outdated Show resolved Hide resolved
@pavelfeldman
Copy link
Member

pavelfeldman commented Jun 14, 2024

Otherwise, VSCode TraceViewer instance doesn't send the new trace file to _traceViewerProcess, which will continue to send loadTraceRequested messages via websocket to the traceviewer webapp with the old json trace path

That's normal behavior for the case of live traces - we race with the trace provider here, so it is Ok for the files to not be there. I understand that you are removing a case where update is hammering against the missing file, but the JSON error will still be happening in other cases. I'd suggest that you change the title of the PR to reflect the actual change.

@ruifigueira ruifigueira changed the title bug(trace-viewer): fix error on live trace viewer from vscode bug(trace-viewer): update trace file on trace viewer when test completes Jun 14, 2024
- replace getter with function
- add comment to explain how to decide to refresh trace viewer or not when a test completes
@pavelfeldman pavelfeldman merged commit 0fe1ef9 into microsoft:main Jun 27, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Trace Viewer in VSCode is not updated after multiple tests complete
2 participants