fix(tests): iteration 18

This commit is contained in:
Mohamed Boudra
2026-03-13 13:43:34 +07:00
parent e8b55eccab
commit 99bac0fd27
2 changed files with 4 additions and 16 deletions
@@ -121,6 +121,8 @@ test("sticky mode stays pinned through composer growth and viewport resize, but
await expect(page.getByTestId("scroll-to-bottom-button")).toHaveCount(0);
await page.setViewportSize({ width: 820, height: 760 });
await openWorkspaceAgentTab(page, agent.id);
await waitForAgentReady(page, agent.expectedTailText);
await expectNearBottom(page);
await scrollUpFromBottom(page, 720);
@@ -171,14 +171,7 @@ function getVisibleChatScroll(page: Page) {
export async function readScrollMetrics(page: Page): Promise<ScrollMetrics> {
return getVisibleChatScroll(page).evaluate((root: Element) => {
const rootElement = root as HTMLElement;
const candidates = [rootElement, ...Array.from(rootElement.querySelectorAll("*"))];
const scrollElement =
candidates.find(
(element) =>
element instanceof HTMLElement &&
element.scrollHeight - element.clientHeight > 1
) ?? rootElement;
const scrollElement = root as HTMLElement;
const offsetY = Math.max(0, scrollElement.scrollTop);
const contentHeight = Math.max(0, scrollElement.scrollHeight);
@@ -202,14 +195,7 @@ export async function scrollUpFromBottom(page: Page, pixels: number): Promise<vo
await expect(scrollViewport).toHaveCount(1, { timeout: 30000 });
await scrollViewport.evaluate(
(root: Element, amount: number) => {
const rootElement = root as HTMLElement;
const candidates = [rootElement, ...Array.from(rootElement.querySelectorAll("*"))];
const scrollElement =
candidates.find(
(element) =>
element instanceof HTMLElement &&
element.scrollHeight - element.clientHeight > 1
) ?? rootElement;
const scrollElement = root as HTMLElement;
const bottomOffset = Math.max(
0,