fix(uimode): show trace failure and any error messages on missing trace#35344
fix(uimode): show trace failure and any error messages on missing trace#35344agg23 merged 6 commits intomicrosoft:mainfrom
Conversation
|
|
||
| await page.getByTestId('test-tree').getByText('basic fail').dblclick(); | ||
| await expect(page.getByRole('tabpanel', { name: 'Actions' })).toContainText('Failed'); | ||
| }); |
There was a problem hiding this comment.
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.
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"7 flaky38844 passed, 809 skipped Merge workflow run. |
|
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. |
This comment has been minimized.
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] : []); |
There was a problem hiding this comment.
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 });There was a problem hiding this comment.
I have updated the PR to have that form. By doing so, you lose:
- 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).
modelstability in the error case; it will create a new error model every 500ms and React will do a full rerender of the child tree.- A more complete failure error message next to the actions (which you probably didn't like anyway).
Test results for "tests 1"1 failed 4 flaky39019 passed, 805 skipped Merge workflow run. |
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.