2

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.visit('https://bvt-riskassessment.lmkcloud.net')
        cy.get('span.mat-button-wrapper').contains('Log In').click()
        }
    )
})

1 Answer 1

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

cy.visit('https://bvt-riskassessment.lmkcloud.net')

with

cy.visit(Cypress.env("riskApp"))

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 that you have read and understand our privacy policy and code of conduct.

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