test(ui): sample loading skeleton geometry in one frame

This commit is contained in:
Peter Steinberger 2026-09-29 14:33:36 -07:00
parent 71ef1c5d54
commit 531f0a229c
No known key found for this signature in database

View file

@ -310,9 +310,23 @@ describeControlUiE2e("Control UI initial connect splash E2E", () => {
for (const size of [viewport, { width: 1440, height: 1440 }, { width: 390, height: 844 }]) {
await page.setViewportSize(size);
const content = await page.locator(".content--chat").boundingBox();
const header = await skeleton.locator(".loading-skeleton__header").boundingBox();
const composer = await skeleton.locator(".loading-skeleton__composer").boundingBox();
// The shell viewport owner can commit a resize between separate browser calls.
const { content, header, composer } = await page
.locator(".content--chat")
.evaluate((root) => {
const bounds = (element: Element | null) => {
if (!element?.checkVisibility({ visibilityProperty: true })) {
return null;
}
const { x, y, width, height } = element.getBoundingClientRect();
return width > 0 && height > 0 ? { x, y, width, height } : null;
};
return {
content: bounds(root),
header: bounds(root.querySelector(".loading-skeleton__header")),
composer: bounds(root.querySelector(".loading-skeleton__composer")),
};
});
expect(content).not.toBeNull();
expect(header).not.toBeNull();
expect(composer).not.toBeNull();