Skip to content

Commit 61ff26e

Browse files
authored
ci: add pipeline to run tests on browsers (#6021)
1 parent c93ba2d commit 61ff26e

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI Browsers
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
# Run on every PR, regardless of branch
8+
branches: [ '*' ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
test-docs:
13+
name: Modern Browsers Test
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '24'
23+
24+
- name: Install dependencies
25+
run: |
26+
npm install
27+
npx playwright install --with-deps
28+
npm install -D @playwright/test@latest
29+
30+
- name: Build project
31+
run: npm run build
32+
33+
- name: Start server
34+
run: |
35+
npx http-server -p 9001 &
36+
sleep 2
37+
38+
- name: Run Playwright tests
39+
run: npx playwright test

playwright.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const { devices } = require('@playwright/test');
2+
3+
module.exports = {
4+
retries: 0,
5+
testDir: './test',
6+
testMatch: '**/*.spec.js',
7+
use: {
8+
baseURL: 'http://localhost:9001',
9+
headless: true,
10+
},
11+
projects: [
12+
{ name: 'Chromium', use: { browserName: 'chromium' } },
13+
{ name: 'Firefox', use: { browserName: 'firefox' } },
14+
{ name: 'WebKit', use: { browserName: 'webkit' } },
15+
{
16+
name: 'Microsoft Edge',
17+
use: { browserName: 'chromium', channel: 'msedge' },
18+
},
19+
{
20+
name: 'Mobile Safari',
21+
use: { ...devices['iPhone 12'], browserName: 'webkit' },
22+
},
23+
{
24+
name: 'Mobile Chrome',
25+
use: { ...devices['Pixel 5'], browserName: 'chromium' },
26+
},
27+
],
28+
};

test/playwright-runner.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const { test, expect } = require('@playwright/test');
2+
3+
test.describe.configure({ mode: 'parallel' });
4+
5+
test('index', async ({ page }) => {
6+
await page.goto('http://localhost:9001/test/index.html');
7+
await expect(page.locator('text=0 failed')).toBeVisible({ timeout: 60000 });
8+
});
9+
10+
test('fp', async ({ page }) => {
11+
await page.goto('http://localhost:9001/test/fp.html');
12+
await expect(page.locator('text=0 failed')).toBeVisible({ timeout: 60000 });
13+
});
14+
15+
test('backbone', async ({ page }) => {
16+
await page.goto('http://localhost:9001/test/backbone.html');
17+
await expect(page.locator('text=0 failed')).toBeVisible({ timeout: 60000 });
18+
});
19+
20+
test('underscore', async ({ page }) => {
21+
await page.goto('http://localhost:9001/test/underscore.html');
22+
await expect(page.locator('text=0 failed')).toBeVisible({ timeout: 60000 });
23+
});

0 commit comments

Comments
 (0)