-
Notifications
You must be signed in to change notification settings - Fork 1
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
c9f2b83
commit 2699293
Showing
9 changed files
with
159 additions
and
18 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,5 +1,6 @@ | ||
## Environment Example File | ||
## | ||
## This file contains secret information like passwords and other settings | ||
## | ||
## PLEASE DO NOT SHARE THIS INFORMATION | ||
## Name of your app | ||
## v0.0.0 | ||
## Last updated: YYYY-MM-DD | ||
|
||
PLAYWRIGHT_TEST_BASE_URL= | ||
CI= |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Playwright Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test_setup: | ||
name: Test setup | ||
runs-on: ubuntu-latest | ||
outputs: | ||
preview_url: ${{ steps.waitForVercelPreviewDeployment.outputs.url }} | ||
steps: | ||
- name: Wait for Vercel Preview | ||
uses: patrickedqvist/[email protected] | ||
id: waitForVercelPreviewDeployment | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
max_timeout: 300 | ||
|
||
test_e2e: | ||
needs: test_setup | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup | ||
uses: ./.github/actions/setup | ||
|
||
- name: Install Playwright Browsers | ||
run: pnpm exec playwright install --with-deps | ||
|
||
- name: Run tests | ||
run: pnpm test:e2e | ||
env: | ||
PLAYWRIGHT_TEST_BASE_URL: ${{ needs.test_setup.outputs.preview_url }} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test.describe('test homepage', () => { | ||
test('Find links in DOM', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
await expect( | ||
page.getByRole('link', { name: 'Docs -> Find in-depth' }), | ||
).toBeVisible(); | ||
await expect( | ||
page.getByRole('link', { name: 'Learn -> Learn about Next.js' }), | ||
).toBeVisible(); | ||
await expect( | ||
page.getByRole('link', { name: 'Templates -> Explore starter' }), | ||
).toBeVisible(); | ||
await expect( | ||
page.getByRole('link', { name: 'Deploy -> Instantly deploy' }), | ||
).toBeVisible(); | ||
}); | ||
}); |
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
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,36 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testMatch: 'e2e/*.spec.ts', | ||
testDir: 'e2e', | ||
reporter: [['html', { open: 'never', outputFolder: 'e2e/report' }]], | ||
outputDir: 'e2e/test-results/', | ||
|
||
workers: process.env.CI ? 1 : undefined, | ||
fullyParallel: true, | ||
|
||
forbidOnly: !!process.env.CI, | ||
retries: process.env.CI ? 3 : 0, | ||
|
||
use: { | ||
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL ?? 'http://localhost:3000', | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
], | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.