Skip to content

Comments

fix(uimode): show trace failure and any error messages on missing trace#35344

Merged
agg23 merged 6 commits intomicrosoft:mainfrom
agg23:ui-mode-missing-trace-error
Apr 3, 2025
Merged

fix(uimode): show trace failure and any error messages on missing trace#35344
agg23 merged 6 commits intomicrosoft:mainfrom
agg23:ui-mode-missing-trace-error

Conversation

@agg23
Copy link
Contributor

@agg23 agg23 commented Mar 25, 2025

If UI Mode ever could not fetch a trace, whether it was not generated or something else went wrong, it would not indicate to the user what happened. With this change, a specific error message is added to the UI if we cannot find a trace after the test has stopped running. Any error messages we can extract from the test tree are also displayed.

Discovered by #35152.

Screenshot 2025-03-25 at 6 26 56 AM

@agg23 agg23 requested a review from pavelfeldman March 25, 2025 13:35

await page.getByTestId('test-tree').getByText('basic fail').dblclick();
await expect(page.getByRole('tabpanel', { name: 'Actions' })).toContainText('Failed');
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone knows how to test the failure case, I'd love to know. It either requires blocking the fetch request or blocking the trace from being written/read.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Test results for "tests 1"

7 flaky ⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-output.spec.ts:80:5 › should show console messages for test @macos-latest-node18-1
⚠️ [chromium-library] › tests/library/client-certificates.spec.ts:400:3 › browser › should not hang on tls errors during TLS 1.2 handshake @ubuntu-22.04-chromium-tip-of-tree
⚠️ [chromium-library] › tests/library/inspector/cli-codegen-python-async.spec.ts:147:5 › should work with --save-har @ubuntu-22.04-chromium-tip-of-tree
⚠️ [playwright-test] › tests/ui-mode-trace.spec.ts:341:5 › should work behind reverse proxy @ubuntu-latest-node20-1
⚠️ [webkit-library] › tests/library/video.spec.ts:441:5 › screencast › should work for popups @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18

38844 passed, 809 skipped
✔️✔️✔️

Merge workflow run.

@pavelfeldman
Copy link
Member

This is a normal behavior for the live mode, we start with empty / malformed zip and over time populate it. I would not want error to flicker for the user.

@github-actions

This comment has been minimized.

setModel(undefined);
setTrace({ type: 'success', model, isLive: true });
} catch (e) {
const errors = result.errors.flatMap(error => !!error.message ? [error.message] : []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I wonder why something like this instead of this change does not work:

const errors = result.errors.flatMap(error => !!error.message ? [error.message] : []);
const modelWithErrors = new MultiTraceModel([]);
modelWithErrors.errorDescriptors.push(...errors.map(message => ({ message })));
setModel({ model: modelWithErrors, isLive: false });

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the PR to have that form. By doing so, you lose:

  1. Expressiveness in having a discriminated union enumerate possible states (no data vs we have data (live or not) vs we have failed to get data).
  2. model stability in the error case; it will create a new error model every 500ms and React will do a full rerender of the child tree.
  3. A more complete failure error message next to the actions (which you probably didn't like anyway).

@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2025

Test results for "tests 1"

1 failed
❌ [webkit-library] › tests/library/browsercontext-pages.spec.ts:82:3 › should click the button with offset with page scale @webkit-ubuntu-22.04-node18

4 flaky ⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:424:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [chromium-library] › tests/library/video.spec.ts:379:5 › screencast › should capture navigation @ubuntu-22.04-chromium-tip-of-tree
⚠️ [webkit-library] › tests/library/browsercontext-pages.spec.ts:105:3 › should return bounding box with page scale @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

39019 passed, 805 skipped
✔️✔️✔️

Merge workflow run.

@agg23 agg23 merged commit 26b9441 into microsoft:main Apr 3, 2025
29 checks passed
whazor pushed a commit to whazor/playwright-trace-viewer-plus that referenced this pull request Jan 10, 2026
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.

2 participants