Skip to content

ChangedGithubActions #46

ChangedGithubActions

ChangedGithubActions #46

Workflow file for this run

# Name of the GitHub Actions workflow
name: Playwright Github Actions
# Define when to trigger this workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
# Define the jobs to run in this workflow
jobs:
# Define a job named 'build'
build:
# Specify the operating system for this job
runs-on: ubuntu-latest
# 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
# Step to set up the Node.js version
- 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
# Step to install Chrome browser for Playwright
- 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"
# 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()
# 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()
# Step to send email with the zip report
- name: Send email with zip report
run: |
echo "Sending email with zip report"
echo "This is the body of the email" | mutt -s "Subject: Playwright Test Report" -a html-report.zip codendeavor@gmail.com
# This step should only run if the previous steps were successful
if: success()