@@ -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' ) ;
@@ -108,10 +106,7 @@ test.describe('WebHelp page appearance', async () => {
108
106
test ( `Should render layout of the article properly on ${ resolutionName } ` , async ( { page } ) => {
109
107
await page . setViewportSize ( resolution ) ;
110
108
const screenshot = await page . screenshot ( { fullPage : true } ) ;
111
- expect ( screenshot ) . toMatchSnapshot ( {
112
- name : `layout_${ resolutionName } .png` ,
113
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
114
- } ) ;
109
+ expect ( screenshot ) . toMatchSnapshot ( `layout_${ resolutionName } .png` ) ;
115
110
} ) ;
116
111
117
112
test ( `Should render micro format properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -168,32 +163,23 @@ test.describe('WebHelp page appearance', async () => {
168
163
await page . setViewportSize ( resolution ) ;
169
164
const codeBlock = page . locator ( testSelector ( 'code-block' ) ) . filter ( { hasText : 'MessageService' } ) . first ( ) ;
170
165
const screenshot = await codeBlock . screenshot ( ) ;
171
- expect ( screenshot ) . toMatchSnapshot ( {
172
- name : `code-block_${ resolutionName } .png` ,
173
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
174
- } ) ;
166
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_${ resolutionName } .png` ) ;
175
167
} ) ;
176
168
177
169
test ( `Should render hovered codeblock properly on ${ resolutionName } ` , async ( { page } ) => {
178
170
await page . setViewportSize ( resolution ) ;
179
171
const codeBlock = page . locator ( testSelector ( 'code-block' ) ) . filter ( { hasText : 'MessageService' } ) . first ( ) ;
180
172
await codeBlock . hover ( ) ;
181
173
const screenshot = await codeBlock . screenshot ( ) ;
182
- expect ( screenshot ) . toMatchSnapshot ( {
183
- name : `code-block_hovered_${ resolutionName } .png` ,
184
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
185
- } ) ;
174
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_hovered_${ resolutionName } .png` ) ;
186
175
} ) ;
187
176
188
177
test ( `Should render expandable codeblock properly on ${ resolutionName } ` , async ( { page } ) => {
189
178
await page . setViewportSize ( resolution ) ;
190
179
const codeBlock = page . locator ( testSelector ( 'code-collapse' ) ) . filter ( { hasText : 'package' } ) . first ( ) ;
191
180
const codeBlockElement = await codeBlock . elementHandle ( ) ;
192
181
const screenshot = await getElementScreenshotWithPadding ( page , codeBlockElement , ELEMENT_PADDING_OFFSET ) ;
193
- expect ( screenshot ) . toMatchSnapshot ( {
194
- name : `code-block_expandable_${ resolutionName } .png` ,
195
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
196
- } ) ;
182
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_expandable_${ resolutionName } .png` ) ;
197
183
} ) ;
198
184
199
185
test ( `Should render expandable codeblock when expanded properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -203,10 +189,7 @@ test.describe('WebHelp page appearance', async () => {
203
189
await page . waitForTimeout ( MICRO_ANIMATION_TIMEOUT_LONG ) ;
204
190
const codeBlockElement = await codeBlock . elementHandle ( ) ;
205
191
const screenshot = await getElementScreenshotWithPadding ( page , codeBlockElement , ELEMENT_PADDING_OFFSET ) ;
206
- expect ( screenshot ) . toMatchSnapshot ( {
207
- name : `code-block_expandable_expanded_${ resolutionName } .png` ,
208
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
209
- } ) ;
192
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_expandable_expanded_${ resolutionName } .png` ) ;
210
193
} ) ;
211
194
212
195
test ( `Should render collapsed codeblock properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -219,10 +202,7 @@ test.describe('WebHelp page appearance', async () => {
219
202
await page . waitForTimeout ( MICRO_ANIMATION_TIMEOUT_LONG ) ;
220
203
const codeBlockElement = await codeBlock . elementHandle ( ) ;
221
204
const screenshot = await getElementScreenshotWithPadding ( page , codeBlockElement , ELEMENT_PADDING_OFFSET ) ;
222
- expect ( screenshot ) . toMatchSnapshot ( {
223
- name : `code-block_expandable_${ resolutionName } .png` ,
224
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
225
- } ) ;
205
+ expect ( screenshot ) . toMatchSnapshot ( `code-block_expandable_${ resolutionName } .png` ) ;
226
206
} ) ;
227
207
228
208
test ( `Should render playground properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -277,10 +257,7 @@ test.describe('WebHelp page appearance', async () => {
277
257
await page . setViewportSize ( resolution ) ;
278
258
const element = page . locator ( 'div.table' ) . filter ( { hasText : 'Dependencies' } ) . first ( ) ;
279
259
const screenshot = await element . screenshot ( ) ;
280
- expect ( screenshot ) . toMatchSnapshot ( {
281
- name : `table_complex_codeblocks_${ resolutionName } .png` ,
282
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
283
- } ) ;
260
+ expect ( screenshot ) . toMatchSnapshot ( `table_complex_codeblocks_${ resolutionName } .png` ) ;
284
261
} ) ;
285
262
286
263
test ( `Should render ordered list properly on ${ resolutionName } ` , async ( { page } ) => {
@@ -345,10 +322,7 @@ test.describe('WebHelp page appearance', async () => {
345
322
await page . locator ( 'dt' ) . first ( ) . click ( ) ;
346
323
await page . waitForTimeout ( MICRO_ANIMATION_TIMEOUT ) ;
347
324
const screenshot = await getElementScreenshotWithPadding ( page , element , ELEMENT_PADDING_OFFSET ) ;
348
- expect ( screenshot ) . toMatchSnapshot ( {
349
- name : `definition-list_expanded_${ resolutionName } .png` ,
350
- maxDiffPixelRatio : MAX_DIFF_PIXEL_RATIO
351
- } ) ;
325
+ expect ( screenshot ) . toMatchSnapshot ( `definition-list_expanded_${ resolutionName } .png` ) ;
352
326
} ) ;
353
327
354
328
test ( `Should render markdown image properly on ${ resolutionName } ` , async ( { page } ) => {
0 commit comments