mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-22 06:59:30 -06:00
fix: do not override existingSession setup (#21226)
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
This commit is contained in:
25
packages/driver/cypress/integration/issues/17805_spec.js
Normal file
25
packages/driver/cypress/integration/issues/17805_spec.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// @see https://github.com/cypress-io/cypress/issues/17805
|
||||
describe('issue 17805', { experimentalSessionAndOrigin: true }, () => {
|
||||
it('recreates session on spec reload in open mode', () => {
|
||||
let validateFlag = false
|
||||
|
||||
cy.session('persist_session', () => {
|
||||
validateFlag = true
|
||||
},
|
||||
{
|
||||
validate () {
|
||||
if (validateFlag) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
after(() => {
|
||||
if (cy.$$('.commands-container li.command:first', top.document).text().includes('(new)')) {
|
||||
top.location.reload()
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -209,7 +209,7 @@ export default function (Commands, Cypress, cy) {
|
||||
* 1) if we only need currentOrigin localStorage, access sync
|
||||
* 2) if cross-origin http, we need to load in iframe from our proxy that will intercept all http reqs at /__cypress/automation/*
|
||||
* and postMessage() the localStorage value to us
|
||||
* 3) if cross-origin https, since we pass-thru https conntections in the proxy, we need to
|
||||
* 3) if cross-origin https, since we pass-thru https connections in the proxy, we need to
|
||||
* send a message telling our proxy server to intercept the next req to the https domain,
|
||||
* then follow 2)
|
||||
*/
|
||||
@@ -638,7 +638,7 @@ export default function (Commands, Cypress, cy) {
|
||||
|
||||
// we have a saved session on the server AND setup matches
|
||||
if (serverStoredSession && serverStoredSession.setup === existingSession.setup.toString()) {
|
||||
_.extend(existingSession, serverStoredSession)
|
||||
_.extend(existingSession, _.omit(serverStoredSession, 'setup'))
|
||||
existingSession.hydrated = true
|
||||
} else {
|
||||
onValidationError = throwValidationError
|
||||
|
||||
Reference in New Issue
Block a user