Skip to content

fix: hanging on basic auth requests in chromium browsers - #27781

Merged
ryanthemanuel merged 3 commits into
developfrom
ryanm/fix/hanging-on-basic-auth
Sep 11, 2023
Merged

ryanthemanuel merged 3 commits into
developfrom
ryanm/fix/hanging-on-basic-auth

Conversation

@ryanthemanuel

@ryanthemanuel ryanthemanuel commented Sep 11, 2023 •

Copy link
Copy Markdown
Collaborator

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

cypress Bot commented Sep 11, 2023 •

Copy link
Copy Markdown

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 thread packages/socket/lib/browser.ts Outdated
Comment on lines +7 to +13
declare global {
interface Window {
cypressSockets: {[key: string]: CDPBrowserSocket}
}
}

window.cypressSockets ||= {}

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
@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

cypress-bot Bot commented Sep 12, 2023

Copy link
Copy Markdown
Contributor

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