File tree Expand file tree Collapse file tree 1 file changed +31
-11
lines changed Expand file tree Collapse file tree 1 file changed +31
-11
lines changed Original file line number Diff line number Diff line change 11pipeline {
22 agent any
3- environment {
4- NODE_HOME = tool name: 'nodejs-latest', type: 'NodeJSInstallation'
5- }
3+
4+ environment {
5+ NODE_HOME = tool name: 'nodejs', type: 'NodeJS'
6+ PATH = "${NODE_HOME}/bin:${env.PATH}"
7+ }
8+
69 stages {
710 stage('Checkout') {
811 steps {
9- git branch: 'main', url: 'https://github.com/BakkappaN/PlaywrightTypeScriptTutorialFullCourse.git'
12+ checkout scm
1013 }
1114 }
1215 stage('Install Dependencies') {
1316 steps {
1417 script {
15- // Use NodeJS tool configured in Jenkins
16- //env.PATH = "${NODE_HOME}/bin:${env.PATH}"
17- sh 'npm install -g' // Install dependencies from package.json
18- sh 'npx playwright install'
18+ // Ensure you use Node 16 or higher for Playwright
19+ sh 'npm ci'
1920 }
2021 }
2122 }
2223 stage('Run Playwright Tests') {
2324 steps {
2425 script {
25- // Run the Playwright tests
26- // sh 'npx playwright install'
27- sh 'npx playwright test --grep PlaywrightWithJenkins'
26+ // Run Playwright tests
27+ sh 'npx playwright test --grep PlaywrightWithJenkins' // You can specify browsers or configurations
2828 }
2929 }
3030 }
31+ stage('Cleanup') {
32+ steps {
33+ script {
34+ // Clean up if needed, like removing temp files
35+ }
36+ }
37+ }
38+ }
39+
40+ post {
41+ always {
42+ // Ensure Playwright is cleaned up after the tests, even if they fail
43+ cleanWs()
44+ }
45+ success {
46+ echo 'Tests passed successfully!'
47+ }
48+ failure {
49+ echo 'Tests failed!'
50+ }
3151 }
3252}
You can’t perform that action at this time.
0 commit comments