-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,75 +20,49 @@ jobs: | |
# Define the steps to execute in this job | ||
steps: | ||
# Step to checkout the source code from the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# Step to install msmtp | ||
- name: Install msmtp | ||
run: sudo apt update && sudo apt install -y msmtp | ||
|
||
# Step to set up the Node.js version | ||
- name: Install node js v20 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
- name: Install node js v20 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
|
||
# Step to install Node.js dependencies | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
# Step to install Chrome browser for Playwright | ||
- name: Install Chrome browser for Playwright | ||
run: npx playwright install chrome | ||
- name: Install Chrome browser for Playwright | ||
run: npx playwright install chrome | ||
|
||
# Step to run tests with qa as environment variable similarly we can define qa|dev|qaApi|devApi | ||
- name: Run tests | ||
run: npm run test:serial | ||
env: | ||
npm_config_ENV: "qa" | ||
- name: Run tests | ||
run: npm run test:serial | ||
env: | ||
npm_config_ENV: "qa" | ||
|
||
# Step to wait for the job to complete | ||
- name: Wait for job completion | ||
run: sleep 60s # Adjust the wait time as needed | ||
# This step should always run, even if previous steps fail | ||
if: always() | ||
- name: Wait for job completion | ||
run: sleep 30s # Adjust the wait time as needed | ||
# This step should always run, even if previous steps fail | ||
if: always() | ||
|
||
# Step to zip html-report folder | ||
- name: Zip HTML report | ||
run: zip -r html-report.zip html-report | ||
# This step should always run, even if previous steps fail | ||
if: always() | ||
- name: Zip HTML report | ||
run: zip -r html-report.zip html-report | ||
# This step should always run, even if previous steps fail | ||
if: always() | ||
|
||
# Step to send email with the zip report using SendGrid API | ||
- name: Send email with zip report | ||
run: | | ||
curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \ | ||
-H 'Authorization: Bearer YOUR_SENDGRID_API_KEY' \ | ||
-H 'Content-Type: application/json' \ | ||
-d $'{ | ||
"personalizations": [ | ||
{ | ||
"to": [ | ||
{ | ||
"email": "[email protected]" | ||
} | ||
], | ||
"subject": "Playwright Test Report" | ||
} | ||
], | ||
"from": { | ||
"email": "[email protected]" | ||
}, | ||
"content": [ | ||
{ | ||
"type": "text/plain", | ||
"value": "This is the body of the email." | ||
} | ||
], | ||
"attachments": [ | ||
{ | ||
"content": "'"$(base64 html-report.zip)"'", | ||
"filename": "html-report.zip", | ||
"type": "application/zip", | ||
"disposition": "attachment" | ||
} | ||
] | ||
}' | ||
# This step should only run if the previous steps were successful | ||
if: success() | ||
# Step to send email with the zip report using msmtp | ||
- name: Send email with zip report | ||
run: | | ||
echo "Sending email with zip report" | ||
echo -e "Subject: Playwright Test Report\n\nThis is the body of the email" | msmtp -a default [email protected] | ||
# This step should only run if the previous steps were successful | ||
if: success() |