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

Proposal: insert fixes for basic errors right from the Test Runner #4367

Open
bahmutov opened this issue Jun 3, 2019 · 2 comments
Open

Proposal: insert fixes for basic errors right from the Test Runner #4367

bahmutov opened this issue Jun 3, 2019 · 2 comments
Labels
stage: proposal 💡 No work has been done of this issue type: feature New feature that does not currently exist type: user experience Improvements needed for UX

Comments

@bahmutov
Copy link
Contributor

bahmutov commented Jun 3, 2019

Background

I have shown Cypress Test Runner at a company where my friend works, and then had to wait in their office for an hour until the end of the work day. While sitting at one of the desks, I have noticed a person next to me writing a Cypress test - trying it out on their website. He is a front end developer, who loved the demo and immediately wanted to replace a few existing tests.

Their site polyfills fetch which caused Cypress test to crash due to XMLHttpRequest property missing (when we try to wrap it for XHR stubbing). I saw his reaction - he clicked on the link in the error message https://on.cypress.io/uncaught-exception-from-application which took him to this doc

Screen Shot 2019-06-03 at 10 55 10 AM

He did NOT follow the link. I was next to him so I jumped into the situation, clicking on the link and explaining to him what happens. The first event on the page shows the workaround

Screen Shot 2019-06-03 at 10 56 02 AM

Without me there observing it, he would be blocked. After we added the workaround, he wrote several tests, absolutely happy as a clam

Proposal

We know the spec, we know the place with cy.visit, we show the specific error message. We could add a button to the error message with something like "Add workaround". When the user clicks it, we can add our handler to the spec file.

Cypress.on('uncaught:exception', (err, runnable) => {
  // returning false here prevents Cypress from
  // failing the test due to uncaught exceptions from the production code
  return false
})

We could even target the handler by only handling that specific error

The purpose is not to create a universal solution, but to avoid people being blocked 100% when they try writing their first "hello Cypress" test. We could probably insert typical solution for

  • uncaught exception from the website under test
  • chrome security: false
  • ignore missing content type or non-200 response from the server

Related

I think this work can only happen after the in progress error improvements land (issue #3762, pull request #3930)

@bahmutov bahmutov changed the title Proposal: insert fixes for basic errors when user clicks on a button in the error Proposal: insert fixes for basic errors right from the Test Runner Jun 3, 2019
@cypress-bot cypress-bot bot added the stage: proposal 💡 No work has been done of this issue label Jun 4, 2019
@jennifer-shehane jennifer-shehane added type: feature New feature that does not currently exist external: documentation type: user experience Improvements needed for UX labels Jun 4, 2019
@mccataldo
Copy link

@bahmutov I think this error also could apply:

CypressError: Invalid alias: 'someAlias'.
You forgot the '@'. It should be written as: '@someAlias'

@bahmutov
Copy link
Contributor Author

bahmutov commented Jun 26, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: proposal 💡 No work has been done of this issue type: feature New feature that does not currently exist type: user experience Improvements needed for UX
Projects
None yet
Development

No branches or pull requests

3 participants