@@ -10,8 +10,6 @@ import {
10
10
import { getElementScreenshotWithPadding } from './utils' ;
11
11
import os from 'os' ;
12
12
13
- const MAX_DIFF_PIXEL_RATIO = 0.011 ;
14
-
15
13
test . describe ( 'WebHelp page appearance' , async ( ) => {
16
14
test . beforeEach ( async ( { page } ) => {
17
15
const webHelpPage = new WebHelpPage ( page , '/docs/test-page.html' ) ;
@@ -102,10 +100,7 @@ test.describe('WebHelp page appearance', async () => {
102
100
test ( `Should render layout of the article properly on ${ resolutionName } ` , async ( { page } ) => {
103
101
await page . setViewportSize ( resolution ) ;
104
102
const screenshot = await page . screenshot ( { fullPage : true } ) ;
105
- expect ( screenshot ) . toMatchSnapshot ( {
106
- name : `layout_${ resolutionName } .png` ,
107
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
108
- } ) ;
103
+ expect ( screenshot ) . toMatchSnapshot ( `layout_${ resolutionName } .png` ) ;
109
104
} ) ;
110
105
111
106
test ( `Should render micro format properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -162,32 +157,23 @@ test.describe('WebHelp page appearance', async () => {
162
157
await page . setViewportSize ( resolution ) ;
163
158
const codeBlock = page . locator ( testSelector ( 'code-block' ) ) . filter ( { hasText : 'MessageService' } ) . first ( ) ;
164
159
const screenshot = await codeBlock . screenshot ( ) ;
165
- expect ( screenshot ) . toMatchSnapshot ( {
166
- name : `code-block_${ resolutionName } .png` ,
167
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
168
- } ) ;
160
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_${ resolutionName } .png` ) ;
169
161
} ) ;
170
162
171
163
test ( `Should render hovered codeblock properly on ${ resolutionName } ` , async ( { page } ) => {
172
164
await page . setViewportSize ( resolution ) ;
173
165
const codeBlock = page . locator ( testSelector ( 'code-block' ) ) . filter ( { hasText : 'MessageService' } ) . first ( ) ;
174
166
await codeBlock . hover ( ) ;
175
167
const screenshot = await codeBlock . screenshot ( ) ;
176
- expect ( screenshot ) . toMatchSnapshot ( {
177
- name : `code-block_hovered_${ resolutionName } .png` ,
178
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
179
- } ) ;
168
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_hovered_${ resolutionName } .png` ) ;
180
169
} ) ;
181
170
182
171
test ( `Should render expandable codeblock properly on ${ resolutionName } ` , async ( { page } ) => {
183
172
await page . setViewportSize ( resolution ) ;
184
173
const codeBlock = page . locator ( testSelector ( 'code-collapse' ) ) . filter ( { hasText : 'package' } ) . first ( ) ;
185
174
const codeBlockElement = await codeBlock . elementHandle ( ) ;
186
175
const screenshot = await getElementScreenshotWithPadding ( page , codeBlockElement , ELEMENT_PADDING_OFFSET ) ;
187
- expect ( screenshot ) . toMatchSnapshot ( {
188
- name : `code-block_expandable_${ resolutionName } .png` ,
189
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
190
- } ) ;
176
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_expandable_${ resolutionName } .png` ) ;
191
177
} ) ;
192
178
193
179
test ( `Should render expandable codeblock when expanded properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -197,10 +183,7 @@ test.describe('WebHelp page appearance', async () => {
197
183
await page . waitForTimeout ( MICRO_ANIMATION_TIMEOUT_LONG ) ;
198
184
const codeBlockElement = await codeBlock . elementHandle ( ) ;
199
185
const screenshot = await getElementScreenshotWithPadding ( page , codeBlockElement , ELEMENT_PADDING_OFFSET ) ;
200
- expect ( screenshot ) . toMatchSnapshot ( {
201
- name : `code-block_expandable_expanded_${ resolutionName } .png` ,
202
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
203
- } ) ;
186
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_expandable_expanded_${ resolutionName } .png` ) ;
204
187
} ) ;
205
188
206
189
test ( `Should render collapsed codeblock properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -213,10 +196,7 @@ test.describe('WebHelp page appearance', async () => {
213
196
await page . waitForTimeout ( MICRO_ANIMATION_TIMEOUT_LONG ) ;
214
197
const codeBlockElement = await codeBlock . elementHandle ( ) ;
215
198
const screenshot = await getElementScreenshotWithPadding ( page , codeBlockElement , ELEMENT_PADDING_OFFSET ) ;
216
- expect ( screenshot ) . toMatchSnapshot ( {
217
- name : `code-block_expandable_${ resolutionName } .png` ,
218
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
219
- } ) ;
199
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_expandable_${ resolutionName } .png` ) ;
220
200
} ) ;
221
201
222
202
test ( `Should render playground properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -271,10 +251,7 @@ test.describe('WebHelp page appearance', async () => {
271
251
await page . setViewportSize ( resolution ) ;
272
252
const element = page . locator ( 'div.table' ) . filter ( { hasText : 'Dependencies' } ) . first ( ) ;
273
253
const screenshot = await element . screenshot ( ) ;
274
- expect ( screenshot ) . toMatchSnapshot ( {
275
- name : `table_complex_codeblocks_${ resolutionName } .png` ,
276
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
277
- } ) ;
254
+ expect ( screenshot ) . toMatchSnapshot ( `table_complex_codeblocks_${ resolutionName } .png` ) ;
278
255
} ) ;
279
256
280
257
test ( `Should render ordered list properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -339,10 +316,7 @@ test.describe('WebHelp page appearance', async () => {
339
316
await page . locator ( 'dt' ) . first ( ) . click ( ) ;
340
317
await page . waitForTimeout ( MICRO_ANIMATION_TIMEOUT ) ;
341
318
const screenshot = await getElementScreenshotWithPadding ( page , element , ELEMENT_PADDING_OFFSET ) ;
342
- expect ( screenshot ) . toMatchSnapshot ( {
343
- name : `definition-list_expanded_${ resolutionName } .png` ,
344
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
345
- } ) ;
319
+ expect ( screenshot ) . toMatchSnapshot ( `definition-list_expanded_${ resolutionName } .png` ) ;
346
320
} ) ;
347
321
348
322
test ( `Should render markdown image properly on ${ resolutionName } ` , async ( { page } ) => {
0 commit comments