testcontainers-cypress icon indicating copy to clipboard operation
testcontainers-cypress copied to clipboard

Passing variables from the tests to cypress

Open xgp opened this issue 2 years ago • 2 comments

Is it possible to pass variables from the test to cypress (somehow get them into the Cypress.env() or otherwise)? There are a couple of things I will not know until runtime, but that my tests need to have. Thank you!

xgp avatar Dec 06 '22 10:12 xgp

I am also looking for such a feature, is there a way this can be achieved?

sthato avatar Mar 07 '23 06:03 sthato

cf. https://docs.cypress.io/guides/guides/environment-variables#Option-3-CYPRESS_

ex.

 new CypressContainer()
            .withEnv("CYPRESS_MY_VARIABLE", "SAMPLE TEXT") 
cy.log(Cypress.env('MY_VARIABLE'))

chrc avatar Nov 24 '23 09:11 chrc