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

feat: show better error message if testing type is not configured #22000

Conversation

estrada9166
Copy link
Member

@estrada9166 estrada9166 commented Jun 1, 2022

User facing changelog

Additional details

When a testing type is selected in run mode, and it has not been configured (e2e or component property) in the config file, we are showing a better error message, letting know the user that it needs to be configured before running it

The testing type selected (component) is not configured in your config file.

Please run ‘cypress open’ and choose your testing type to automatically update your configuration file.

https://on.cypress.io/configuration

If the selected testing type is e2e the config file needs to have at least e2e: {} but if the selected testing type is component it needs to have configured the devServer

It is checked based on this logic

Steps to test

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 1, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Jun 1, 2022



Test summary

37553 0 454 0Flakiness 5


Run details

Project cypress
Status Passed
Commit dcc70c0
Started Jun 7, 2022 5:28 PM
Ended Jun 7, 2022 5:44 PM
Duration 15:50 💡
OS Linux Debian - 10.11
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

commands/actions/click.cy.js Flakiness
1 ... > scroll-behavior > can scroll to and click elements in html with scroll-behavior: smooth
next.cy.ts Flakiness
1 Working with next-12 > should detect new spec
e2e/origin/commands/actions.cy.ts Flakiness
1 cy.origin actions > #consoleProps > .selectFile()
cypress/proxy-logging.cy.ts Flakiness
1 Proxy Logging > request logging > xhr log has response body/status code when xhr response is logged second
nuxt.cy.ts Flakiness
1 Working with nuxtjs2 > should mount a passing test and live-reload

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@estrada9166 estrada9166 marked this pull request as ready for review June 6, 2022 22:16
@estrada9166 estrada9166 requested review from a team and tgriesser as code owners June 6, 2022 22:16
@estrada9166 estrada9166 requested review from jennifer-shehane, a team, tbiethman and lmiller1990 and removed request for a team, tgriesser and jennifer-shehane June 6, 2022 22:16
return errTemplate`
The testing type selected (${fmt.highlight(testingType)}) is not configured in your config file.

Please update it, and try running it again.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want to direct users to the configuration docs here? https://on.cypress.io/configuration

We do so for other errors, like INVALID_CONFIG_OPTION.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this would be good to add also.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/errors/src/errors.ts Outdated Show resolved Hide resolved
estrada9166 and others added 5 commits June 6, 2022 17:35
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
…-is-not-configured' of github.com:cypress-io/cypress into alejandro/feat/show-better-error-message-if-testingType-is-not-configured
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a test and it's working as expected.

cd packges/driver

yarn cypress:run --component

yarn run v1.22.11

$ node ../../scripts/cypress run --spec "cypress/e2e/*/*","cypress/e2e/*/!(origin|sessions)/**/*" --component

The testing type selected (component) is not configured in your config file.

Please run ‘cypress open’ and choose your testing type to automatically update your configuration file.

https://on.cypress.io/configuration

error Command failed with exit code 1.

@jennifer-shehane jennifer-shehane dismissed their stale review June 7, 2022 20:46

Dismissing my previous review.

@estrada9166 estrada9166 merged commit e5c1f91 into develop Jun 7, 2022
@estrada9166 estrada9166 deleted the alejandro/feat/show-better-error-message-if-testingType-is-not-configured branch June 7, 2022 20:47
BeijiYang pushed a commit to BeijiYang/cypress that referenced this pull request Jun 23, 2022
…press-io#22000)

* feat: show better error message if testing type is not configured

* Add tests

* Update tests

* Fix some tests

* Fix some tests

* Fix test

* Fix tests

* Update packages/errors/src/errors.ts

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>

* Update with code review

* Fix test

* Add on link

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show a better error message during cypress run when CT/E2E has not been configured.
4 participants