fix(tests): iteration 18
This commit is contained in:
@@ -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 expect(page.getByTestId("scroll-to-bottom-button")).toHaveCount(0);
|
||||||
|
|
||||||
await page.setViewportSize({ width: 820, height: 760 });
|
await page.setViewportSize({ width: 820, height: 760 });
|
||||||
|
await openWorkspaceAgentTab(page, agent.id);
|
||||||
|
await waitForAgentReady(page, agent.expectedTailText);
|
||||||
await expectNearBottom(page);
|
await expectNearBottom(page);
|
||||||
|
|
||||||
await scrollUpFromBottom(page, 720);
|
await scrollUpFromBottom(page, 720);
|
||||||
|
|||||||
@@ -171,14 +171,7 @@ function getVisibleChatScroll(page: Page) {
|
|||||||
|
|
||||||
export async function readScrollMetrics(page: Page): Promise<ScrollMetrics> {
|
export async function readScrollMetrics(page: Page): Promise<ScrollMetrics> {
|
||||||
return getVisibleChatScroll(page).evaluate((root: Element) => {
|
return getVisibleChatScroll(page).evaluate((root: Element) => {
|
||||||
const rootElement = root as HTMLElement;
|
const scrollElement = 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 offsetY = Math.max(0, scrollElement.scrollTop);
|
const offsetY = Math.max(0, scrollElement.scrollTop);
|
||||||
const contentHeight = Math.max(0, scrollElement.scrollHeight);
|
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 expect(scrollViewport).toHaveCount(1, { timeout: 30000 });
|
||||||
await scrollViewport.evaluate(
|
await scrollViewport.evaluate(
|
||||||
(root: Element, amount: number) => {
|
(root: Element, amount: number) => {
|
||||||
const rootElement = root as HTMLElement;
|
const scrollElement = 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 bottomOffset = Math.max(
|
const bottomOffset = Math.max(
|
||||||
0,
|
0,
|
||||||
|
|||||||
Reference in New Issue
Block a user