Skip to content

test(infinite-scroll): fix flaky top test in Safari - #31198

Open
darrenhalden537-lang wants to merge 2 commits into
ionic-team:mainfrom
darrenhalden537-lang:walletsec-ionic-30423-infinite-scroll-safari
Open

darrenhalden537-lang wants to merge 2 commits into
ionic-team:mainfrom
darrenhalden537-lang:walletsec-ionic-30423-infinite-scroll-safari

Conversation

@darrenhalden537-lang

@darrenhalden537-lang darrenhalden537-lang commented Jun 6, 2026 •

Copy link
Copy Markdown

Issue number: resolves #30423


What is the current behavior?

The infinite-scroll: top e2e test is skipped in WebKit because it fails intermittently on CI. With position="top", the infinite scroll moves the content to the bottom in a write task after it loads. If the test calls scrollToTop(0) before that write task runs, the content is already at the top. Nothing scrolls, so ionInfinite never fires and the test times out.

What is the new behavior?

  • Removes the WebKit skip from the top infinite scroll test.
  • Waits for the content to reach its initial scroll position before scrolling to the top, so the scroll always crosses the threshold and triggers the load.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Only the test changed. Component behavior is the same.

@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the package: core @ionic/core package label Jun 6, 2026
@darrenhalden537-lang
darrenhalden537-lang marked this pull request as ready for review June 6, 2026 08:00
@darrenhalden537-lang
darrenhalden537-lang requested a review from a team as a code owner June 6, 2026 08:00
@gnbm
gnbm requested review from ShaneK and removed request for BenOsodrac July 28, 2026 22:15
@brandyscarney brandyscarney reopened this Nov 18, 2026
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Nov 18, 2026 8:23pm UTC

Request Review

@brandyscarney brandyscarney changed the title test: stabilize top infinite scroll e2e test(infinite-scroll): fix flaky top test in Safari Nov 19, 2026
Comment on lines +14 to +25
/**
* Wait for the page to settle at its initial scroll
* position so scrolling to the top triggers the load.
*/
await expect
.poll(() =>
content.evaluate(async (el: HTMLIonContentElement) => {
const scrollEl = await el.getScrollElement();
return scrollEl.scrollTop;
})
)
.toBeGreaterThan(200);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 200 depends on the test page layout. The load triggers when scrollTop drops below the infinite scroll's height (84px min) plus threshold="100px", so 200 makes sure the content starts outside that zone. Without that in the comment, someone could change the threshold or the spinner and get a timeout that's hard to trace back here.

Suggested change
/**
* Wait for the page to settle at its initial scroll
* position so scrolling to the top triggers the load.
*/
await expect
.poll(() =>
content.evaluate(async (el: HTMLIonContentElement) => {
const scrollEl = await el.getScrollElement();
return scrollEl.scrollTop;
})
)
.toBeGreaterThan(200);
/**
* Wait for infinite scroll to move the content to the bottom
* on load. The scroll must start outside the trigger zone
* (infinite scroll height + 100px threshold) so that
* scrolling to the top fires ionInfinite.
*/
await expect
.poll(() =>
content.evaluate(async (el: HTMLIonContentElement) => {
const scrollEl = await el.getScrollElement();
return scrollEl.scrollTop;
})
)
.toBeGreaterThan(200);

This branch was successfully deployed

1 active deployment
Preview — 85a11fb7 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Infinite scroll - scrolling to the top test is flaky on CI with Safari

3 participants