This commit is contained in:
seb
2026-08-09 01:22:49 +02:00
parent 4f0d73e0ea
commit f0e7a523da
22 changed files with 516 additions and 3 deletions

51
tests/screenshot.spec.js Normal file
View File

@@ -0,0 +1,51 @@
import { test, expect } from '@playwright/test';
/**
* Screenshot tests for the GUI variations rendered by the harness
* (/screenshots.html). Every `data-shot` section becomes one reference image;
* interactive states (EditablePanelTile editing/dirty) are driven here.
*
* First run generates the reference images (and passes). After that the test
* fails on any visual drift; see the actual/diff images in test-results/.
* Regenerate intentionally changed references with:
* npm run test:screenshots:update
*/
const STATIC_SECTIONS = [
'pills',
'textfields',
'tiles',
'panels-basic',
'panels-busy',
'lists-ready',
'lists-empty',
'lists-loading',
'lists-failed',
'lists-no-actions',
];
test.beforeEach(async ({ page }) => {
await page.goto('/screenshots.html');
});
for (const id of STATIC_SECTIONS) {
test(`screenshot ${id}`, async ({ page }) => {
await expect(page.locator(`[data-shot="${id}"]`)).toHaveScreenshot(
`${id}.png`,
);
});
}
test('editable tile: read, edit, dirty', async ({ page }) => {
const section = page.locator('[data-shot="editable"]');
// Read state — edit button visible, no ring.
await expect(section).toHaveScreenshot('editable-read.png');
// Editing state — clean ring, input focused, save/cancel buttons.
await section.getByRole('button', { name: 'Bearbeiten' }).click();
await expect(section).toHaveScreenshot('editable-editing.png');
// Dirty state — rose pending ring once the draft differs from the saved value.
await section.locator('input').fill('ACME GmbH 2');
await expect(section).toHaveScreenshot('editable-dirty.png');
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB