Skip to content

Commit

Permalink
Extracting the output without reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
amankumarrr committed Mar 26, 2024
1 parent 51fd441 commit 365586c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/daily-image-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
env:
DEPLOY_URL: "https://ssw.com.au"
TESTS_TO_RUN: "images"
REPORTER: "--reporter='./ui-tests/reporter.ts'"

defaults:
run:
Expand All @@ -25,14 +24,12 @@ jobs:
outputs:
DEPLOY_URL: ${{ steps.envs.outputs.DEPLOY_URL }}
TESTS_TO_RUN: ${{ steps.envs.outputs.TESTS_TO_RUN }}
REPORTER: ${{ steps.envs.outputs.REPORTER }}
steps:
- name: Get env
id: envs
run: |
echo "DEPLOY_URL=${{ env.DEPLOY_URL }}" >> $env:GITHUB_OUTPUT
echo "TESTS_TO_RUN=${{env.TESTS_TO_RUN }}" >> $env:GITHUB_OUTPUT
echo "REPORTER=${{env.REPORTER }}" >> $env:GITHUB_OUTPUT
check-broken-images:
name: Run Playwright Tests
Expand All @@ -41,4 +38,4 @@ jobs:
with:
deploy_url: ${{ needs.get-env-vars.outputs.DEPLOY_URL }}
tests_to_run: ${{ needs.get-env-vars.outputs.TESTS_TO_RUN }}
reporter: ${{ needs.get-env-vars.outputs.REPORTER }}
create-issue: true
17 changes: 9 additions & 8 deletions .github/workflows/template-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ on:
tests_to_run:
type: string
required: true
reporter:
type: string
default: ""
create-issue:
type: boolean
default: false
required: false

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

steps:
Expand Down Expand Up @@ -52,9 +52,10 @@ jobs:
id: run
shell: pwsh
run: |
$status = npx playwright test ${{ inputs.tests_to_run }}
echo "Test status: $status"
echo "status=$status" >> $env:GITHUB_OUTPUT
$testOutput = npx playwright test ${{ inputs.tests_to_run }} # On Success - 'Running 4 tests using 1 worker ···· 4 passed'
$testPassed = ($testOutput -match "failed") -eq $false # On Failure - 'Running 4 tests using 1 worker ···· 3 passed, 1 failed'
echo "Test passed: $testPassed"
echo "testPassed=$testPassed" >> $env:GITHUB_OUTPUT
env:
HOST_URL: ${{ inputs.deploy_url }}

Expand All @@ -70,7 +71,7 @@ jobs:
name: GitHub Issue
runs-on: ubuntu-latest
needs: test
if: needs.test.outputs.status != 'passed' && inputs.reporter != ''
if: needs.test.outputs.testPassed == 'False' && inputs.create-issue == true
steps:
- uses: actions/checkout@v4

Expand Down

0 comments on commit 365586c

Please sign in to comment.