can you please show how to run a playwright test that takes some command line parameters like user name and password and run them on Jenkins using gradle
Hey there, To run Playwright tests with command line parameters and integrate them into Jenkins using Gradle, follow these condensed steps: Step 1: Modify Playwright Test for Environment Variables // Use environment variables for credentials in your Playwright test const username = process.env.USERNAME; const password = process.env.PASSWORD; Step 2: Set Up Gradle Task Add a task in build.gradle to run your Playwright test, using environment variables for any sensitive data. task runPlaywrightTest(type: Exec) { commandLine 'node', 'path/to/test.js' environment 'USERNAME', project.findProperty('username') ?: System.getenv('USERNAME') environment 'PASSWORD', project.findProperty('password') ?: System.getenv('PASSWORD') } Run it with: ./gradlew runPlaywrightTest -Pusername=user -Ppassword=pass Step 3: Configure Jenkins Freestyle Project: Add a "Invoke Gradle" build step with the runPlaywrightTest task. Pipeline: Use a Jenkinsfile to define stages, including setting environment variables and running the Gradle task. pipeline { agent any stages { stage('Test') { steps { sh './gradlew runPlaywrightTest -Pusername=${USERNAME} -Ppassword=${PASSWORD}' } } } }
can you please show how to run a playwright test which take some parameters passed to them , run them on Jenkins using gradle. Your help will be much appeciated
Hi there! Thanks for reaching out! We're actively looking into your query on running a Playwright test with command line parameters like username and password on Jenkins using Gradle. We'll get back to you soon with the details you need. Appreciate your patience!
github.com/ortoniKC/LambdaTest-Playwright-Java
can you please show how to run a playwright test that takes some command line parameters like user name and password and run them on Jenkins using gradle
Hey there,
To run Playwright tests with command line parameters and integrate them into Jenkins using Gradle, follow these condensed steps:
Step 1: Modify Playwright Test for Environment Variables
// Use environment variables for credentials in your Playwright test
const username = process.env.USERNAME;
const password = process.env.PASSWORD;
Step 2: Set Up Gradle Task
Add a task in build.gradle to run your Playwright test, using environment variables for any sensitive data.
task runPlaywrightTest(type: Exec) {
commandLine 'node', 'path/to/test.js'
environment 'USERNAME', project.findProperty('username') ?: System.getenv('USERNAME')
environment 'PASSWORD', project.findProperty('password') ?: System.getenv('PASSWORD')
}
Run it with:
./gradlew runPlaywrightTest -Pusername=user -Ppassword=pass
Step 3: Configure Jenkins
Freestyle Project: Add a "Invoke Gradle" build step with the runPlaywrightTest task.
Pipeline: Use a Jenkinsfile to define stages, including setting environment variables and running the Gradle task.
pipeline {
agent any
stages {
stage('Test') {
steps {
sh './gradlew runPlaywrightTest -Pusername=${USERNAME} -Ppassword=${PASSWORD}'
}
}
}
}
@@LambdaTest thank you so much.
Thank you. Please susbcribe the channel for more such videos🙂
can you please show how to run a playwright test which take some parameters passed to them , run them on Jenkins using gradle. Your help will be much appeciated
Hi there! Thanks for reaching out! We're actively looking into your query on running a Playwright test with command line parameters like username and password on Jenkins using Gradle. We'll get back to you soon with the details you need. Appreciate your patience!