-
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
Showing
1 changed file
with
46 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Run Playwright E2E Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Use workflow from branch' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
e2e-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.branch }} | ||
|
||
- name: Set TEST_URL variable | ||
run: | | ||
if [[ "${{ github.event.inputs.branch }}" == "staging" ]]; then | ||
echo "TEST_URL=https://kingpanda.dev/" >> $GITHUB_ENV | ||
elif [[ "${{ github.event.inputs.branch }}" == "master" ]]; then | ||
echo "TEST_URL=https://kingpanda.bet.br/" >> $GITHUB_ENV | ||
else | ||
BRANCH_LOWER=$(echo "${{ github.event.inputs.branch }}" | tr '[:upper:]' '[:lower:]') | ||
echo "TEST_URL=https://$BRANCH_LOWER.kingpanda-front.pages.dev" >> $GITHUB_ENV | ||
fi | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
|
||
- name: Run Playwright tests | ||
run: npx playwright test | ||
|
||
- name: Upload Playwright report | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |