-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
114 lines (93 loc) · 3.03 KB
/
Jenkinsfile
File metadata and controls
114 lines (93 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
pipeline {
agent any
// Define triggers if needed - 9 AM every weekday
// triggers {
// cron('TZ=Asia/Kolkata\n0 9 * * 1-5')
// }
tools {
nodejs 'Nodejs' // Name configured in Jenkins → Global Tool Configuration
}
environment {
EMAIL_RECIPIENTS = 'laxminarayansamantaray2000@gmail.com,subhashreesamantaray1996@gmail.com'
}
stages {
stage('Checkout Code') {
steps {
checkout scm
}
}
stage('Install Dependencies') {
steps {
bat 'npm install'
}
}
stage('Install Playwright Browsers') {
steps {
bat 'npx playwright install'
}
}
stage('Run Playwright Tests') {
steps {
bat 'npx playwright test'
}
}
}
post {
always {
// Publish Playwright HTML report
publishHTML(target: [
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'playwright-report',
reportFiles: 'index.html',
reportName: 'Playwright HTML Report'
])
}
success {
emailext(
to: "${EMAIL_RECIPIENTS}",
subject: "BUILD SUCCESS : ${env.JOB_NAME} #${env.BUILD_NUMBER}",
mimeType: 'text/html',
body: """
<p>Hi Team,</p>
<p>The Playwright automation build has <b>SUCCESSFULLY completed</b>. ✅</p>
<p>
<b>Job:</b> ${env.JOB_NAME}<br/>
<b>Build Number:</b> ${env.BUILD_NUMBER}<br/>
<b>Build URL:</b> <a href="${env.BUILD_URL}">${env.BUILD_URL}</a>
</p>
<p>
👉 <a href="${env.BUILD_URL}Playwright_20HTML_20Report/">
Click here to view Playwright HTML Report
</a>
</p>
<p>Regards,<br/>Jenkins CI</p>
"""
)
}
failure {
emailext(
to: "${EMAIL_RECIPIENTS}",
subject: "BUILD FAILURE : ${env.JOB_NAME} #${env.BUILD_NUMBER}",
mimeType: 'text/html',
body: """
<p>Hi Team,</p>
<p>The Playwright automation build has <b>FAILED</b>. ❌</p>
<p>
<b>Job:</b> ${env.JOB_NAME}<br/>
<b>Build Number:</b> ${env.BUILD_NUMBER}<br/>
<b>Build URL:</b> <a href="${env.BUILD_URL}">${env.BUILD_URL}</a>
</p>
<p>
👉 <a href="${env.BUILD_URL}Playwright_20HTML_20Report/">
Click here to view Playwright HTML Report
</a>
</p>
<p>Please review failed tests and logs.</p>
<p>Regards,<br/>Jenkins CI</p>
"""
)
}
}
}