-
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.
- Loading branch information
1 parent
e0b5443
commit 15125ee
Showing
1 changed file
with
11 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
name: E2E Tests | ||
|
||
on: [deployment_status] | ||
on: | ||
issue_comment: | ||
types: [edited] | ||
|
||
jobs: | ||
test: | ||
# run job on successful preview deploys | ||
if: github.event.deployment_status.environment == 'Preview' && github.event.deployment_status.state == 'success' | ||
if: github.event.issue.pull_request | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: π Setup repo | ||
|
@@ -23,39 +24,13 @@ jobs: | |
yarn workspaces focus @labfaz/e2e | ||
npx playwright install --with-deps | ||
- name: Capture Vercel preview URL | ||
id: vercelPreview | ||
uses: aaron-binary/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: π₯π Run E2E Tests | ||
run: yarn workspace @labfaz/e2e test:all | ||
env: | ||
BROWSER_URL: ${{ github.event.deployment_status.target_url }} | ||
|
||
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions | ||
- name: E2E Tests β | ||
if: ${{ success() }} | ||
# set the merge commit status check | ||
# using GitHub REST API | ||
# see https://docs.github.com/en/rest/reference/repos#create-a-commit-status | ||
run: | | ||
curl --request POST \ | ||
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | ||
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
--header 'content-type: application/json' \ | ||
--data '{ | ||
"context": "e2e", | ||
"state": "success", | ||
"description": "E2E tests passed", | ||
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
}' | ||
- name: E2E Tests π¨ | ||
if: ${{ failure() }} | ||
run: | | ||
curl --request POST \ | ||
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ | ||
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
--header 'content-type: application/json' \ | ||
--data '{ | ||
"context": "e2e", | ||
"state": "failure", | ||
"description": "E2E tests failed", | ||
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
}' | ||
BROWSER_URL: ${{ steps.vercelPreview.outputs.vercel_preview_url }} |