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

Fix flaky auth test with console error "Failed to fetch" #3287

Merged
merged 16 commits into from
Mar 13, 2024

Conversation

apedroferreira
Copy link
Member

@apedroferreira apedroferreira commented Mar 11, 2024

Caused by a CSRF token request for auth that fails with "Failed to fetch", only happens in headless mode, probably because the requests there happen fast and previous pending auth requests end up making this one fail.
Waiting for network requests to complete seems to fix the issue.
In a real application this will probably never happen and even if it does it's just a console error.

@apedroferreira apedroferreira self-assigned this Mar 11, 2024
@@ -69,7 +69,7 @@
"format-util": "1.0.5",
"globby": "14.0.1",
"jsdom": "24.0.0",
"lerna": "8.1.2",
"lerna": "7.4.2",
Copy link
Member Author

Choose a reason for hiding this comment

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

Using lerna 7 until this gets fixed: lerna/lerna#3964

@apedroferreira apedroferreira marked this pull request as ready for review March 13, 2024 02:45
Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

ah that makes sense, great catch. suggestion: consider waiting for something in the page content if that works as well. It'd be a more user facing signal.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 13, 2024
@apedroferreira
Copy link
Member Author

apedroferreira commented Mar 13, 2024

ah that makes sense, great catch. suggestion: consider waiting for something in the page content if that works as well. It'd be a more user facing signal.

I tried as Playwright also doesn't recommend using this method, but the other options didn't work.

Edit: Ok looks like waiting for a page element also works, that way we don't use anything that Playwright discourages.

@apedroferreira apedroferreira changed the title Attempt to fix flaky auth test with console error "Failed to fetch" Fix flaky auth test with console error "Failed to fetch" Mar 13, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 13, 2024
@apedroferreira apedroferreira merged commit 602ec5d into mui:master Mar 13, 2024
12 checks passed
@apedroferreira apedroferreira deleted the flaky-test-fix branch March 13, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants