Skip to content

Commit fc3e438

Browse files
committed
revert: revert clipping Jest snapshots due to OS-level screenshot differences
1 parent 670df4d commit fc3e438

4 files changed

+10
-30
lines changed
Loading
Loading
Loading

packages/components/bolt-blockquote/__tests__/blockquote.js

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,11 @@ const schema = readYamlFileSync(join(__dirname, '../blockquote.schema.yml'));
1212
const { tag } = schema.properties;
1313

1414
const vrtDefaultConfig = Object.assign(vrtConfig, {
15-
failureThreshold: '0.01',
15+
failureThreshold: '0.02',
1616
});
1717

1818
const timeout = 90000;
1919

20-
async function clipScreenshot(boundingBox, page) {
21-
return {
22-
clip: {
23-
x: boundingBox.x,
24-
y: boundingBox.y,
25-
width: Math.min(boundingBox.width, await page.viewport().width),
26-
height: Math.min(boundingBox.height, await page.viewport().height),
27-
},
28-
};
29-
}
30-
3120
describe('button', () => {
3221
let page, context;
3322

@@ -73,8 +62,8 @@ describe('button', () => {
7362
blockquote.innerHTML = `
7463
<p>Java is to JavaScript what Car is to Carpet.</p>
7564
`;
76-
document.getElementById('root').appendChild(blockquote);
77-
document.getElementById('root').classList.add('u-bolt-padding-medium');
65+
document.body.appendChild(blockquote);
66+
document.body.classList.add('u-bolt-padding-medium');
7867
blockquote.updated();
7968
return blockquote.outerHTML;
8069
});
@@ -96,10 +85,7 @@ describe('button', () => {
9685

9786
const renderedHTML = await html(defaultBlockquoteOuter);
9887

99-
const root = await page.$('#root');
100-
const image = await page.screenshot(
101-
await clipScreenshot(await root.boundingBox(), page),
102-
);
88+
const image = await page.screenshot();
10389

10490
expect(image).toMatchImageSnapshot(vrtDefaultConfig);
10591

@@ -120,8 +106,8 @@ describe('button', () => {
120106
<p>Bolt Blockquote w/ Shadow DOM Manually Disabled</p>
121107
<p>Press any key to continue or any other key to quit.</p>
122108
`;
123-
document.getElementById('root').appendChild(blockquote);
124-
document.getElementById('root').classList.add('u-bolt-padding-medium');
109+
document.body.appendChild(blockquote);
110+
document.body.classList.add('u-bolt-padding-medium');
125111
blockquote.useShadow = false;
126112
blockquote.updated();
127113
return blockquote.outerHTML;
@@ -150,10 +136,7 @@ describe('button', () => {
150136
);
151137
});
152138

153-
const root = await page.$('#root');
154-
const image = await page.screenshot(
155-
await clipScreenshot(await root.boundingBox(), page),
156-
);
139+
const image = await page.screenshot();
157140

158141
expect(image).toMatchImageSnapshot(vrtDefaultConfig);
159142

@@ -173,8 +156,8 @@ describe('button', () => {
173156
<p>Bolt Blockquote w/ Shadow DOM auto-disabled</p>
174157
<p>Yeah, but it works on my machine...</p>
175158
`;
176-
document.getElementById('root').appendChild(form);
177-
document.getElementById('root').classList.add('u-bolt-padding-medium');
159+
document.body.appendChild(form);
160+
document.body.classList.add('u-bolt-padding-medium');
178161
form.appendChild(blockquote);
179162
blockquote.updated();
180163
return blockquote.innerHTML;
@@ -196,10 +179,7 @@ describe('button', () => {
196179
});
197180

198181
const renderedHTML = await html(renderedBlockquoteHTML);
199-
const root = await page.$('#root');
200-
const image = await page.screenshot(
201-
await clipScreenshot(await root.boundingBox(), page),
202-
);
182+
const image = await page.screenshot();
203183

204184
expect(image).toMatchImageSnapshot(vrtDefaultConfig);
205185

0 commit comments

Comments
 (0)