Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/browser/src/client/orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export class IframeOrchestrator {
iframe.style.setProperty('border', 'none')
iframe.style.setProperty('background-color', '#fff')
iframe.style.setProperty('width', 'var(--viewport-width)')
iframe.style.setProperty('height', 'var(--viewport-height)')
iframe.style.setProperty('height', 'var(--inner-height, var(--viewport-height))')

// enable scaling only when using the UI, without UI the iframe fills the page
if (config.browser.ui) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export default async function toMatchScreenshot(
: `${this.currentTestName} ${counter.current}`

const isPageTarget = isBrowserPage(actual)
const isFullPage = isPageTarget && options.screenshotOptions && 'fullPage' in options.screenshotOptions && options.screenshotOptions.fullPage

if (isFullPage && window.frameElement) {
(window.frameElement as HTMLIFrameElement).style.setProperty('--inner-height', `${document.documentElement.scrollHeight}px`)
}

const [element, ...mask] = await Promise.all([
isPageTarget ? undefined : serializeElement(actual, options),
Expand Down Expand Up @@ -75,6 +80,10 @@ export default async function toMatchScreenshot(
] satisfies ScreenshotMatcherArguments,
)

if (isFullPage && window.frameElement) {
(window.frameElement as HTMLIFrameElement).style.removeProperty('--inner-height')
}

if (result.pass === false) {
const attachments: VisualRegressionArtifact['attachments'] = []

Expand Down
Loading