You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #272, raised by the maintainer: removing the implicit wait fixed a measured 44% of a suite, but that wait was doing a second job by accident.
The risk the fix created
A skip_area mask is only correct if the element exists when the mask is computed. Capybara's minimum: 1 default meant a not-yet-present element got up to 5s to appear. With minimum: 0, a lazy-loaded image that has not arrived yields an empty mask — nothing is excluded, the unstable region is compared, and the test flakes.
At risk: lazy-loaded images below the fold (skip_area: ["article img"]), JS-injected widgets and embeds, anything behind an unresolved fetch. Not at risk: elements already in the DOM, which resolved in ~0.008s before and after.
The trade is still right — the cost was certain and large, the risk is narrow and addressable — but it is real, and right now it fails silently.
What a real consumer already does
defpreload_all_imagesscroll_to:bottomassert_text"JetThoughts. All Rights Reserved",exact: falsescroll_to:topend
called on the line before the screenshot, plus document.fonts.ready in their wrapper. This works today and needs nothing from us.
Considered and rejected: a before_capture block
assert_matches_screenshot("x") { preload_all_images } is functionally identical to calling the method on the previous line — the work happens once before capture either way. It adds API surface and buys nothing.
Worth revisiting only if a case appears that must run inside the stability retry loop, which is the one thing a block could do that a preceding line cannot. No such case is known.
What to build instead
Document that skip_area masks what exists at assertion time, with the working pattern for late-loading content (scroll-to-settle, assert_selector, document.fonts.ready). This alone covers the common case.
Follow-up to #272, raised by the maintainer: removing the implicit wait fixed a measured 44% of a suite, but that wait was doing a second job by accident.
The risk the fix created
A
skip_areamask is only correct if the element exists when the mask is computed. Capybara'sminimum: 1default meant a not-yet-present element got up to 5s to appear. Withminimum: 0, a lazy-loaded image that has not arrived yields an empty mask — nothing is excluded, the unstable region is compared, and the test flakes.At risk: lazy-loaded images below the fold (
skip_area: ["article img"]), JS-injected widgets and embeds, anything behind an unresolved fetch. Not at risk: elements already in the DOM, which resolved in ~0.008s before and after.The trade is still right — the cost was certain and large, the risk is narrow and addressable — but it is real, and right now it fails silently.
What a real consumer already does
called on the line before the screenshot, plus
document.fonts.readyin their wrapper. This works today and needs nothing from us.Considered and rejected: a
before_captureblockassert_matches_screenshot("x") { preload_all_images }is functionally identical to calling the method on the previous line — the work happens once before capture either way. It adds API surface and buys nothing.Worth revisiting only if a case appears that must run inside the stability retry loop, which is the one thing a block could do that a preceding line cannot. No such case is known.
What to build instead
skip_areamasks what exists at assertion time, with the working pattern for late-loading content (scroll-to-settle,assert_selector,document.fonts.ready). This alone covers the common case.Decision recorded at
.okf/decisions/skip-area-element-readiness.mdwith the options weighed.