#23: 🚀 Optimizations #8
This file contains hidden or 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
# This GitHub Actions workflow is designed to execute API tests developed using Playwright and Javascript on various events | |
# such as manual trigger, push to the main/master branch, or pull requests to the main/master branch. | |
name: 01_Pre-defined env PROD | |
on: | |
# Manual Trigger with pre-defined environment PROD | |
workflow_dispatch: | |
# Trigger on push to the main or master branch | |
push: | |
branches: [ main, master ] | |
# Trigger on pull request to the main or master branch | |
pull_request: | |
branches: [ main, master ] | |
jobs: | |
# Job for running Playwright tests | |
api_tests: | |
# Set a maximum timeout for the job | |
timeout-minutes: 30 | |
# Define the machine on which tests will execute | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checking out the code from the GitHub repository to the machine (ubuntu-latest) | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Installing Node.js | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
# Step 3: Install project dependencies | |
- name: Install dependencies | |
run: npm ci | |
# Step 4: Run Playwright API tests in PROD environment | |
- name: Run Playwright API tests in PROD environment | |
run: npm run tests:PROD | |
# Step 5: Upload Playwright test report as an artifact | |
- name: Upload Reports | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: API Tests Report | |
path: playwright-report/ | |
retention-days: 30 |