Skip to content
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

Test passed even though assertion failure occurs #8876

Closed
quad5 opened this issue Oct 17, 2020 · 3 comments
Closed

Test passed even though assertion failure occurs #8876

quad5 opened this issue Oct 17, 2020 · 3 comments
Labels
type: duplicate This issue or pull request already exists

Comments

@quad5
Copy link

quad5 commented Oct 17, 2020

Current behavior

I am writing my test similar to this route2 example, and cy.visit follows it. I noticed that there is an assertion failure, but how come Cypress consider test as passed (see screenshot)?

cy.route2('POST', '/organization', (req) => {
expect(req.body).to.include('Acme Company')
})

image

I see this error message in browser's console:

Uncaught exception from application, continuing. CypressError: The following error originated from your test code, not from Cypress.

A request callback passed to cy.route2() threw an error while intercepting a request:
expected {} to deeply equal { Object (action_type, floating, ...) }
...
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Desired behavior

I would assume test fails when any assertion failure occurs.

Test code to reproduce

Versions

Cypress version: 5.4.0
Browser: Chrome version 86.0.4240.80
Mac OS: version 10.15.6

@Nxtra
Copy link

Nxtra commented Oct 17, 2020

On first sight, I don't know why this happens. Can you share the code so that we can reproduce it?

@jennifer-shehane
Copy link
Member

Could you please provide a full example of this throwing, but the test passing? Do you have any event listeners set up? https://on.cypress.io/catalog-of-events maybe that listen on fail of the test and handle it?

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Oct 19, 2020
@flotwig
Copy link
Contributor

flotwig commented Oct 19, 2020

Hey @quad5, this is a known issue with asynchronously thrown uncaught errors: #8802

Closing as duplicate.

@flotwig flotwig closed this as completed Oct 19, 2020
@flotwig flotwig added the type: duplicate This issue or pull request already exists label Oct 19, 2020
@jennifer-shehane jennifer-shehane removed the stage: needs information Not enough info to reproduce the issue label Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants