-
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
a120db1
commit 83f5556
Showing
15 changed files
with
316 additions
and
5 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,2 +1,3 @@ | ||
MONGO_DB_URL= | ||
NEXT_PUBLIC_NODE_ENV= | ||
PLAYWRIGHT_BASE_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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ jobs: | |
run: npm run lint | ||
|
||
- name: Unit Tests | ||
run: npm run test | ||
run: npm run test:unit |
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,43 @@ | ||
name: E2e tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
timeout-minutes: 60 | ||
|
||
steps: | ||
- name: Wait for HTTP Status Code 200 from the Vercel Preview Deploy | ||
uses: patrickedqvist/[email protected] | ||
id: waitForVercelPreviewDeploy | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
max_timeout: 300 | ||
|
||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
|
||
- name: Run Playwright tests | ||
env: | ||
PLAYWRIGHT_BASE_URL: ${{ steps.waitForVercelPreviewDeploy.outputs.url }} | ||
run: npx playwright test | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,43 @@ | ||
import path from 'node:path' | ||
|
||
import { defineConfig, devices } from '@playwright/test' | ||
import dotenv from 'dotenv' | ||
|
||
|
||
dotenv.config({ path: path.resolve(__dirname, '.env') }) | ||
|
||
const environment = process.env.NEXT_PUBLIC_NODE_ENV || 'development' | ||
|
||
export default defineConfig({ | ||
forbidOnly: environment !== 'development', | ||
fullyParallel: true, | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
{ | ||
name: 'Mobile Chrome', | ||
use: { ...devices['Pixel 5'] }, | ||
}, | ||
{ | ||
name: 'Mobile Safari', | ||
use: { ...devices['iPhone 12'] }, | ||
}, | ||
], | ||
reporter: 'html', | ||
retries: environment !== 'development' ? 2 : 0, | ||
testDir: './src/', | ||
testMatch: '**/*.e2e.ts', | ||
use: { | ||
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:3000', | ||
screenshot: 'only-on-failure', | ||
trace: 'retain-on-failure', | ||
video: 'retain-on-failure', | ||
}, | ||
workers: environment !== 'development' ? 1 : undefined, | ||
}) |
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,2 @@ | ||
export * from './page/AppPage' | ||
export * from './test/testAppPage' |
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,8 @@ | ||
import { BasePage } from 'src/tests/playwright/fixtures' | ||
|
||
|
||
export class AppPage extends BasePage { | ||
async goto(): Promise<void> { | ||
await this.page.goto('/') | ||
} | ||
} |
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,11 @@ | ||
import test from '@playwright/test' | ||
|
||
import { AppPage } from '../page/AppPage' | ||
|
||
|
||
export const testAppPage = test.extend<{ appPage: AppPage }>({ | ||
async appPage({ page }, use) { | ||
const appPage = new AppPage(page) | ||
await use(appPage) | ||
} | ||
}) |
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,32 @@ | ||
import { expect } from '@playwright/test' | ||
|
||
import { testAppPage as test } from './__e2e__/fixtures' | ||
|
||
|
||
test.beforeEach(async ({ appPage }) => { | ||
await appPage.goto() | ||
}) | ||
|
||
test.describe('src / app / [locale] > app', () => { | ||
test('check header existance', async ({ appPage }) => { | ||
expect(appPage.header.getElement()).toBeDefined() | ||
expect(appPage.header.getElement()).toBeInViewport() | ||
|
||
expect(appPage.header.getLogo()).toBeDefined() | ||
expect(appPage.header.getLogo()).toBeInViewport() | ||
}) | ||
|
||
test('check navigation menu', async ({ appPage }) => { | ||
expect(appPage.navigation.getElement()).toBeInViewport() | ||
|
||
expect(appPage.navigation.getMenu('')).toBeDefined() | ||
expect(appPage.navigation.getMenu('places')).toBeDefined() | ||
}) | ||
|
||
test('check locales menu', async ({ appPage }) => { | ||
expect(appPage.locales.getElement()).toBeInViewport() | ||
|
||
expect(appPage.locales.getLanguage('en')).toBeDefined() | ||
expect(appPage.locales.getLanguage('it')).toBeDefined() | ||
}) | ||
}) |
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 @@ | ||
export * from './page/BasePage' |
Oops, something went wrong.