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

Clarify test config section #3200

Closed
bahmutov opened this issue Sep 30, 2020 · 1 comment · Fixed by #3209
Closed

Clarify test config section #3200

bahmutov opened this issue Sep 30, 2020 · 1 comment · Fixed by #3209

Comments

@bahmutov
Copy link
Contributor

Seems from comments in cypress-io/cypress#5346 (comment) a user can be confused by which config parameters filter tests vs modify the config. We should make the section clearer https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests.html#Test-Configuration

@paleite
Copy link

paleite commented Nov 6, 2020

Ran into the same issue as that user.
It seems the interface can be confusing because, on one hand, it queries ("is it running in the correct browser?"), on the other hand, it performs an action ("set this environment variable to this value").

Furthermore, the type is called Cypress.TestConfigOverrides, but setting {browser: "chrome"} will not override which browser should be used for the test.

Having super clear interfaces is one of the big selling-points which got me into Cypress in the first place, and I'd love to see this happening with this interface as well, for the greater good of Cypress' community.

One possible way to go forward is to break the object down further or introducing a new parameter where you explicitly define which parts are overrides and which parts are preconditions. To illustrate:

  it(
    "testname",
    {
      overrides: {
        env: {
          myproperty: "myvalue",
        },
      },
      precondition: {
        browser: "!chrome",
      },
    },
    () => {
      /* test */
    }
  );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants