Skip to content

Commit

Permalink
Adding new pipeline to check images daily
Browse files Browse the repository at this point in the history
  • Loading branch information
amankumarrr committed Mar 26, 2024
1 parent 86ec596 commit 9d373bf
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/daily-image-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Daily broken images check

on:
pull_request:
branches:
- main
schedule:
# Every Weekday at 8 AM AEDT - https://cron.help/#0_21_*_*_SUN-THU
- cron: "0 21 * * SUN-THU"
workflow_dispatch:

env:
test_to_run: "images"
deploy_url: "https://ssw.com.au"
reporter: "--reporter='./ui-tests/reporter.ts'"

defaults:
run:
shell: pwsh

jobs:
check-broken-images:
name: Run Playwright Tests
uses: ./.github/workflows/template-ui-tests.yml
with:
deploy_url: ${{ env.deploy_url }}
tests_to_run: ${{ env.test_to_run }}
reporter: ${{ env.reporter }}
20 changes: 19 additions & 1 deletion .github/workflows/template-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ on:
tests_to_run:
type: string
required: true
reporter:
type: string
default: ""
required: false

jobs:
test:
name: Run Playwright tests
runs-on: ubuntu-latest
outputs:
status: ${{ steps.run.outputs.status }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -42,7 +48,10 @@ jobs:
retry-delay: 10s

- name: Run Playwright tests
run: npx playwright test ${{ inputs.tests_to_run }}
id: run
run: |
$status = npx playwright test ${{ inputs.tests_to_run }} ${{ inputs.reporter }}
echo "status=$status" >> $env:GITHUB_OUTPUT
env:
HOST_URL: ${{ inputs.deploy_url }}

Expand All @@ -52,3 +61,12 @@ jobs:
name: playwright-report
path: playwright-report/
retention-days: 2

notify-team:
name: Send email notification
runs-on: ubuntu-latest
needs: test
steps:
- name: Send email
run: |
echo "Playwright tests status: ${{ needs.test.outputs.status }}"
8 changes: 8 additions & 0 deletions ui-tests/reporter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { FullResult, Reporter } from "@playwright/test/reporter";

class MyReporter implements Reporter {
onEnd(result: FullResult) {
console.log(`${result.status}`);

Check warning on line 5 in ui-tests/reporter.ts

View workflow job for this annotation

GitHub Actions / lint-code

Unexpected console statement
}
}
export default MyReporter;

0 comments on commit 9d373bf

Please sign in to comment.