Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

How to include/exclude a test based of custom value #102

Open
mellis481 opened this issue Sep 30, 2020 · 1 comment
Open

How to include/exclude a test based of custom value #102

mellis481 opened this issue Sep 30, 2020 · 1 comment

Comments

@mellis481
Copy link

There seems to be a finite list of values that can be passed in to skipOn and onlyOn (eg. 'localhost', 'mac', etc.) which don't seem to be documented anywhere. I also see in the docs that you can use the CYPRESS_ENVIRONMENT value too. I'm looking to be able to use a custom value/expression from my cypress.json file. Eg.

{
  "env": {
    "includedTests": "platform"
  }
}

Is there a way to do something like this:

skipOn(Cypress.env.includedTests === 'platform')
@csvan
Copy link

csvan commented Dec 11, 2020

onlyOn support a boolean argument so you can use it for the inverse case:

cy.onlyOn(Cypress.env.includedTests !== 'platform')

See https://github.com/cypress-io/cypress-skip-test#boolean-flag

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

No branches or pull requests

2 participants