You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using recreate and restoring a shared session we need to make sure the original timestamps are used, otherwise the child session gets recomputed
spec cypress/integration/env-restore-shared.js
describe('Restores data session',()=>{beforeEach(()=>{Cypress.clearDataSession('parent')Cypress.clearDataSession('child')})it('sets the session in Cypress.env',function(){/** @type Cypress.DataSessionOptions */constparentOptions={name: 'parent',setup: cy.stub().as('parentSetup').returns(1),recreate: cy.stub().as('parentRecreate').returns(2),validate: true,shareAcrossSpecs: true,}/** @type Cypress.DataSessionOptions */constchildOptions={name: 'child',setup: cy.stub().as('childSetup').returns(1),validate: true,dependsOn: 'parent',}constkey=Cypress.formDataSessionKey('parent')cy.dataSession(parentOptions)cy.dataSession(childOptions).then(()=>{deleteCypress.env()[key]}).then(()=>{cy.dataSession(parentOptions)cy.dataSession(childOptions)})// both the parent and the child setup should be called just oncecy.get('@parentSetup').should('be.calledOnce')// the parent session should be restored in memory// with the original timestamps, thus the child session// should not be recomputed// cy.get('@childSetup').should('be.calledOnce')})})
The text was updated successfully, but these errors were encountered:
When using
recreate
and restoring a shared session we need to make sure the original timestamps are used, otherwise the child session gets recomputedspec cypress/integration/env-restore-shared.js
The text was updated successfully, but these errors were encountered: