Skip to content

Daily Playwright API Checks #410

Daily Playwright API Checks

Daily Playwright API Checks #410

Workflow file for this run

name: Daily Playwright API Checks
on:
pull_request:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
inputs:
base_url:
description: "URL, to run tests against"
required: true
default: https://automationintesting.online/
permissions:
contents: write
pages: write
id-token: write
jobs:
playwright-automation-checks:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
timeout-minutes: 10
runs-on: ubuntu-latest
env:
BASE_URL: ${{ github.event.inputs.base_url }}
CURRENTS_PROJECT_ID: ${{ secrets.CURRENTS_PROJECT_ID }}
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache node_modules
uses: actions/cache@v3
id: node-modules-cache
with:
path: |
node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- run: npm ci --ignore-scripts
if: steps.node-modules-cache.outputs.cache-hit != 'true'
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- run: npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Run lint
run: npm run lint
- name: Run prettier
run: npm run prettier
# - name: Run UnitTests
# run: npm run ut
- name: Set BASE_URL if not passed in
if: env.BASE_URL == null
run: |
echo "BASE_URL=https://automationintesting.online/" >> $GITHUB_ENV
- name: Run Playwright tests
env:
CURRENTS_PROJECT_ID: ${{ secrets.CURRENTS_PROJECT_ID }}
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: reporter-${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
URL: ${{ env.BASE_URL}}
run: |
echo "The github event is: ${{ github.event_name }}"
npm run test
# The following steps are for deploying the report to GitHub Pages
- name: Setup Pages
if: always()
uses: actions/configure-pages@v3
- uses: actions/upload-artifact@v3
if: always()
with:
name: report-artifact
path: playwright-report/
retention-days: 3
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v1
if: always()
with:
path: "playwright-report/"
- name: Deploy to GitHub Pages
if: always()
id: deployment
uses: actions/deploy-pages@v2