Skip to content

Conversation

@agg23
Copy link
Contributor

@agg23 agg23 commented Apr 17, 2025

Display a simple error message when the user navigates to an invalid URL (for example, reloading between report generations).

Screenshot 2025-04-17 at 11 07 14 AM

@agg23 agg23 requested a review from pavelfeldman April 17, 2025 18:08
@github-actions

This comment has been minimized.

width: 100%;
}

.error {
Copy link
Member

Choose a reason for hiding this comment

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

global style with the name like this would be a bad idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

CSS Modules would solve it - so it would not conflict with other components. Afaik a common best-practise nowadays and built-in in Vite. Maybe a good time to try?

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'd love to move to CSS modules. I assumed in this case that the global error would be correct for its use.

{!!report && <TestCaseViewLoader report={report} tests={filteredTests.tests} testIdToFileIdMap={testIdToFileIdMap} />}
{!!report ?
<TestCaseViewLoader report={report} tests={filteredTests.tests} testIdToFileIdMap={testIdToFileIdMap} /> :
<div className='error'>Report data could not be found</div>}
Copy link
Member

Choose a reason for hiding this comment

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

What does this mean? What do I do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A fatal error occurred with loading the report and there's likely no recovery. The best thing the user can do is reload. We currently show a blank screen if this happens.

Copy link
Member

Choose a reason for hiding this comment

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

How is Report data could not be found better than blank screen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generally it is better to communicate to the user that something broke, rather than doing nothing. Technically a blank screen implicitly communicates something broke, but it's still a poor experience.

Any place where an error can occur but is not handled (generally explicitly) is a bug. This is no different. I agree that the error message could be better though.

type: 'test',
test: TestCase,
} | {
type: 'error',
Copy link
Member

Choose a reason for hiding this comment

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

That would not be a very useful state. How about a placeholder that suggests possible recovery when the report is empty?

}> = ({ report, testIdToFileIdMap, tests }) => {
const searchParams = React.useContext(SearchParamsContext);
const [test, setTest] = React.useState<TestCase | undefined>();
const [test, setTest] = React.useState<TestState>({ type: 'loading' });
Copy link
Member

Choose a reason for hiding this comment

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

It is immediately harder to read. Let's keep things more direct. We used to have a test: TestCase, understand that. We can handle undefined test case, we can detect if the test is not the the map and handle that. Where is the state coming from?

@pavelfeldman
Copy link
Member

Is there an issue? I'd like to take a stab at it, but I'd like to know how I can repro / test it.

@agg23
Copy link
Contributor Author

agg23 commented Apr 18, 2025

No issue.

I don't have a repro for the no report case; not sure if/when this could occur. Would require a malformed base64 string/zip.

Repro for the test information is simple. Change the testId query param in some way (but don't remove it) and reload the page.

@github-actions
Copy link
Contributor

Test results for "tests 1"

12 failed
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › merged › should not collate identical file names in different project directories @macos-latest-node18-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › created › should not collate identical file names in different project directories @macos-latest-node18-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › merged › should not collate identical file names in different project directories @ubuntu-latest-node18-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › created › should not collate identical file names in different project directories @ubuntu-latest-node18-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › merged › should not collate identical file names in different project directories @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › created › should not collate identical file names in different project directories @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › merged › should not collate identical file names in different project directories @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › created › should not collate identical file names in different project directories @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:2937:5 › created › should show error if test ID not found @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › merged › should not collate identical file names in different project directories @windows-latest-node18-2
❌ [playwright-test] › reporter-html.spec.ts:2937:5 › merged › should show error if test ID not found @windows-latest-node18-2
❌ [playwright-test] › reporter-html.spec.ts:2811:5 › created › should not collate identical file names in different project directories @windows-latest-node18-2

4 flaky ⚠️ [firefox-page] › page/page-evaluate.spec.ts:424:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [webkit-page] › page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › page/page-screenshot.spec.ts:433:5 › page screenshot › should take fullPage screenshots during navigation @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

39045 passed, 799 skipped
✔️✔️✔️

Merge workflow run.

Copy link
Member

@pavelfeldman pavelfeldman left a comment

Choose a reason for hiding this comment

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

This touches a bunch of code all over the place. I'll land my change instead.

@agg23 agg23 closed this Apr 22, 2025
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.

3 participants