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
By using cy.dataSession in the 'before' hook, I should be able to access the data in all test cases of the spec.
Description
If a user wants to use a data session to create one set o data valid throughout the test, it should run only once, and not twice eg if the test retries, and it should be usable between test cases in the same spec. However, when we set the code, it's actually only valid for the first test case, and not for the rest.
Reproductible example:
context('Data Session tests', { tags: ['@customized'] }, () => {
before(() =>
cy.dataSession({
name: 'dataSessionTest',
setup: () => cy.wrap({ data: 'test' }).then(data => data),
validate: true,
})
)
it('test 1 - can read data generated at Data Session', function () {
const { data } = this.dataSessionTest
expect(data).to.equal('test')
})
it('test 2 - should still read data generated at Data Session', function () {
const { data } = this.dataSessionTest
expect(data).to.equal('test')
})
})
Expected Results
Both tests will pass because they have the same assertions and access the same data from the hook
Actual Result
The second test will fail because it can't access the data generated anymore.
The text was updated successfully, but these errors were encountered:
By using cy.dataSession in the 'before' hook, I should be able to access the data in all test cases of the spec.
Description
If a user wants to use a data session to create one set o data valid throughout the test, it should run only once, and not twice eg if the test retries, and it should be usable between test cases in the same spec. However, when we set the code, it's actually only valid for the first test case, and not for the rest.
Reproductible example:
Expected Results
Both tests will pass because they have the same assertions and access the same data from the hook
Actual Result
The second test will fail because it can't access the data generated anymore.
![image](https://user-images.githubusercontent.com/39180176/180313198-53e50406-a468-4ce5-bc3d-c3d475986c86.png)
The text was updated successfully, but these errors were encountered: