pipeline {
agent any
environment {
envName = 'Sachi'
}
parameters {
string(name: 'Name', defaultValue: "Sachin")
choice(name: 'Browser', choices: ['chromium', 'firefox', 'webkit', 'MicrosoftEdge', 'GoogleChrome'])
choice(name: 'Scripts', choices: ['ID-01', 'ID-02', 'ID-03', '@regression', '@sanity'])
booleanParam(name: 'Headed', defaultValue: true)
booleanParam(name: 'Debug', defaultValue: false)
}
stages {
stage('Checkout Code') {
steps {
git branch: 'master', url: 'https://github.com/your-org/your-repo.git'
}
}
stage('build') {
steps {
echo 'Installing node modules'
bat 'npm install'
}
}
stage('tests') {
steps {
echo 'Running tests...'
script {
def headedFlag = params.Headed ? '--headed' : ''
def debugFlag = params.Debug ? '--debug' : ''
bat "npx playwright test --project=%Browser% ${headedFlag} --grep %Scripts% ${debugFlag}"
}
}
}
}
post {
success {
echo 'Job Success'
}
failure {
echo 'Job Failure'
}
always {
echo 'Job Finished'
}
}
}