Skip to content

Commit

Permalink
ChangedGithubActions
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayp7 committed Feb 24, 2024
1 parent e8206a6 commit d4355cd
Showing 1 changed file with 33 additions and 59 deletions.
92 changes: 33 additions & 59 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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": "recipient@example.com"
}
],
"subject": "Playwright Test Report"
}
],
"from": {
"email": "sender@example.com"
},
"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 codendeavor@gmail.com
# This step should only run if the previous steps were successful
if: success()

0 comments on commit d4355cd

Please sign in to comment.