Skip to content

Automation Test Workflow execution in Prod for Backcountry #4

Automation Test Workflow execution in Prod for Backcountry

Automation Test Workflow execution in Prod for Backcountry #4

Workflow file for this run

name: Automation Test Workflow execution in Prod for Backcountry
on:
push:
branches: [main, develop]
# Allows the workflow to be manually triggered from the GitHub Actions UI with user-defined input parameters.
# The 'build_name' input is required, has a description for user guidance, and a default value of "Backcountry Prod Suite".
workflow_dispatch: # Allows manual triggering of the workflow
inputs:
build_name:
description: "Backcountry Prod Suite"
required: true
default: "Backcountry Prod Suite"
jobs:
test:
runs-on: ubuntu-latest
env:
LOCAL_IDENTIFIER: github-actions-tunnel
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
# Step 3: Install dependencies
- name: Install dependencies
run: npm ci
# Step 4: Install Playwright browsers
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: "BrowserStack Env Setup" # Invokes the setup-env action
uses: browserstack/[email protected]
with:
username: ${{ secrets.BROWSERSTACK_USERNAME }}
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
- name: "BrowserStack Local Tunnel Setup" # Invokes the setup-local action
uses: browserstack/github-actions/setup-local@master
with:
local-testing: start
local-logging-level: all-logs
local-identifier: ${{ env.LOCAL_IDENTIFIER }}
- name: Wait for tunnel
run: sleep 10
- name: 'Running a build'
run: npm run build --if-present
# Step 5: Run Playwright tests with Cucumber
- name: Run Playwright tests
#run: npx cucumber-js --tags "@BC_STAGE_01"
run: npm test
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
BROWSERSTACK_LOCAL: "true"
BROWSERSTACK_LOCAL_IDENTIFIER: ${{ env.LOCAL_IDENTIFIER }}
BUILD_NAME: ${{ github.event.inputs.build_name || 'Backcountry Prod Suite - Scheduled' }}
PROJECT_NAME: "BC Automation"
BROWSER_NAME: chrome
BROWSER_VERSION: latest
OS_NAME: Windows
OS_VERSION: "11"
# - name: Generate HTML Report
# if: always()
# run: npm run report
# - name: Upload Test Results
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: test-results-cc-prod-${{ github.run_number }}
# path: |
# test-results/
# cucumber-report.html
# retention-days: 30
# - name: Upload Screenshots
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: failed-screenshots-cc-prod-${{ github.run_number }}
# path: test-results/screenshots/
# retention-days: 30
# - name: Upload Videos
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: failed-videos-cc-prod-${{ github.run_number }}
# path: test-results/videos/
# retention-days: 30
- name: "BrowserStackLocal Stop" # Terminating the BrowserStackLocal tunnel connection
if: always()
uses: browserstack/github-actions/setup-local@master
with:
local-testing: stop
local-identifier: ${{ env.LOCAL_IDENTIFIER }}