Skip to content

chore: test framework better error reporting with file name and messa… #13

chore: test framework better error reporting with file name and messa…

chore: test framework better error reporting with file name and messa… #13

name: Chromium and firefox run full tests suite with Playwright
on:
push:
branches: [ main ]
permissions:
contents: read
issues: write
jobs:
testFirefoxUnit:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build phoenix
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright unit tests in Firefox
run: npm run testFirefox
testFirefoxInteg:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build phoenix
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright integration tests in firefox Attempt 1
timeout-minutes: 30
id: attempt1
continue-on-error: true
run: npm run testIntegFirefox
- name: Run Playwright integration tests in firefox Attempt 2
if: steps.attempt1.outcome == 'failure'
id: attempt2
run: npm run testIntegFirefox
testChromiumUnit:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build phoenix
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright unit tests in Chromium
run: npm run testChromium
testChromiumInteg:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build phoenix
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright integration tests in Chromium Attempt 1
timeout-minutes: 30
id: attemptC1
continue-on-error: true
run: npm run testIntegChromium
- name: Run Playwright integration tests in Chromium Attempt 2
if: steps.attemptC1.outcome == 'failure'
id: attemptC2
run: npm run testIntegChromium
raiseIssue:
needs: [ testFirefoxUnit, testFirefoxInteg, testChromiumUnit, testChromiumInteg]
runs-on: ubuntu-latest
if: always() # This ensures that this job runs even if the previous jobs failed
steps:
- name: Check for failures and raise an issue
if: |
always() &&
(needs.testFirefox.result == 'failure' || needs.testChromium.result == 'failure')
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issueTitle = "Test failure on push: commit ${{github.sha}}";
const runURL = `https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}`;
let issueBody = `There was a test failure. Please investigate.\n\n[Check the failed run here](${runURL})\n\n`;
if (needs.testFirefoxUnit.result == 'failure') {
issueBody += " - Firefox unit tests failed.\n";
}
if (needs.testFirefoxInteg.result == 'failure') {
issueBody += " - Firefox integration tests failed.\n";
}
if (needs.testChromiumUnit.result == 'failure') {
issueBody += " - Chromium unit tests failed.\n";
}
if (needs.testChromiumInteg.result == 'failure') {
issueBody += " - Chromium integration tests failed.\n";
}
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: issueTitle,
body: issueBody
});