-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from luzmo-official/feat/workflow-for-e2e
Add workflow for e2e tests
- Loading branch information
Showing
10 changed files
with
399 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,83 @@ | ||
name: E2E tests | ||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_call: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "30 9 * * *" | ||
pull_request: | ||
branches: [ main ] | ||
types: [ opened, synchronize ] | ||
|
||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
env: | ||
PLAYWRIGHT_BROWSERS_PATH: pw-browsers/ | ||
defaults: | ||
run: | ||
working-directory: ./e2e | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Read .nvmrc | ||
id: nvmrc | ||
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ steps.nvm.outputs.NODE_VERSION }} | ||
node-version-file: .nvmrc | ||
- name: Cache restore | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
e2e/node_modules | ||
e2e/$PLAYWRIGHT_BROWSERS_PATH | ||
key: "${{ runner.os }}-node-${{ hashFiles('e2e/package-lock.json') }}" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npm run pw install --with-deps | ||
run: npm run pw install chromium --with-deps | ||
- name: Run Playwright tests | ||
run: npm test | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
path: | | ||
e2e/playwright-report/ | ||
e2e/test-results/ | ||
retention-days: 10 | ||
- name: Run CTRF results | ||
if: always() | ||
run: | | ||
npx github-actions-ctrf tests ctrf/ctrf-report.json --pr-comment | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set test result outputs | ||
id: set_test_outputs | ||
if: always() | ||
run: | | ||
echo "TEST_COUNT=`jq '.results.summary.passed' < ./ctrf/ctrf-report.json`" >> $GITHUB_OUTPUT | ||
echo "PASSED_TESTS=`jq '.results.summary.passed' < ./ctrf/ctrf-report.json`" >> $GITHUB_OUTPUT | ||
echo "FAILED_TESTS=`jq '.results.summary.failed' < ./ctrf/ctrf-report.json`" >> $GITHUB_OUTPUT | ||
- name: Add github branch name & SHA to environment | ||
if: always() | ||
run: | | ||
if [ "$GITHUB_HEAD_REF" != "" ]; then | ||
echo "GITHUB_BRANCH_NAME=$(echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV | ||
else | ||
echo "GITHUB_BRANCH_NAME=$(echo $GITHUB_REF_NAME)" >> $GITHUB_ENV | ||
fi | ||
echo "GITHUB_COMMIT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV | ||
- name: Slack Notification on failure | ||
uses: rtCamp/action-slack-notify@v2 | ||
if: github.event_name !== 'pull_request' && steps.set_test_outputs.outputs.FAILED_TESTS > 0 | ||
env: | ||
SLACK_CHANNEL: engineering-alerts | ||
SLACK_COLOR: failure | ||
SLACK_MESSAGE: " | ||
<https://github.com/luzmo-official/flex-showcases/commit/${{ github.sha }}/checks|*Workflow*> \n | ||
:warning: ${{ steps.set_test_outputs.outputs.FAILED_TESTS }} out of ${{ steps.set_test_outputs.outputs.TEST_COUNT }} e2e tests failed for luzmo showcases \n" | ||
SLACK_TITLE: ":git: luzmo-official/flex-showcases - ${{ env.GITHUB_BRANCH_NAME }} - `${{ env.GITHUB_COMMIT_SHA }}`" | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_ALERTS_WEBHOOK }} | ||
MSG_MINIMAL: true | ||
SLACK_FOOTER: "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
/ctrf/ |
Oops, something went wrong.