@wordpress/e2e-tests 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/jest.config.js +4 -0
- package/package.json +7 -7
- package/specs/editor/blocks/pullquote.test.js +3 -3
- package/specs/editor/plugins/__snapshots__/align-hook.test.js.snap +11 -11
- package/specs/editor/plugins/__snapshots__/container-blocks.test.js.snap +14 -14
- package/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +29 -29
- package/specs/editor/plugins/__snapshots__/iframed-inline-styles.test.js.snap +1 -1
- package/specs/editor/plugins/__snapshots__/iframed-masonry-block.test.js.snap +1 -1
- package/specs/editor/plugins/__snapshots__/inner-blocks-render-appender.test.js.snap +5 -5
- package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +2 -2
- package/specs/editor/various/__snapshots__/adding-patterns.test.js.snap +4 -4
- package/specs/editor/various/__snapshots__/block-grouping.test.js.snap +21 -21
- package/specs/editor/various/__snapshots__/block-hierarchy-navigation.test.js.snap +12 -12
- package/specs/editor/various/__snapshots__/embedding.test.js.snap +19 -19
- package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +8 -8
- package/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +11 -11
- package/specs/editor/various/__snapshots__/links.test.js.snap +9 -9
- package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +17 -17
- package/specs/editor/various/__snapshots__/rich-text.test.js.snap +5 -5
- package/specs/editor/various/block-grouping.test.js +3 -3
- package/specs/editor/various/format-library/__snapshots__/text-color.test.js.snap +1 -1
- package/specs/editor/various/links.test.js +7 -7
- package/specs/editor/various/multi-block-selection.test.js +2 -2
- package/specs/performance/front-end-block-theme.test.js +13 -24
- package/specs/performance/front-end-classic-theme.test.js +13 -24
- package/specs/performance/post-editor.test.js +14 -12
- package/specs/performance/site-editor.test.js +1 -2
- package/specs/performance/utils.js +12 -1
- package/specs/site-editor/multi-entity-saving.test.js +0 -2
- package/specs/site-editor/settings-sidebar.test.js +0 -1
- package/specs/widgets/editing-widgets.test.js +20 -15
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +0 -47
- package/specs/editor/blocks/navigation.test.js +0 -1723
- package/specs/editor/various/__snapshots__/block-deletion.test.js.snap +0 -111
- package/specs/editor/various/__snapshots__/list-view.test.js.snap +0 -15
- package/specs/editor/various/block-deletion.test.js +0 -209
- package/specs/editor/various/list-view.test.js +0 -414
- package/specs/editor/various/switch-to-draft.test.js +0 -254
@@ -13,6 +13,7 @@ describe( 'Front End Performance', () => {
|
|
13
13
|
const results = {
|
14
14
|
timeToFirstByte: [],
|
15
15
|
largestContentfulPaint: [],
|
16
|
+
lcpMinusTtfb: [],
|
16
17
|
};
|
17
18
|
|
18
19
|
beforeAll( async () => {
|
@@ -28,24 +29,7 @@ describe( 'Front End Performance', () => {
|
|
28
29
|
);
|
29
30
|
} );
|
30
31
|
|
31
|
-
it( '
|
32
|
-
// We derive the 75th percentile of the TTFB based on these results.
|
33
|
-
// By running it 16 times, the percentile value would be (75/100)*16=12,
|
34
|
-
// meaning that we discard the worst 4 values.
|
35
|
-
let i = 16;
|
36
|
-
while ( i-- ) {
|
37
|
-
await page.goto( createURL( '/' ) );
|
38
|
-
const navigationTimingJson = await page.evaluate( () =>
|
39
|
-
JSON.stringify( performance.getEntriesByType( 'navigation' ) )
|
40
|
-
);
|
41
|
-
const [ navigationTiming ] = JSON.parse( navigationTimingJson );
|
42
|
-
results.timeToFirstByte.push(
|
43
|
-
navigationTiming.responseStart - navigationTiming.startTime
|
44
|
-
);
|
45
|
-
}
|
46
|
-
} );
|
47
|
-
|
48
|
-
it( 'Largest Contentful Paint (LCP)', async () => {
|
32
|
+
it( 'Report TTFB, LCP, and LCP-TTFB', async () => {
|
49
33
|
// Based on https://addyosmani.com/blog/puppeteer-recipes/#performance-observer-lcp
|
50
34
|
function calcLCP() {
|
51
35
|
// By using -1 we know when it didn't record any event.
|
@@ -73,9 +57,6 @@ describe( 'Front End Performance', () => {
|
|
73
57
|
} );
|
74
58
|
}
|
75
59
|
|
76
|
-
// We derive the 75th percentile of the TTFB based on these results.
|
77
|
-
// By running it 16 times, the percentile value would be (75/100)*16=12,
|
78
|
-
// meaning that we discard the worst 4 values.
|
79
60
|
let i = 16;
|
80
61
|
while ( i-- ) {
|
81
62
|
await page.evaluateOnNewDocument( calcLCP );
|
@@ -84,10 +65,18 @@ describe( 'Front End Performance', () => {
|
|
84
65
|
// https://pptr.dev/api/puppeteer.page.goto#remarks
|
85
66
|
await page.goto( createURL( '/' ), { waitUntil: 'networkidle0' } );
|
86
67
|
|
87
|
-
const lcp = await page.evaluate(
|
88
|
-
|
89
|
-
|
68
|
+
const { lcp, ttfb } = await page.evaluate( () => {
|
69
|
+
const [ { responseStart, startTime } ] =
|
70
|
+
performance.getEntriesByType( 'navigation' );
|
71
|
+
return {
|
72
|
+
lcp: window.largestContentfulPaint,
|
73
|
+
ttfb: responseStart - startTime,
|
74
|
+
};
|
75
|
+
} );
|
76
|
+
|
90
77
|
results.largestContentfulPaint.push( lcp );
|
78
|
+
results.timeToFirstByte.push( ttfb );
|
79
|
+
results.lcpMinusTtfb.push( lcp - ttfb );
|
91
80
|
}
|
92
81
|
} );
|
93
82
|
} );
|
@@ -29,6 +29,7 @@ import {
|
|
29
29
|
getHoverEventDurations,
|
30
30
|
getSelectionEventDurations,
|
31
31
|
getLoadingDurations,
|
32
|
+
sum,
|
32
33
|
} from './utils';
|
33
34
|
|
34
35
|
jest.setTimeout( 1000000 );
|
@@ -235,22 +236,26 @@ describe( 'Post Editor Performance', () => {
|
|
235
236
|
it( 'Selecting blocks', async () => {
|
236
237
|
await load1000Paragraphs();
|
237
238
|
const paragraphs = await canvas().$$( '.wp-block' );
|
238
|
-
await page.tracing.start( {
|
239
|
-
path: traceFile,
|
240
|
-
screenshots: false,
|
241
|
-
categories: [ 'devtools.timeline' ],
|
242
|
-
} );
|
243
239
|
await paragraphs[ 0 ].click();
|
244
240
|
for ( let j = 1; j <= 10; j++ ) {
|
245
241
|
// Wait for the browser to be idle before starting the monitoring.
|
246
242
|
// eslint-disable-next-line no-restricted-syntax
|
247
243
|
await page.waitForTimeout( 1000 );
|
244
|
+
await page.tracing.start( {
|
245
|
+
path: traceFile,
|
246
|
+
screenshots: false,
|
247
|
+
categories: [ 'devtools.timeline' ],
|
248
|
+
} );
|
248
249
|
await paragraphs[ j ].click();
|
250
|
+
await page.tracing.stop();
|
251
|
+
traceResults = JSON.parse( readFile( traceFile ) );
|
252
|
+
const allDurations = getSelectionEventDurations( traceResults );
|
253
|
+
results.focus.push(
|
254
|
+
allDurations.reduce( ( acc, eventDurations ) => {
|
255
|
+
return acc + sum( eventDurations );
|
256
|
+
}, 0 )
|
257
|
+
);
|
249
258
|
}
|
250
|
-
await page.tracing.stop();
|
251
|
-
traceResults = JSON.parse( readFile( traceFile ) );
|
252
|
-
const [ focusEvents ] = getSelectionEventDurations( traceResults );
|
253
|
-
results.focus = focusEvents;
|
254
259
|
} );
|
255
260
|
|
256
261
|
it( 'Opening persistent list view', async () => {
|
@@ -292,9 +297,6 @@ describe( 'Post Editor Performance', () => {
|
|
292
297
|
} );
|
293
298
|
|
294
299
|
it( 'Searching the inserter', async () => {
|
295
|
-
function sum( arr ) {
|
296
|
-
return arr.reduce( ( a, b ) => a + b, 0 );
|
297
|
-
}
|
298
300
|
await load1000Paragraphs();
|
299
301
|
await openGlobalBlockInserter();
|
300
302
|
for ( let j = 0; j < 10; j++ ) {
|
@@ -90,7 +90,6 @@ describe( 'Site Editor Performance', () => {
|
|
90
90
|
await visitSiteEditor( {
|
91
91
|
postId: id,
|
92
92
|
postType: 'page',
|
93
|
-
path: '/navigation/single',
|
94
93
|
} );
|
95
94
|
} );
|
96
95
|
|
@@ -148,7 +147,7 @@ describe( 'Site Editor Performance', () => {
|
|
148
147
|
'[data-type="core/post-content"] [data-type="core/paragraph"]'
|
149
148
|
);
|
150
149
|
await enterEditMode();
|
151
|
-
await canvas().
|
150
|
+
await canvas().focus(
|
152
151
|
'[data-type="core/post-content"] [data-type="core/paragraph"]'
|
153
152
|
);
|
154
153
|
await insertBlock( 'Paragraph' );
|
@@ -41,6 +41,10 @@ function isFocusEvent( item ) {
|
|
41
41
|
return isEvent( item ) && item.args.data.type === 'focus';
|
42
42
|
}
|
43
43
|
|
44
|
+
function isFocusInEvent( item ) {
|
45
|
+
return isEvent( item ) && item.args.data.type === 'focusin';
|
46
|
+
}
|
47
|
+
|
44
48
|
function isClickEvent( item ) {
|
45
49
|
return isEvent( item ) && item.args.data.type === 'click';
|
46
50
|
}
|
@@ -68,7 +72,10 @@ export function getTypingEventDurations( trace ) {
|
|
68
72
|
}
|
69
73
|
|
70
74
|
export function getSelectionEventDurations( trace ) {
|
71
|
-
return [
|
75
|
+
return [
|
76
|
+
getEventDurationsForType( trace, isFocusEvent ),
|
77
|
+
getEventDurationsForType( trace, isFocusInEvent ),
|
78
|
+
];
|
72
79
|
}
|
73
80
|
|
74
81
|
export function getClickEventDurations( trace ) {
|
@@ -113,3 +120,7 @@ export async function getLoadingDurations() {
|
|
113
120
|
};
|
114
121
|
} );
|
115
122
|
}
|
123
|
+
|
124
|
+
export function sum( arr ) {
|
125
|
+
return arr.reduce( ( a, b ) => a + b, 0 );
|
126
|
+
}
|
@@ -265,7 +265,6 @@ describe( 'Multi-entity save flow', () => {
|
|
265
265
|
await visitSiteEditor( {
|
266
266
|
postId: 'emptytheme//index',
|
267
267
|
postType: 'wp_template',
|
268
|
-
path: '/templates/single',
|
269
268
|
} );
|
270
269
|
|
271
270
|
await enterEditMode();
|
@@ -305,7 +304,6 @@ describe( 'Multi-entity save flow', () => {
|
|
305
304
|
await visitSiteEditor( {
|
306
305
|
postId: 'emptytheme//index',
|
307
306
|
postType: 'wp_template',
|
308
|
-
path: '/templates/single',
|
309
307
|
} );
|
310
308
|
|
311
309
|
await enterEditMode();
|
@@ -384,6 +384,11 @@ describe( 'Widgets screen', () => {
|
|
384
384
|
|
385
385
|
describe( 'Function widgets', () => {
|
386
386
|
async function addMarquee( nbExpectedMarquees ) {
|
387
|
+
const [ firstWidgetArea ] = await findAll( {
|
388
|
+
role: 'document',
|
389
|
+
name: 'Block: Widget Area',
|
390
|
+
} );
|
391
|
+
await firstWidgetArea.focus();
|
387
392
|
const marqueeBlock = await getBlockInGlobalInserter(
|
388
393
|
'Marquee Greeting'
|
389
394
|
);
|
@@ -463,19 +468,19 @@ describe( 'Widgets screen', () => {
|
|
463
468
|
await saveWidgets();
|
464
469
|
let editedSerializedWidgetAreas = await getSerializedWidgetAreas();
|
465
470
|
await expect( editedSerializedWidgetAreas ).toMatchInlineSnapshot( `
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
471
|
+
{
|
472
|
+
"sidebar-1": "<marquee>Howdy</marquee>",
|
473
|
+
}
|
474
|
+
` );
|
470
475
|
|
471
476
|
await page.reload();
|
472
477
|
|
473
478
|
editedSerializedWidgetAreas = await getSerializedWidgetAreas();
|
474
479
|
await expect( editedSerializedWidgetAreas ).toMatchInlineSnapshot( `
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
480
|
+
{
|
481
|
+
"sidebar-1": "<marquee>Howdy</marquee>",
|
482
|
+
}
|
483
|
+
` );
|
479
484
|
|
480
485
|
await addMarquee( 2 );
|
481
486
|
|
@@ -493,10 +498,10 @@ describe( 'Widgets screen', () => {
|
|
493
498
|
await saveWidgets();
|
494
499
|
editedSerializedWidgetAreas = await getSerializedWidgetAreas();
|
495
500
|
await expect( editedSerializedWidgetAreas ).toMatchInlineSnapshot( `
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
501
|
+
{
|
502
|
+
"sidebar-1": "<marquee>Howdy</marquee>",
|
503
|
+
}
|
504
|
+
` );
|
500
505
|
|
501
506
|
await page.reload();
|
502
507
|
const marqueesAfter = await findAll( {
|
@@ -825,11 +830,11 @@ describe( 'Widgets screen', () => {
|
|
825
830
|
|
826
831
|
const serializedWidgetAreas = await getSerializedWidgetAreas();
|
827
832
|
expect( serializedWidgetAreas ).toMatchInlineSnapshot( `
|
828
|
-
|
829
|
-
"sidebar-1": "<div class
|
833
|
+
{
|
834
|
+
"sidebar-1": "<div class="widget widget_block widget_text"><div class="widget-content">
|
830
835
|
<p>First Paragraph</p>
|
831
836
|
</div></div>
|
832
|
-
<div class
|
837
|
+
<div class="widget widget_block widget_text"><div class="widget-content">
|
833
838
|
<p>Second Paragraph</p>
|
834
839
|
</div></div>",
|
835
840
|
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Navigation Creating and restarting converts uncontrolled inner blocks to an entity when modifications are made to the blocks 1`] = `"<!-- wp:navigation-link {\\"label\\":\\"A Test Page\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->"`;
|
4
|
-
|
5
|
-
exports[`Navigation Placeholder menu selector actions allows a navigation block to be created from existing menus 1`] = `
|
6
|
-
"<!-- wp:navigation-link {\\"label\\":\\"Home\\",\\"type\\":\\"custom\\",\\"url\\":\\"http://localhost:8889/\\",\\"kind\\":\\"custom\\"} /-->
|
7
|
-
|
8
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"About\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} -->
|
9
|
-
<!-- wp:navigation-link {\\"label\\":\\"Our team\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
10
|
-
<!-- /wp:navigation-submenu -->
|
11
|
-
|
12
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"Shop\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} -->
|
13
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"Winter apparel\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} -->
|
14
|
-
<!-- wp:navigation-link {\\"label\\":\\"Chunky socks\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
15
|
-
|
16
|
-
<!-- wp:navigation-link {\\"label\\":\\"Hideous hats\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
17
|
-
|
18
|
-
<!-- wp:navigation-link {\\"label\\":\\"Glorious gloves\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
19
|
-
|
20
|
-
<!-- wp:navigation-link {\\"label\\":\\"Jazzy Jumpers\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
21
|
-
<!-- /wp:navigation-submenu -->
|
22
|
-
<!-- /wp:navigation-submenu -->
|
23
|
-
|
24
|
-
<!-- wp:navigation-link {\\"label\\":\\"Shipping\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
25
|
-
|
26
|
-
<!-- wp:navigation-link {\\"label\\":\\"Contact Us\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\"} /-->
|
27
|
-
|
28
|
-
<!-- wp:navigation-submenu {\\"label\\":\\"WordPress.org\\",\\"type\\":\\"custom\\",\\"url\\":\\"https://wordpress.org\\",\\"kind\\":\\"custom\\"} -->
|
29
|
-
<!-- wp:navigation-link {\\"label\\":\\"Google\\",\\"type\\":\\"custom\\",\\"url\\":\\"https://google.com\\",\\"kind\\":\\"custom\\"} /-->
|
30
|
-
<!-- /wp:navigation-submenu -->"
|
31
|
-
`;
|
32
|
-
|
33
|
-
exports[`Navigation Placeholder menu selector actions creates an empty navigation block when the selected existing menu is also empty 1`] = `""`;
|
34
|
-
|
35
|
-
exports[`Navigation allows an empty navigation block to be created and manually populated using a mixture of internal and external links 1`] = `
|
36
|
-
"<!-- wp:navigation-link {\\"label\\":\\"WP\\",\\"url\\":\\"https://wordpress.org\\",\\"kind\\":\\"custom\\",\\"isTopLevelLink\\":true} /-->
|
37
|
-
|
38
|
-
<!-- wp:navigation-link {\\"label\\":\\"Contact\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"https://this/is/a/test/search/get-in-touch\\",\\"kind\\":\\"post-type\\",\\"isTopLevelLink\\":true} /-->"
|
39
|
-
`;
|
40
|
-
|
41
|
-
exports[`Navigation allows pages to be created from the navigation block and their links added to menu 1`] = `"<!-- wp:navigation-link {\\"label\\":\\"A really long page name that will not exist\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"http://localhost:8889/?page_id=[number]\\",\\"kind\\":\\"post-type\\",\\"isTopLevelLink\\":true} /-->"`;
|
42
|
-
|
43
|
-
exports[`Navigation encodes URL when create block if needed 1`] = `
|
44
|
-
"<!-- wp:navigation-link {\\"label\\":\\"wordpress.org/шеллы\\",\\"url\\":\\"https://wordpress.org/%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\\",\\"kind\\":\\"custom\\",\\"isTopLevelLink\\":true} /-->
|
45
|
-
|
46
|
-
<!-- wp:navigation-link {\\"label\\":\\"お問い合わせ\\",\\"type\\":\\"page\\",\\"id\\":[number],\\"url\\":\\"https://this/is/a/test/search/%E3%81%8A%E5%95%8F%E3%81%84%E5%90%88%E3%82%8F%E3%81%9B\\",\\"kind\\":\\"post-type\\",\\"isTopLevelLink\\":true} /-->"
|
47
|
-
`;
|