Skip to content

Commit bea53ae

Browse files
author
“Rajat
committed
#17: ⚙️ CI - Workflows added (GitHub Actions)
1 parent 46ec0d4 commit bea53ae

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

.github/workflows/01_api_tests.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This GitHub Actions workflow is designed to execute API tests developed using Playwright and Javascript on various events
2+
# such as manual trigger, push to the main/master branch, or pull requests to the main/master branch.
3+
4+
name: 01_Pre-defined env PROD
5+
6+
on:
7+
# Manual Trigger with pre-defined environment PROD
8+
workflow_dispatch:
9+
10+
# Trigger on push to the main or master branch
11+
push:
12+
branches: [ main, master ]
13+
14+
# Trigger on pull request to the main or master branch
15+
pull_request:
16+
branches: [ main, master ]
17+
18+
jobs:
19+
# Job for running Playwright tests
20+
api_tests:
21+
22+
# Set a maximum timeout for the job
23+
timeout-minutes: 30
24+
25+
# Define the machine on which tests will execute
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
# Step 1: Checking out the code from the GitHub repository to the machine (ubuntu-latest)
30+
- name: Checkout code
31+
uses: actions/checkout@v3
32+
33+
# Step 2: Installing Node.js
34+
- name: Install Node.js
35+
uses: actions/setup-node@v3
36+
with:
37+
node-version: 20
38+
39+
# Step 3: Install project dependencies
40+
- name: Install dependencies
41+
run: npm ci
42+
43+
# Step 4: Run Playwright API tests in PROD environment
44+
- name: Run Playwright API tests in PROD environment
45+
run: npm run tests:PROD
46+
47+
# Step 5: Upload Playwright test report as an artifact
48+
- name: Upload Reports
49+
uses: actions/upload-artifact@v3
50+
if: always()
51+
with:
52+
name: API Tests Report
53+
path: playwright-report/
54+
retention-days: 30
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This GitHub Actions workflow is designed to execute API tests developed using Playwright and Javascript.
2+
# It supports manual trigger and handles inputs for environment selection.
3+
4+
name: 02_Select Environment at run-time
5+
6+
on:
7+
# Manual Trigger with environment selection input
8+
workflow_dispatch:
9+
inputs:
10+
environment:
11+
description: 'Select environment (DEV | PRE-PROD | PROD)'
12+
options:
13+
- 'DEV'
14+
- 'PRE-PROD'
15+
- 'PROD'
16+
required: true
17+
default: 'PROD'
18+
type: choice
19+
20+
jobs:
21+
22+
# Job for running Playwright tests
23+
api_tests_env_selected:
24+
25+
# Set a maximum timeout for the job
26+
timeout-minutes: 30
27+
28+
# Define the machine on which tests will execute
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
# Step 1: Checking out the code from the GitHub repository to the machine (ubuntu-latest)
33+
- name: Checkout code
34+
uses: actions/checkout@v3
35+
36+
# Step 2: Installing Node.js
37+
- name: Install Node.js
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: 20
41+
42+
# Step 3: Install project dependencies
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
# Step 4: Run Playwright API tests on selected environment
47+
- name: Run Playwright API tests on selected environment
48+
run: npm run tests:${{ github.event.inputs.environment }}
49+
50+
# Step 5: Upload Playwright test report as an artifact
51+
- name: Upload Reports
52+
uses: actions/upload-artifact@v3
53+
if: always()
54+
with:
55+
name: API Tests Report
56+
path: playwright-report/
57+
retention-days: 30

0 commit comments

Comments
 (0)