Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mobile devices e2e #86

Merged
merged 15 commits into from
Apr 28, 2024
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ If you are new to pnpm you need to [install it on your local machine](https://pn

pnpm install

# Install playwright for end-to-end tests

pnpm exec playwright install --with-deps

# Start local webserver at port 3000

pnpm dev
Expand All @@ -91,9 +95,17 @@ pnpm lint

pnpm test

# Run end-to-end tests

pnpm test:e2e

# Build app for production (gets output in the 'dist' directory)

pnpm build

# Start production server

pnpm start
```

## Learn More
Expand Down
2 changes: 1 addition & 1 deletion e2e/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';

test.describe('test homepage', () => {
test('Find links in DOM', async ({ page }) => {
await page.goto('/');
await page.goto('/', { waitUntil: 'domcontentloaded' });

await expect(
page.getByRole('link', { name: 'Docs -> Find in-depth' }),
Expand Down
22 changes: 21 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineConfig({
workers: process.env.CI ? 1 : undefined,
fullyParallel: true,

forbidOnly: !!process.env.CI,
forbidOnly: process.env.CI ? true : false,
retries: process.env.CI ? 3 : 0,

use: {
Expand All @@ -32,5 +32,25 @@ export default defineConfig({
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
{
name: 'mobile webkit',
use: {
...devices['iPhone 14'],
},
},
{
name: 'mobile chromium',
use: {
...devices['Pixel 7'],
},
},
],

webServer: process.env.CI
? undefined
: {
command: 'pnpm build && pnpm start',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
});
Loading