test(e2e): chat-dock-layout uses the v2 stored layout shape (#1964)
This commit is contained in:
2 files changed
+8
-8
No files matched your search
@@ -1,4 +1,4 @@
|
||||
// The saved dock layout: a stored side and width are honoured, widths outside
|
||||
// The saved dock layout: a stored mode and width are honoured, widths outside
|
||||
// the allowed range are clamped, unreadable JSON falls back to a usable
|
||||
// floating dock that saves again, and visiting phone width never overwrites
|
||||
// the desktop choice.
|
||||
@@ -9,18 +9,18 @@ module.exports = async ({ page, go, shot, tolerate }) => {
|
||||
tolerate(/JSON|SyntaxError/);
|
||||
const dock = h.dockOf(page);
|
||||
|
||||
await h.load(page, go, JSON.stringify({ side: 'left', width: 500 }));
|
||||
await h.load(page, go, JSON.stringify({ mode: 'left', w: 500 }));
|
||||
await h.expand(page);
|
||||
let box = await dock.boundingBox();
|
||||
h.near(box.x, 0, 'saved left side');
|
||||
h.near(box.x, 0, 'saved left pin');
|
||||
h.near(box.width, 500, 'saved width');
|
||||
assert.ok((await h.mainRect(page)).x >= 499, 'page did not reflow beside the restored dock');
|
||||
|
||||
await h.load(page, go, JSON.stringify({ side: 'right', width: -4 }));
|
||||
await h.load(page, go, JSON.stringify({ mode: 'right', w: -4 }));
|
||||
await h.expand(page);
|
||||
h.near((await dock.boundingBox()).width, 320, 'a negative width clamps to the minimum');
|
||||
|
||||
await h.load(page, go, JSON.stringify({ side: 'right', width: 9999 }));
|
||||
await h.load(page, go, JSON.stringify({ mode: 'right', w: 9999 }));
|
||||
await h.expand(page);
|
||||
h.near((await dock.boundingBox()).width, 720, 'a huge width clamps to the maximum');
|
||||
|
||||
@@ -31,10 +31,10 @@ module.exports = async ({ page, go, shot, tolerate }) => {
|
||||
await h.composerOf(page).fill('still usable');
|
||||
await h.dragTo(page, 1430);
|
||||
await page.mouse.up();
|
||||
await h.until(async () => (await h.saved(page)).side === 'right', 'the dock did not save a layout over the unreadable one');
|
||||
await h.until(async () => (await h.saved(page)).mode === 'right', 'the dock did not save a layout over the unreadable one');
|
||||
await shot('recovered');
|
||||
|
||||
await h.load(page, go, JSON.stringify({ side: 'left', width: 460 }));
|
||||
await h.load(page, go, JSON.stringify({ mode: 'left', w: 460 }));
|
||||
const layout = await h.stored(page);
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await h.expand(page);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// landmarks, and the pointer gestures that pin it.
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const KEY = 'archie.chat.dock';
|
||||
const KEY = 'archie.chat.dock.v2';
|
||||
|
||||
const dockOf = (page) => page.getByRole('complementary', { name: 'Chat with Archie' });
|
||||
const composerOf = (page) => page.getByRole('combobox', { name: 'Message Archie', exact: true });
|
||||
|
||||
Reference in new issue
Block a user