Skip to content

Cypress

Joakim Storløkken Melseth edited this page Oct 11, 2022 · 3 revisions

Specifying applicable backend versions for Cypress tests

The default is to run a test against all backend versions. You can restrict the backend versions a test will run against by adding a tag in the Cucumber file above the test feature.

Only run a test against a specific version: @v[version] (e.g. @v39)
Run a test against all versions greater or equal to: @v>=[version] (e.g. @v>=39)
Run a test against all versions smaller or equal to: @v<=[version] (e.g. @v<=39)

(@v>39 and @v<39 will also work)

A test can have multiple tags (e.g. @v38 @v40)

Run Cypress tests locally

Create a .env.cypress.local file in the root of the project with the following contents:

CYPRESS_dhis2Username=system
CYPRESS_dhis2Password=System123
CYPRESS_dhis2UsernameEnglish=englishB
CYPRESS_dhis2PasswordEnglish=!English123B
CYPRESS_dhis2BaseUrl=[YOUR_URL]
CYPRESS_dhis2InstanceVersion=[YOUR_VERSION]

Replace [YOUR_URL] with the URL to the instance, for example https://test.e2e.dhis2.org/ca-test-dev

Replace [YOUR_VERSION] with the instance version, for example 2.40

Run yarn cy:open or yarn cy:run