@@ -20,75 +20,49 @@ jobs:
2020 # Define the steps to execute in this job
2121 steps :
2222 # Step to checkout the source code from the repository
23- - name : Checkout code
24- uses : actions/checkout@v2
23+ - name : Checkout code
24+ uses : actions/checkout@v2
25+
26+ # Step to install msmtp
27+ - name : Install msmtp
28+ run : sudo apt update && sudo apt install -y msmtp
2529
2630 # Step to set up the Node.js version
27- - name : Install node js v20
28- uses : actions/setup-node@v2
29- with :
30- node-version : ' 20'
31+ - name : Install node js v20
32+ uses : actions/setup-node@v2
33+ with :
34+ node-version : ' 20'
3135
3236 # Step to install Node.js dependencies
33- - name : Install dependencies
34- run : npm ci
37+ - name : Install dependencies
38+ run : npm ci
3539
3640 # Step to install Chrome browser for Playwright
37- - name : Install Chrome browser for Playwright
38- run : npx playwright install chrome
41+ - name : Install Chrome browser for Playwright
42+ run : npx playwright install chrome
3943
4044 # Step to run tests with qa as environment variable similarly we can define qa|dev|qaApi|devApi
41- - name : Run tests
42- run : npm run test:serial
43- env :
44- npm_config_ENV : " qa"
45+ - name : Run tests
46+ run : npm run test:serial
47+ env :
48+ npm_config_ENV : " qa"
4549
4650 # Step to wait for the job to complete
47- - name : Wait for job completion
48- run : sleep 60s # Adjust the wait time as needed
49- # This step should always run, even if previous steps fail
50- if : always()
51+ - name : Wait for job completion
52+ run : sleep 30s # Adjust the wait time as needed
53+ # This step should always run, even if previous steps fail
54+ if : always()
5155
5256 # Step to zip html-report folder
53- - name : Zip HTML report
54- run : zip -r html-report.zip html-report
55- # This step should always run, even if previous steps fail
56- if : always()
57+ - name : Zip HTML report
58+ run : zip -r html-report.zip html-report
59+ # This step should always run, even if previous steps fail
60+ if : always()
5761
58- # Step to send email with the zip report using SendGrid API
59- - name : Send email with zip report
60- run : |
61- curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \
62- -H 'Authorization: Bearer YOUR_SENDGRID_API_KEY' \
63- -H 'Content-Type: application/json' \
64- -d $'{
65- "personalizations": [
66- {
67- "to": [
68- {
69- "email": "recipient@example.com"
70- }
71- ],
72- "subject": "Playwright Test Report"
73- }
74- ],
75- "from": {
76- "email": "sender@example.com"
77- },
78- "content": [
79- {
80- "type": "text/plain",
81- "value": "This is the body of the email."
82- }
83- ],
84- "attachments": [
85- {
86- "content": "'"$(base64 html-report.zip)"'",
87- "filename": "html-report.zip",
88- "type": "application/zip",
89- "disposition": "attachment"
90- }
91- ]
92- }'
93- # This step should only run if the previous steps were successful
94- if : success()
62+ # Step to send email with the zip report using msmtp
63+ - name : Send email with zip report
64+ run : |
65+ echo "Sending email with zip report"
66+ echo -e "Subject: Playwright Test Report\n\nThis is the body of the email" | msmtp -a default codendeavor@gmail.com
67+ # This step should only run if the previous steps were successful
68+ if : success()
0 commit comments