Skip to content

Commit

Permalink
Comment out current Playwright Testing job in github action and creat…
Browse files Browse the repository at this point in the history
…e new one
  • Loading branch information
ryandotfurrer committed May 17, 2024
1 parent 97c7ebf commit 37b1b7c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 28 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ jobs:
- name: tests
run: pnpm test
#Playwright Testing
playwright-test:
timeout-minutes: 60000
runs-on: ubuntu-latest
# playwright-test:
# timeout-minutes: 60000
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm install -g pnpm && pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm exec playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: lts/*
# - name: Install dependencies
# run: npm install -g pnpm && pnpm install
# - name: Install Playwright Browsers
# run: pnpm exec playwright install --with-deps
# - name: Run Playwright tests
# run: pnpm exec playwright test
# - uses: actions/upload-artifact@v4
# if: always()
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30


38 changes: 38 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: e2e tests
on:
pull_request:
branches:
- main
- develop

jobs:
test_setup:
name: Test setup
runs-on: ubuntu-latest
outputs:
prevuew_url: ${{ steps.waitForVercelPreviewDeployment.outputs.url }}
steps:
- name: Wait for Vercel Preview
uses: patrickedqvist/[email protected]
id: waitForVercelPreviewDeployment
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 600

test_e2e:
needs: tests_setup
name: Playwright tests
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Prepare testing env
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with
node-version: "14"
- run: npm ci
- run: npx playwright install --with-deps
- name: Run tests
run: npm run test:e2e
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.test_setup.outputs.preview_url }}
10 changes: 2 additions & 8 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL:
currentBranch === 'main'
? 'https://www.gridironsurvivor.com'
: 'http://localhost:3000',
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand All @@ -73,10 +70,7 @@ export default defineConfig({
/* Run your local dev server before starting the tests */
webServer: {
command: currentBranch === 'main' ? 'npm run build' : 'npm run dev',
url:
currentBranch === 'main'
? 'https://www.gridironsurvivor.com'
: 'http://localhost:3000',
url: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
});

0 comments on commit 37b1b7c

Please sign in to comment.