mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-01 20:39:57 -05:00
fix: sync currentRetry state with secondary origin (#28651)
This commit is contained in:
+2
-1
@@ -5,10 +5,11 @@ _Released 1/16/2024 (PENDING)_
|
||||
|
||||
**Bugfixes:**
|
||||
|
||||
- Now 'node_modules' will not be ignored if a project path or a provided path to spec files contains it. Fixes [#23616](https://github.com/cypress-io/cypress/issues/23616).
|
||||
- Now `node_modules` will not be ignored if a project path or a provided path to spec files contains it. Fixes [#23616](https://github.com/cypress-io/cypress/issues/23616).
|
||||
- Updated display of assertions and commands with a URL argument to escape markdown formatting so that values are displayed as is and assertion values display as bold. Fixes [#24960](https://github.com/cypress-io/cypress/issues/24960) and [#28100](https://github.com/cypress-io/cypress/issues/28100).
|
||||
- When generating assertions via Cypress Studio, the preview of the generated assertions now correctly displays the past tense of 'expected' instead of 'expect'. Fixed in [#28593](https://github.com/cypress-io/cypress/pull/28593).
|
||||
- Fixed a regression in [`13.6.2`](https://docs.cypress.io/guides/references/changelog/13.6.2) where the `body` element was not highlighted correctly in Test Replay. Fixed in [#28627](https://github.com/cypress-io/cypress/pull/28627).
|
||||
- Correctly sync `Cypress.currentRetry` with secondary origin so test retries that leverage `cy.origin()` render logs as expected. Fixes [#28574](https://github.com/cypress-io/cypress/issues/28574).
|
||||
- Fixed an issue where some cross-origin logs, like assertions or cy.clock(), were getting too many dom snapshots. Fixes [#28609](https://github.com/cypress-io/cypress/issues/28609).
|
||||
- Fixed asset capture for Test Replay for requests that are routed through service workers. This addresses an issue where styles were not being applied properly in Test Replay and `cy.intercept` was not working properly for requests in this scenario. Fixes [#28516](https://github.com/cypress-io/cypress/issues/28516).
|
||||
- Fixed an issue where visiting an `http://` site would result in an infinite reload/redirect loop in Chrome 114+. Fixes [#25891](https://github.com/cypress-io/cypress/issues/25891).
|
||||
|
||||
@@ -154,57 +154,66 @@ describe('cy.origin', { browser: '!webkit' }, () => {
|
||||
cy.log('after cy.origin')
|
||||
})
|
||||
|
||||
it('passes runnable state to the secondary origin', () => {
|
||||
const runnable = cy.state('runnable')
|
||||
const expectedRunnable = {
|
||||
clearTimeout: null,
|
||||
isPending: null,
|
||||
resetTimeout: null,
|
||||
timeout: null,
|
||||
id: runnable.id,
|
||||
_currentRetry: runnable._currentRetry,
|
||||
_timeout: 4000,
|
||||
type: 'test',
|
||||
title: 'passes runnable state to the secondary origin',
|
||||
titlePath: [
|
||||
'cy.origin',
|
||||
'withBeforeEach',
|
||||
'passes runnable state to the secondary origin',
|
||||
],
|
||||
parent: {
|
||||
id: runnable.parent.id,
|
||||
type: 'suite',
|
||||
title: 'withBeforeEach',
|
||||
;[{
|
||||
title: 'first attempt',
|
||||
retries: 0,
|
||||
}, {
|
||||
title: 'on retry',
|
||||
retries: 1,
|
||||
}].forEach(({ title, retries }) => {
|
||||
it(`passes runnable state to the secondary origin ${title}`, { retries }, () => {
|
||||
const runnable = cy.state('runnable')
|
||||
const expectedRunnable = {
|
||||
clearTimeout: null,
|
||||
isPending: null,
|
||||
resetTimeout: null,
|
||||
timeout: null,
|
||||
id: runnable.id,
|
||||
_currentRetry: retries,
|
||||
_timeout: 4000,
|
||||
type: 'test',
|
||||
title: `passes runnable state to the secondary origin ${title}`,
|
||||
titlePath: [
|
||||
'cy.origin',
|
||||
'withBeforeEach',
|
||||
`passes runnable state to the secondary origin ${title}`,
|
||||
],
|
||||
parent: {
|
||||
id: runnable.parent.parent.id,
|
||||
id: runnable.parent.id,
|
||||
type: 'suite',
|
||||
title: '',
|
||||
titlePath: undefined,
|
||||
title: 'withBeforeEach',
|
||||
titlePath: [
|
||||
'withBeforeEach',
|
||||
],
|
||||
parent: {
|
||||
id: runnable.parent.parent.id,
|
||||
type: 'suite',
|
||||
title: '',
|
||||
titlePath: undefined,
|
||||
ctx: {},
|
||||
},
|
||||
ctx: {},
|
||||
},
|
||||
ctx: {},
|
||||
},
|
||||
ctx: {},
|
||||
}
|
||||
}
|
||||
|
||||
cy.origin('http://www.foobar.com:3500', { args: expectedRunnable }, (expectedRunnable) => {
|
||||
const actualRunnable = cy.state('runnable')
|
||||
cy.origin('http://www.foobar.com:3500', { args: expectedRunnable }, (expectedRunnable) => {
|
||||
const actualRunnable = cy.state('runnable')
|
||||
|
||||
expect(actualRunnable.titlePath()).to.deep.equal(expectedRunnable.titlePath)
|
||||
expectedRunnable.titlePath = actualRunnable.titlePath
|
||||
expect(actualRunnable.titlePath()).to.deep.equal(expectedRunnable.titlePath)
|
||||
expectedRunnable.titlePath = actualRunnable.titlePath
|
||||
|
||||
expect(actualRunnable.title).to.equal(expectedRunnable.title)
|
||||
expect(actualRunnable.id).to.equal(expectedRunnable.id)
|
||||
expect(actualRunnable.ctx).to.deep.equal(expectedRunnable.ctx)
|
||||
expect(actualRunnable._timeout).to.equal(expectedRunnable._timeout)
|
||||
expect(actualRunnable.type).to.equal(expectedRunnable.type)
|
||||
expect(actualRunnable.callback).to.exist
|
||||
expect(actualRunnable.timeout).to.exist
|
||||
expect(actualRunnable.parent.title).to.equal(expectedRunnable.parent.title)
|
||||
expect(actualRunnable.parent.type).to.equal(expectedRunnable.parent.type)
|
||||
expect(actualRunnable.title).to.equal(expectedRunnable.title)
|
||||
expect(actualRunnable.id).to.equal(expectedRunnable.id)
|
||||
expect(actualRunnable.ctx).to.deep.equal(expectedRunnable.ctx)
|
||||
expect(actualRunnable._currentRetry).to.equal(expectedRunnable._currentRetry)
|
||||
expect(actualRunnable._timeout).to.equal(expectedRunnable._timeout)
|
||||
expect(actualRunnable.type).to.equal(expectedRunnable.type)
|
||||
expect(actualRunnable.callback).to.exist
|
||||
expect(actualRunnable.timeout).to.exist
|
||||
expect(actualRunnable.parent.title).to.equal(expectedRunnable.parent.title)
|
||||
expect(actualRunnable.parent.type).to.equal(expectedRunnable.parent.type)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ interface serializedRunnable {
|
||||
title: string
|
||||
parent: serializedRunnable
|
||||
ctx: {}
|
||||
_currentRetry: number
|
||||
_timeout: number
|
||||
titlePath: string
|
||||
}
|
||||
@@ -44,6 +45,7 @@ const rehydrateRunnable = (data: serializedRunnable): Runnable|Test => {
|
||||
|
||||
runnable.ctx = data.ctx
|
||||
runnable.id = data.id
|
||||
runnable._currentRetry = data._currentRetry
|
||||
runnable._timeout = data._timeout
|
||||
// Short circuit title path to avoid implementing it up the parent chain.
|
||||
runnable.titlePath = () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import _ from 'lodash'
|
||||
export const serializeRunnable = (runnable) => {
|
||||
if (!runnable) return undefined
|
||||
|
||||
const fields = _.pick(runnable, ['id', 'type', 'title', 'parent', 'ctx', 'titlePath', '_timeout'])
|
||||
const fields = _.pick(runnable, ['id', 'type', 'title', 'parent', 'ctx', 'titlePath', '_currentRetry', '_timeout'])
|
||||
|
||||
fields.ctx = _.pick(runnable.ctx, ['currentTest.id', 'currentTest._currentRetry', 'currentTest.type', 'currentTest.title'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user