-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on XHR stub if resonse json only contains a number or boolean #4899
Comments
Any update on this? |
I can verify this behavior. This is a bug. This error only occurs when you use the
26
it('accepts a number in cy.fixture', () => {
cy.server()
cy.fixture('num.json').as('number')
cy.visit('https://example.cypress.io/commands/files')
cy.route('GET', 'comments/*', '@number').as('getNumber')
cy.get('.fixture-btn').click()
cy.wait('@getNumber').its('responseBody')
.should('eq', 26) // passes
});
it('fails when a number in fixture:', () => {
cy.server()
cy.visit('https://example.cypress.io/commands/files')
cy.route('GET', 'comments/*', 'fixture:num.json').as('getNumber')
cy.get('.fixture-btn').click() // fails after click
cy.wait('@getNumber').its('responseBody')
.should('eq', 26)
}); This error used to look slightly different: in 3.0.0 for example. Cause / FixThis is being thrown from this line of code:
@sainthkh added a fix for if the JSON file is WorkaroundSwitch to using |
PR on the way @jennifer-shehane |
The code for this is done in cypress-io/cypress#9107, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
When a
fixture.json
ONLY contains a number or a boolean, cypress throws the following error:Desired behavior:
For Cypress to accept fixtures that contain a number or a boolean only.
Steps to reproduce: (app code and test code)
Fixtures:
content of my-number.json:
26
content of my-bool.json:
Tests:
repo: https://github.com/amberjs/cypress-test-tiny
Versions
Cypress 3.2.0 - 3.4.1
Chrome
The text was updated successfully, but these errors were encountered: