Skip to content

Using Secrets

Chris Millar edited this page Oct 18, 2022 · 3 revisions

There are times you need to run a test using a secret. Similar to a branch, this can be done using environment variables.

You can set these variables either manually, or in your shell profile: .zprofile / .profile / etc..

They can also be stored easily in your github project's secrets screen.

IMS User

export IMS_EMAIL="[email protected]"

export IMS_PASS="Just4mE!!"

export IMS_NAME="Penny Sue"

Note: the above is not a real user or password.

Once defined, you can use these values in your test:

page.locator(selectors['@email']).fill(process.env.IMS_EMAIL);

It is recommended to write your test in a way that can detect the presence of your variables and not run if they are not present.

Clone this wiki locally