-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Improve flaky draft creation navigation block e2e test #37931
Conversation
Size Change: 0 B Total Size: 1.13 MB ℹ️ View Unchanged
|
expect( console ).toHaveErroredWith( | ||
'Failed to load resource: the server responded with a status of 404 (Not Found)' | ||
); | ||
expect( console ).toHaveErrored(); |
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.
Or if we want to be extra clear about the error we're expecting we could do a substring match. Probably not worth it though. toHaveErrored
is probably good enough.
expect( console ).toHaveErrored(); | |
expect( console ).toHaveErroredWith( | |
expect.stringContaining( 'Failed to load resource' | |
)); |
@talldan Looking at the failure artifacts it seems that the Otherwise why would the preview exist? That would likely mean the endpoint didn't return 404 and thus your test will fail. Why that happens is another question... Testing this flow manually the rich preview response is a 404: |
I think it has to be returning a 404, otherwise the test would fail earlier at the The inconsistency seems to be in the console logging. It might be that there's sometimes a small delay in console logging. I wonder if moving this expect to the end of the test would improve things. |
I discovered some issues with the
I've also moved the |
Re-running the tests to make sure it's not flaky!
|
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.
This looks to have solved the problem. Let's 🤞 🤞 🤞 🤞 🤞 there are no other weird quirks to this one.
Thanks again @talldan for persisting and finding a good solution.
Description
Fixes #37479.
I don't really understand the error message output by this test:
It seems to indicate that the console mock function is still called, but it has no message. It's unusual, but if this is the case the test can probably use
expect( console ).toHaveErrored()
instead ofexpect( console ).toHaveErroredWith()
.