forked from microsoft/PartsUnlimitedE2E
-
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.
Create reusable-run-playwright-tests.yml
- Loading branch information
Showing
1 changed file
with
64 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,64 @@ | ||
name: Run Playwright Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment-name: | ||
required: true | ||
type: string | ||
artifact-name: | ||
required: true | ||
type: string | ||
artifact-path: | ||
required: true | ||
type: string | ||
test-file: | ||
required: true | ||
type: string | ||
test-args: | ||
required: false | ||
type: string | ||
continue-if-error: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
|
||
Run-Playwright-Tests: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: ${{ inputs.environment-name }} | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
# install npm dependencies | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
# Install Playwright with dependencies | ||
- name: Install Playwright | ||
run: npx playwright install --with-deps | ||
|
||
# Run Playwright tests with the specified test file and arguments | ||
- name: Run Playwright tests | ||
continue-on-error: ${{ inputs.continue-if-error }} | ||
run: npx playwright test ${{ inputs.test-file }} ${{ inputs.test-args }} | ||
|
||
# Upload test results | ||
- name: Upload test results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.environment-name }}-${{ inputs.artifact-name }} | ||
path: ${{ inputs.artifact-path }}/ | ||
retention-days: 30 | ||
|