Skip to content

Commit 11fe021

Browse files
committed
test: set up screenshot testing for docs.page
1 parent fc512bd commit 11fe021

22 files changed

+5502
-380
lines changed

.github/workflows/playwright.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 16
16+
- name: Install dependencies
17+
run: yarn
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: yarn playwright test
22+
- uses: actions/upload-artifact@v3
23+
if: always()
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ tailwind.css*
3939

4040
# Tests
4141
website/tests/screenshots/*
42+
/test-results/
43+
/playwright-report/
44+
/playwright/.cache/

__tests__/config.test.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

__tests__/example.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// example.spec.ts
2+
import { test, expect } from '@playwright/test';
3+
import {default as domains} from '../domains.json';
4+
5+
const stagingUrl = 'https://staging-docs-page-website-euw1-dzpolnxswq-ew.a.run.app';
6+
7+
// skip these as these are not working (user error)
8+
const skipList = ['dokumentacja.otwartaturystyka.pl']
9+
10+
domains.forEach(domain => {
11+
if (!skipList.includes(domain[0])) {
12+
test(`${domain[0]}`, async ({ page }) => {
13+
14+
const response = await page.goto(`https://${domain[0]}`);
15+
16+
expect(response).toBeDefined();
17+
expect(response!.status()).toBe(200);
18+
19+
const screenshotName = `${domain[1]}-original.png`;
20+
await expect(page).toHaveScreenshot(`${domain[1]}-original.png`);
21+
22+
await page.goto(`${stagingUrl}/${domain[1]}`)
23+
await expect(page).toHaveScreenshot(`${domain[1]}-original.png`);
24+
});
25+
}
26+
})
99.7 KB
Loading
104 KB
Loading
55.9 KB
Loading
147 KB
Loading
81.9 KB
Loading
133 KB
Loading

0 commit comments

Comments
 (0)