Skip to content

Commit 79f8ae2

Browse files
refactor: address pr comments.
1 parent 3c98e08 commit 79f8ae2

4 files changed

Lines changed: 22 additions & 10 deletions

File tree

.github/workflows/playwright.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ on:
66
- main
77
paths:
88
- 'src/**'
9+
- 'playwright/**'
910
- 'package-lock.json'
10-
pull_request:
11-
branches:
12-
- main
11+
- 'playwright.config.ts'
12+
- '.github/workflows/playwright.yml'
1313
workflow_dispatch:
1414

1515
jobs:

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ Then open the URL printed by the dev server (it should open `src/index.html`).
2424

2525
## End-to-end tests
2626

27+
Install Playwright browsers once before your first local run:
28+
29+
```bash
30+
npx playwright install
31+
```
32+
33+
If your environment needs system dependencies too (for example Linux CI-like containers), use:
34+
35+
```bash
36+
npx playwright install --with-deps
37+
```
38+
2739
Run local Playwright tests (Chromium):
2840

2941
```bash

playwright.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ if (isCI) {
2323

2424
export default defineConfig({
2525
testDir: 'playwright',
26-
timeout: 45_000,
26+
timeout: isCI ? 120_000 : 20_000,
2727
retries: isCI ? 1 : 0,
2828
expect: {
29-
timeout: 15_000,
29+
timeout: isCI ? 90_000 : 15_000,
3030
},
3131
reporter: isCI ? 'github' : 'list',
3232
use: {

playwright/app.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Page } from '@playwright/test'
44
const waitForInitialRender = async (page: Page) => {
55
await page.goto('/src/index.html')
66
await expect(page.getByRole('heading', { name: '@knighted/develop' })).toBeVisible()
7-
await expect(page.locator('#status')).toHaveText('Rendered', { timeout: 90_000 })
7+
await expect(page.locator('#status')).toHaveText('Rendered')
88
await expect(page.locator('#cdn-loading')).toHaveAttribute('hidden', '')
99
}
1010

@@ -42,7 +42,7 @@ test('renders in react mode with css modules', async ({ page }) => {
4242
await page.getByLabel('ShadowRoot (open)').uncheck()
4343
await page.locator('#render-mode').selectOption('react')
4444
await page.locator('#style-mode').selectOption('module')
45-
await expect(page.locator('#status')).toHaveText('Rendered', { timeout: 90_000 })
45+
await expect(page.locator('#status')).toHaveText('Rendered')
4646

4747
const previewItems = page.locator('#preview-host li')
4848
await expect(previewItems).toHaveCount(3)
@@ -79,7 +79,7 @@ test('requires render button when auto render is disabled', async ({ page }) =>
7979
await expect(styleWarning).toHaveText('')
8080

8181
await renderButton.click()
82-
await expect(page.locator('#status')).toHaveText('Rendered', { timeout: 90_000 })
82+
await expect(page.locator('#status')).toHaveText('Rendered')
8383
await expect(styleWarning).toContainText('CSS Modules are compiled in-browser')
8484
})
8585

@@ -103,7 +103,7 @@ test('renders with less style mode', async ({ page }) => {
103103

104104
await page.getByLabel('ShadowRoot (open)').uncheck()
105105
await page.locator('#style-mode').selectOption('less')
106-
await expect(page.locator('#status')).toHaveText('Rendered', { timeout: 90_000 })
106+
await expect(page.locator('#status')).toHaveText('Rendered')
107107
await expect(page.locator('#style-warning')).toContainText(
108108
'Less is compiled in-browser via @knighted/css/browser.',
109109
)
@@ -118,7 +118,7 @@ test('renders with sass style mode', async ({ page }) => {
118118

119119
await page.getByLabel('ShadowRoot (open)').uncheck()
120120
await page.locator('#style-mode').selectOption('sass')
121-
await expect(page.locator('#status')).toHaveText('Rendered', { timeout: 90_000 })
121+
await expect(page.locator('#status')).toHaveText('Rendered')
122122
await expect(page.locator('#style-warning')).toContainText(
123123
'Sass is compiled in-browser via @knighted/css/browser.',
124124
)

0 commit comments

Comments
 (0)