-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Labels
existing workaroundprevent-stalemark an issue so it is ignored by stale[bot]mark an issue so it is ignored by stale[bot]stage: ready for workThe issue is reproducible and in scopeThe issue is reproducible and in scopetopic: fixturesFixture loading and usageFixture loading and usagetype: bugtype: unexpected behaviorUser expected result, but got anotherUser expected result, but got another
Description
Current behavior:
Reading and writing fixtures seems to not work as expected (please let me know if this is my error). Across two different tests (within the same spec) the returned value from cy.fixture
is outdated and should have been updated by a previous call to cy.writeFile
. This looks to me like a caching issue?
Desired behavior:
It should always return the latest data from the fixture and not something outdated.
Steps to reproduce: (app code and test code)
- Create a empty spec and paste the below code.
- Run the spec and see the output in the dashboard.
describe('fixture', () => {
it('step 1', () => {
// Create the fixture first
cy.writeFile("cypress/fixtures/test-temp.json", {
id: 1,
name: 'Step 1'
});
// Let's see the data, it should be fine
cy.fixture("test-temp").then(data => cy.log(data));
// Update the fixture again
cy.writeFile("cypress/fixtures/test-temp.json", {
id: 1,
name: 'Step 2'
});
});
it('step 2', () => {
// Let's wait 5 seconds just to be sure
cy.wait(5000);
// The returned data is { id: 1, name: 'Step 1' }
// Should be { id: 1, name: 'Step 2' }
cy.fixture("test-temp").then(data => cy.log(data));
});
});
Versions
Cypress 3.4.0 & 3.3.2
MacOS Mojave
Chrome 75
UPDATE: No need to create 2 different tests, it also happens inside the very same test.
WolfeLogic-LHR, ababbdev, iota-pi, mwren-mshanken, JamesD0C and 2 more
Metadata
Metadata
Assignees
Labels
existing workaroundprevent-stalemark an issue so it is ignored by stale[bot]mark an issue so it is ignored by stale[bot]stage: ready for workThe issue is reproducible and in scopeThe issue is reproducible and in scopetopic: fixturesFixture loading and usageFixture loading and usagetype: bugtype: unexpected behaviorUser expected result, but got anotherUser expected result, but got another