I need to include in my test scenarios a way to determine which environment they are being executed in. We have BVT (build verification test) and a UAT (user Acceptance Test) environments. Within our solution we have environment.ts files for each of our environments and I have access to the files:

  • environment.bvt.ts
  • environment.uat.ts
  • environment.ts

My question is:

  • How do I alter my test so that when it runs in a particular environment (through a Bamboo CI build)

Example of my login test is below

describe('Environment', function (){
    it('Environment selection', function (){
        cy.get('span.mat-button-wrapper').contains('Log In').click()

1 Answer 1


My colleague and I have worked out how to do this.

I had to create a Cypress.env.json which contains a property and value that I want to use. Then in my test I replace the




Then in the bamboo build process we can specify which environment to call by using something along the lines of:

cypress run --env host=kevin.dev.local,api_server=http://localhost:8888/api/v1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.