Skip to content

Commit e52c0b4

Browse files
committed
history: screenshots
1 parent 2ca6957 commit e52c0b4

22 files changed

+114
-1
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/* global process */
2+
import { expect, test } from '@playwright/test';
3+
import { HistoryTestPage } from './history.page.js';
4+
5+
const maxDiffPixels = 20;
6+
7+
test.describe('full history screenshots', { tag: ['@screenshots'] }, () => {
8+
test.use({ viewport: { width: 1080, height: 500 } });
9+
test.skip(process.env.CI === 'true');
10+
test('empty state', async ({ page }, workerInfo) => {
11+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(0);
12+
await hp.openPage();
13+
await hp.didMakeInitialQueries({ term: '' });
14+
await expect(page).toHaveScreenshot('full.empty.light.png', { maxDiffPixels });
15+
await hp.darkMode();
16+
await expect(page).toHaveScreenshot('full.empty.dark.png', { maxDiffPixels });
17+
});
18+
test('short list (3 items)', async ({ page }, workerInfo) => {
19+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(3);
20+
await hp.openPage();
21+
await expect(page).toHaveScreenshot('full.short.light.png', { maxDiffPixels });
22+
await hp.darkMode();
23+
await expect(page).toHaveScreenshot('full.short.dark.png', { maxDiffPixels });
24+
});
25+
});
26+
27+
test.describe('history sidebar screenshots', { tag: ['@screenshots'] }, () => {
28+
test.use({ viewport: { width: 1080, height: 400 } });
29+
test.skip(process.env.CI === 'true');
30+
test('sidebar active/hover', async ({ page }, workerInfo) => {
31+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(3);
32+
await hp.openPage();
33+
await hp.selectsToday();
34+
await hp.hoversRange('yesterday');
35+
await expect(hp.sidebar()).toHaveScreenshot('sidebar.light.png', { maxDiffPixels });
36+
await hp.darkMode();
37+
await expect(hp.sidebar()).toHaveScreenshot('sidebar.dark.png', { maxDiffPixels });
38+
39+
await hp.lightMode();
40+
await hp.hoversRangeDelete('yesterday');
41+
await expect(hp.sidebar()).toHaveScreenshot('sidebar.delete.light.png', { maxDiffPixels });
42+
43+
await hp.darkMode();
44+
await expect(hp.sidebar()).toHaveScreenshot('sidebar.delete.dark.png', { maxDiffPixels });
45+
});
46+
});
47+
48+
test.describe('history item selections', { tag: ['@screenshots'] }, () => {
49+
test.use({ viewport: { width: 1080, height: 400 } });
50+
test.skip(process.env.CI === 'true');
51+
test('main selecting', async ({ page }, workerInfo) => {
52+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(12);
53+
await hp.openPage();
54+
await hp.didMakeNthQuery({ nth: 0, query: { term: '' } });
55+
await hp.selectsRowIndex(1);
56+
await hp.selectsRowIndexWithShift(3);
57+
await hp.hoversRowIndex(1);
58+
await expect(hp.main()).toHaveScreenshot('main.select.light.png', { maxDiffPixels });
59+
await hp.darkMode();
60+
await expect(hp.main()).toHaveScreenshot('main.select.dark.png', { maxDiffPixels });
61+
});
62+
test('main hover', async ({ page }, workerInfo) => {
63+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(12);
64+
await hp.openPage();
65+
await hp.didMakeNthQuery({ nth: 0, query: { term: '' } });
66+
await hp.hoversRowIndex(0);
67+
await expect(hp.main()).toHaveScreenshot('main.hover.light.png', { maxDiffPixels });
68+
await hp.darkMode();
69+
await expect(hp.main()).toHaveScreenshot('main.hover.dark.png', { maxDiffPixels });
70+
});
71+
test('main selection + hover', async ({ page }, workerInfo) => {
72+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(12);
73+
await hp.openPage();
74+
await hp.didMakeNthQuery({ nth: 0, query: { term: '' } });
75+
await hp.selectsRowIndex(1);
76+
await hp.hoversRowIndexBtn(1);
77+
await expect(hp.main()).toHaveScreenshot('main.select+hover.light.png', { maxDiffPixels });
78+
await hp.darkMode();
79+
await expect(hp.main()).toHaveScreenshot('main.select+hover.dark.png', { maxDiffPixels });
80+
});
81+
});
82+
83+
test.describe('history header', { tag: ['@screenshots'] }, () => {
84+
test.use({ viewport: { width: 1080, height: 400 } });
85+
test.skip(process.env.CI === 'true');
86+
test('idle header', async ({ page }, workerInfo) => {
87+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(12);
88+
await hp.openPage();
89+
await hp.didMakeNthQuery({ nth: 0, query: { term: '' } });
90+
await expect(hp.header()).toHaveScreenshot('header.idle.light.png', { maxDiffPixels });
91+
await hp.darkMode();
92+
await expect(hp.header()).toHaveScreenshot('header.idle.dark.png', { maxDiffPixels });
93+
});
94+
test('search', async ({ page }, workerInfo) => {
95+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(12);
96+
await hp.openPage();
97+
await hp.didMakeNthQuery({ nth: 0, query: { term: '' } });
98+
await hp.types('example.com');
99+
await expect(hp.header()).toHaveScreenshot('header.search.light.png', { maxDiffPixels });
100+
await hp.darkMode();
101+
await expect(hp.header()).toHaveScreenshot('header.search.dark.png', { maxDiffPixels });
102+
});
103+
test('delete button', async ({ page }, workerInfo) => {
104+
const hp = HistoryTestPage.create(page, workerInfo).withEntries(12);
105+
await hp.openPage();
106+
await hp.didMakeNthQuery({ nth: 0, query: { term: '' } });
107+
await hp.hoversDeleteAllBtn();
108+
await expect(hp.header()).toHaveScreenshot('header.delete.light.png', { maxDiffPixels });
109+
await hp.darkMode();
110+
await expect(hp.header()).toHaveScreenshot('header.delete.dark.png', { maxDiffPixels });
111+
});
112+
});

special-pages/playwright.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export default defineConfig({
3232
'customizer.spec.js',
3333
'activity.spec.js',
3434
'history.spec.js',
35-
'history-selections.spec.js'
35+
'history-selections.spec.js',
36+
'history.screenshots.spec.js',
3637
],
3738
use: {
3839
...devices['Desktop Chrome'],

0 commit comments

Comments
 (0)