``` if (config.env.testenv) { return { ...
# help
a
Copy code
if (config.env.testenv) {
        return {
          config: property
        }
} else return {
  default config
}
r
Thank you so much . I am now trying that approach
a
To answer your main question, you understand the concept that you'll need to set different run scripts for each environment?
You set those in your
package.json
r
i have little confusion about that
a
are you using
yarn
as your package manager?
r
npm
"You may find it easier to add the cypress command to the scripts object in your package.json file and call it from an npm run script."
r
ow i see. i get it now.
a
In our setup, we have a few scripts called
run:env1
and
run:evn2
... etc. Then we also have
open:env1
and
open:env2
... etc.
The
run:env
scripts execute in CI (can be run locally also) and we use
open:env
for working with the test runner. For example the
run
scripts all have the
--headless
flag.
r
yes thank you for you support.
a
@rhythmic-fall-53545 I wrote up a summary in a blog post that might be helpful. https://dev.to/samelawrence/how-to-test-in-multiple-environments-in-cypress-10-1i9h
r
You guys are really great. I appreciate your effort. Many people are facing this issue and I hope this is very helpful for them.
2 Views