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: hanging on basic auth requests in chromium browsers #27781

Merged
merged 3 commits into from
Sep 11, 2023

Conversation

ryanthemanuel
Copy link
Collaborator

@ryanthemanuel ryanthemanuel commented Sep 11, 2023

Additional details

Fixes a regression in 13.0.0 where tests using Basic Authorization can sometimes hang indefinitely on chromium browsers. This is caused because our assets are loaded twice when we have basic auth set on the base url. It is unclear why this is happening, but this has been happening since at least 12.0.0 it just didn't cause a problem until we started relying on a top level local variable for a cache of CDP sockets. The fix for this is to set the cache on window instead. This is not ideal, and we should investigate why this behavior is happening, but it is worth getting a fix out there for now so that we don't hang in this scenario.

Steps to test

The new system test tests this scenario.

How has the user experience changed?

Tests will no longer hang

PR Tasks

@cypress
Copy link

cypress bot commented Sep 11, 2023

6 flaky tests on run #50923 ↗︎

0 5570 97 0 Flakiness 6

Details:

add comments
Project: cypress Commit: 27b44ed1a6
Status: Passed Duration: 14:52 💡
Started: Sep 11, 2023 4:31 PM Ended: Sep 11, 2023 4:46 PM
Flakiness  cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron

View Output Video

Test Artifacts
... > correctly returns currentRetry Test Replay Output
... > correctly returns currentRetry Test Replay Output
... > correctly returns currentRetry Test Replay Output
Flakiness  project-setup.cy.ts • 1 flaky test • launchpad-e2e

View Output Video

Test Artifacts
... > skips the setup page when choosing e2e tests to run Test Replay Output Screenshots
Flakiness  scaffold-component-testing.cy.ts • 2 flaky tests • launchpad-e2e

View Output Video

Test Artifacts
scaffolding component testing > vuecli4vue3 > scaffolds component testing for Vue CLI 4 w/ Vue 3 project Test Replay Output Screenshots
scaffolding component testing > create-react-app > scaffolds component testing for Create React App v5 project Test Replay Output Screenshots

Review all test suite changes for PR #27781 ↗︎

Comment on lines 7 to 13
declare global {
interface Window {
cypressSockets: {[key: string]: CDPBrowserSocket}
}
}

window.cypressSockets ||= {}
Copy link
Member

Choose a reason for hiding this comment

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

why do you need to add sockets to window for this fix? Is it for testing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added some doc to explain this a little better: 27b44ed (#27781)

}

return sockets[fullNamespace]
window.cypressSockets[fullNamespace].connect()
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 connect do that we weren't doing before and why does it fix the hang?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added some doc to explain this a little better: 27b44ed (#27781)

@ryanthemanuel ryanthemanuel merged commit a1161c9 into develop Sep 11, 2023
6 checks passed
@ryanthemanuel ryanthemanuel deleted the ryanm/fix/hanging-on-basic-auth branch September 11, 2023 17:23
@nagash77 nagash77 linked an issue Sep 12, 2023 that may be closed by this pull request
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 12, 2023

Released in 13.2.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.2.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basic auth in baseUrl not working since v13
3 participants