test: reset golden pointer between scenarios

Issue: #179
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-08-19 23:27:39 +03:00
parent c447e41d4d
commit 11abc0292f
7 changed files with 27 additions and 15 deletions
File diff suppressed because one or more lines are too long
+4
View File
@@ -313,6 +313,10 @@ export function prepareGoldenFixture(scenario) {
export async function prepareGoldenScenario(page, scenario) {
await stableEnvironment(page, scenario);
// Scenarios share one Playwright page, including its pointer position. A
// scenario that deliberately hovers a marker must not leave the next one
// capturing an unrelated room hover at the same viewport coordinates.
await page.mouse.move(0, 0);
const fixture = prepareGoldenFixture(scenario);
const result = await page.evaluate(async ({ fixture, scenario }) => {
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 KiB

After

Width:  |  Height:  |  Size: 293 KiB

+12 -12
View File
@@ -1,7 +1,7 @@
{
"version": 1,
"fixture": "synthetic-only",
"sourceFingerprint": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceFingerprint": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"captureScriptSha256": "34f2219790d46efd8250e7a1bd829cb8fc0b0547e1260635fefa52407551b41b",
"command": "npm run build && node demo/docs/capture.mjs",
"scenarios": {
@@ -13,7 +13,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "e2d31553c2541fd7f0725db348e3d0210867d4e2489532372270820bc0050794"
},
"view-touch": {
@@ -24,7 +24,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "c4d5bd72e177b45737dbf1c3b09f52a31bb0c63829d8d652655cfb54f154c2ff"
},
"space-create": {
@@ -35,7 +35,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "c53db2e5c642a5549c13f3c93a5b359fed69bdb2621bf71a243a877ffcb95e6b"
},
"room-contour-close": {
@@ -46,7 +46,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "2f13ea645af306eee9cc7c52699c928377b72f412b08c1a3db6beb848ace1b51"
},
"plan-context-tray": {
@@ -57,7 +57,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "a6c526fede11bc3503fd2384bd4a3f6afa008f481c5c47578f06cae6c81c6f9b"
},
"device-editor": {
@@ -68,8 +68,8 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"imageSha256": "89e6d6d3e8a83210361cf52c0893a129d00da3e1643e4fb8b9aa500966c423d1"
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "189287256dae5721cc8fac76b82180f1eba36281434032824aa616426fcad6d7"
},
"device-display-preview": {
"file": "06-device-display-preview.png",
@@ -79,7 +79,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "112afb49df2f4398e5b3de29c21fd26af02fba007649e810786c97b3da42a0fd"
},
"background-editor": {
@@ -90,7 +90,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "d7cfe70551d9260169df8efd832e32ed7df99c7f60b55d1fd4a8322bd4c47175"
},
"room-card": {
@@ -101,7 +101,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "e7e3f0609a5dfa117e366b0388bd2d5286865110fd5798c02ffa752b2c285f95"
},
"device-info": {
@@ -112,7 +112,7 @@
},
"theme": "dark",
"language": "en",
"sourceSha256": "7d6adc1d53085de165a034ae36d008b964889ea4ab512961992d40f4d7ad8b30",
"sourceSha256": "c80008b7bfa2031d1b7f7931429102e39c8267c144c34d948a617b96dba5f40e",
"imageSha256": "b61541f0f53db632c99bf082d875ec1f84f77b534147b769e382ca54d8fe5c3e"
}
}
+8
View File
@@ -482,6 +482,14 @@ test('device dialog goldens expose the complete light-source controls at desktop
'the harness must activate the declared light-controls scenario flag');
});
test('golden harness neutralizes the shared pointer before every scenario', () => {
const harness = readFileSync(new URL('../demo/golden/harness.mjs', import.meta.url), 'utf8');
const reset = harness.indexOf('await page.mouse.move(0, 0);');
const fixture = harness.indexOf('const fixture = prepareGoldenFixture(scenario);', reset);
assert.equal(reset >= 0, true, 'the shared Playwright pointer must be reset');
assert.equal(fixture > reset, true, 'pointer reset must happen before fixture adoption');
});
test('toggle-entity dialog goldens cover selected and stale states across themes and widths', () => {
const dialogs = GOLDEN_SCENARIOS.filter((scenario) =>
scenario.id.startsWith('toggle-entity-dialog-'));