Skip to content

Commit 63b31e0

Browse files
committed
chore(test): don't zoom iframe before taking screenshots
1 parent d297f3f commit 63b31e0

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

packages/vuetify/test/templates/generateStories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ export const generate = ({ props, stories, component }: GenerateConfiguration) =
112112
}
113113

114114
return it('renders everything', async () => {
115-
await page.viewport(1280, 825)
116-
117115
render(() => (
118116
<>
119117
{ exampleStories && (
@@ -138,8 +136,10 @@ export const generate = ({ props, stories, component }: GenerateConfiguration) =
138136
suite = suite.suite
139137
}
140138

139+
await page.viewport(1280, document.body.scrollHeight)
141140
await commands.percySnapshot(name.trim())
142141
await page.screenshot()
142+
await page.viewport(1280, 800)
143143
})
144144
}
145145

patches/@vitest__browser.patch

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/dist/client/__vitest_browser__/orchestrator-8U3FyXSU.js b/dist/client/__vitest_browser__/orchestrator-8U3FyXSU.js
2+
index a22a3b0d0e13e08a34bce430bc284d998de8528b..00c0722cb008a9a6d527ecfd50844d92f2674a60 100644
3+
--- a/dist/client/__vitest_browser__/orchestrator-8U3FyXSU.js
4+
+++ b/dist/client/__vitest_browser__/orchestrator-8U3FyXSU.js
5+
@@ -290,18 +290,9 @@ async function setIframeViewport(iframe, width, height) {
6+
[{ width, height }]
7+
);
8+
} else {
9+
- const scale = Math.min(
10+
- 1,
11+
- iframe.parentElement.parentElement.clientWidth / width,
12+
- iframe.parentElement.parentElement.clientHeight / height
13+
- );
14+
- iframe.parentElement.style.cssText = `
15+
- width: ${width}px;
16+
- height: ${height}px;
17+
- transform: scale(${scale});
18+
- transform-origin: left top;
19+
- `;
20+
- (_b = iframe.parentElement) == null ? void 0 : _b.setAttribute("data-scale", String(scale));
21+
+ iframe.style.width = `${width}px`
22+
+ iframe.style.height = `${height}px`
23+
+ iframe.parentElement?.setAttribute('data-scale', '1')
24+
await new Promise((r) => requestAnimationFrame(r));
25+
}
26+
}

pnpm-lock.yaml

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ overrides:
3939
patchedDependencies:
4040
4141
'@testing-library/vue': patches/@testing-library__vue.patch
42+
'@vitest/browser': patches/@vitest__browser.patch
4243
playwright-core: patches/playwright-core.patch
4344

4445
peerDependencyRules:

0 commit comments

Comments
 (0)