In my random.test.ts
file I am utilizing an environment variable:
test.beforeAll(async () => {
new testBase.BaseTest(page).login(process.env.EMAIL, process.env.PASSWORD);
})
I want to execute my tests using Jenkins, but I am unsure of how to pass my locally defined env variables to the Dockerfile
. Here is what it currently looks like:
pipeline {
agent {
docker {
image 'mcr.microsoft.com/playwright:v1.17.2-focal'
}
stages {
stage('install playwright') {
steps {
sh '''
npm i -D @playwright/test
npx playwright install
'''
}
}
stage('test') {
steps {
sh '''
npx playwright test
'''
}
}
}
}
I attempted to add it to the Dockerfile as an environment,
}
environment {
EMAIL = 'random'
}
but I'm uncertain about how to update the random.test.ts
file. Does anyone have any suggestions? Thank you!