@wordpress/e2e-tests 6.0.0 → 6.2.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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 6.2.0 (2023-01-11)
6
+
7
+ ## 6.1.0 (2023-01-02)
8
+
5
9
  ## 6.0.0 (2022-12-14)
6
10
 
7
11
  ### Breaking Changes
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2022 by the contributors
3
+ Copyright 2016-2023 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
@@ -0,0 +1,77 @@
1
+ <!-- wp:columns {"align":"full"} -->
2
+ <div class="wp-block-columns alignfull"><!-- wp:column -->
3
+ <div class="wp-block-column"><!-- wp:heading {"level":3} -->
4
+ <h3 class="wp-block-heading">Heading</h3>
5
+ <!-- /wp:heading -->
6
+
7
+ <!-- wp:paragraph -->
8
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
9
+ <!-- /wp:paragraph -->
10
+
11
+ <!-- wp:list -->
12
+ <ul><!-- wp:list-item -->
13
+ <li>one</li>
14
+ <!-- /wp:list-item -->
15
+
16
+ <!-- wp:list-item -->
17
+ <li>two</li>
18
+ <!-- /wp:list-item -->
19
+
20
+ <!-- wp:list-item -->
21
+ <li>three</li>
22
+ <!-- /wp:list-item --></ul>
23
+ <!-- /wp:list --></div>
24
+ <!-- /wp:column -->
25
+
26
+ <!-- wp:column -->
27
+ <div class="wp-block-column"><!-- wp:heading {"level":3} -->
28
+ <h3 class="wp-block-heading">Heading</h3>
29
+ <!-- /wp:heading -->
30
+
31
+ <!-- wp:paragraph -->
32
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
33
+ <!-- /wp:paragraph -->
34
+
35
+ <!-- wp:list -->
36
+ <ul><!-- wp:list-item -->
37
+ <li>one</li>
38
+ <!-- /wp:list-item -->
39
+
40
+ <!-- wp:list-item -->
41
+ <li>two</li>
42
+ <!-- /wp:list-item -->
43
+
44
+ <!-- wp:list-item -->
45
+ <li>three</li>
46
+ <!-- /wp:list-item --></ul>
47
+ <!-- /wp:list --></div>
48
+ <!-- /wp:column -->
49
+
50
+ <!-- wp:column -->
51
+ <div class="wp-block-column"><!-- wp:heading {"level":3} -->
52
+ <h3 class="wp-block-heading">Heading</h3>
53
+ <!-- /wp:heading -->
54
+
55
+ <!-- wp:paragraph -->
56
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
57
+ <!-- /wp:paragraph -->
58
+
59
+ <!-- wp:list -->
60
+ <ul><!-- wp:list-item -->
61
+ <li>one</li>
62
+ <!-- /wp:list-item -->
63
+
64
+ <!-- wp:list-item -->
65
+ <li>two</li>
66
+ <!-- /wp:list-item -->
67
+
68
+ <!-- wp:list-item -->
69
+ <li>three</li>
70
+ <!-- /wp:list-item --></ul>
71
+ <!-- /wp:list --></div>
72
+ <!-- /wp:column --></div>
73
+ <!-- /wp:columns -->
74
+
75
+ <!-- wp:paragraph -->
76
+ <p></p>
77
+ <!-- /wp:paragraph -->
@@ -36,6 +36,7 @@ class PerformanceReporter {
36
36
  firstContentfulPaint,
37
37
  firstBlock,
38
38
  type,
39
+ typeContainer,
39
40
  focus,
40
41
  listViewOpen,
41
42
  inserterOpen,
@@ -68,7 +69,7 @@ Average time to first block: ${ success(
68
69
  if ( type && type.length ) {
69
70
  // eslint-disable-next-line no-console
70
71
  console.log( `
71
- ${ title( 'Typing Performance:' ) }
72
+ ${ title( 'Typing:' ) }
72
73
  Average time to type character: ${ success( round( average( type ) ) + 'ms' ) }
73
74
  Slowest time to type character: ${ success(
74
75
  round( Math.max( ...type ) ) + 'ms'
@@ -78,10 +79,25 @@ Fastest time to type character: ${ success(
78
79
  ) }` );
79
80
  }
80
81
 
82
+ if ( typeContainer && typeContainer.length ) {
83
+ // eslint-disable-next-line no-console
84
+ console.log( `
85
+ ${ title( 'Typing within a container:' ) }
86
+ Average time to type within a container: ${ success(
87
+ round( average( typeContainer ) ) + 'ms'
88
+ ) }
89
+ Slowest time to type within a container: ${ success(
90
+ round( Math.max( ...typeContainer ) ) + 'ms'
91
+ ) }
92
+ Fastest time to type within a container: ${ success(
93
+ round( Math.min( ...typeContainer ) ) + 'ms'
94
+ ) }` );
95
+ }
96
+
81
97
  if ( focus && focus.length ) {
82
98
  // eslint-disable-next-line no-console
83
99
  console.log( `
84
- ${ title( 'Block Selection Performance:' ) }
100
+ ${ title( 'Block Selection:' ) }
85
101
  Average time to select a block: ${ success( round( average( focus ) ) + 'ms' ) }
86
102
  Slowest time to select a block: ${ success(
87
103
  round( Math.max( ...focus ) ) + 'ms'
@@ -94,7 +110,7 @@ Fastest time to select a block: ${ success(
94
110
  if ( listViewOpen && listViewOpen.length ) {
95
111
  // eslint-disable-next-line no-console
96
112
  console.log( `
97
- ${ title( 'Opening List View Performance:' ) }
113
+ ${ title( 'Opening List View:' ) }
98
114
  Average time to open list view: ${ success(
99
115
  round( average( listViewOpen ) ) + 'ms'
100
116
  ) }
@@ -109,7 +125,7 @@ Fastest time to open list view: ${ success(
109
125
  if ( inserterOpen && inserterOpen.length ) {
110
126
  // eslint-disable-next-line no-console
111
127
  console.log( `
112
- ${ title( 'Opening Global Inserter Performance:' ) }
128
+ ${ title( 'Opening Global Inserter:' ) }
113
129
  Average time to open global inserter: ${ success(
114
130
  round( average( inserterOpen ) ) + 'ms'
115
131
  ) }
@@ -124,7 +140,7 @@ Fastest time to open global inserter: ${ success(
124
140
  if ( inserterSearch && inserterSearch.length ) {
125
141
  // eslint-disable-next-line no-console
126
142
  console.log( `
127
- ${ title( 'Inserter Search Performance:' ) }
143
+ ${ title( 'Inserter Search:' ) }
128
144
  Average time to type the inserter search input: ${ success(
129
145
  round( average( inserterSearch ) ) + 'ms'
130
146
  ) }
@@ -139,7 +155,7 @@ Fastest time to type the inserter search input: ${ success(
139
155
  if ( inserterHover && inserterHover.length ) {
140
156
  // eslint-disable-next-line no-console
141
157
  console.log( `
142
- ${ title( 'Inserter Block Item Hover Performance:' ) }
158
+ ${ title( 'Inserter Block Item Hover:' ) }
143
159
  Average time to move mouse between two block item in the inserter: ${ success(
144
160
  round( average( inserterHover ) ) + 'ms'
145
161
  ) }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "6.0.0",
3
+ "version": "6.2.0",
4
4
  "description": "End-To-End (E2E) tests for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -23,11 +23,11 @@
23
23
  "node": ">=14"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/e2e-test-utils": "^9.0.0",
27
- "@wordpress/jest-console": "^6.6.0",
28
- "@wordpress/jest-puppeteer-axe": "^5.6.0",
29
- "@wordpress/scripts": "^25.0.0",
30
- "@wordpress/url": "^3.24.0",
26
+ "@wordpress/e2e-test-utils": "^9.2.0",
27
+ "@wordpress/jest-console": "^6.8.0",
28
+ "@wordpress/jest-puppeteer-axe": "^5.8.0",
29
+ "@wordpress/scripts": "^25.2.0",
30
+ "@wordpress/url": "^3.26.0",
31
31
  "chalk": "^4.0.0",
32
32
  "expect-puppeteer": "^4.4.0",
33
33
  "filenamify": "^4.2.0",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "1eb65aabe6738097f4c062e78f69ae8f05879848"
49
+ "gitHead": "204c880ff65295768e9695dfee6c7a9fee1fdd05"
50
50
  }
@@ -166,7 +166,7 @@ const matchUrl = ( reqUrl, urls ) => {
166
166
  };
167
167
 
168
168
  describe( 'adding blocks from block directory', () => {
169
- beforeEach( async () => {
169
+ beforeAll( async () => {
170
170
  await createNewPost();
171
171
  } );
172
172
 
@@ -16,7 +16,9 @@ describe( 'a11y', () => {
16
16
 
17
17
  it( 'tabs header bar', async () => {
18
18
  await pressKeyWithModifier( 'ctrl', '`' );
19
-
19
+ await pressKeyWithModifier( 'ctrl', '`' );
20
+ await pressKeyWithModifier( 'ctrl', '`' );
21
+ await pressKeyWithModifier( 'ctrl', '`' );
20
22
  await page.keyboard.press( 'Tab' );
21
23
 
22
24
  const isFocusedToggle = await page.$eval(
@@ -9,6 +9,7 @@ import {
9
9
  pressKeyWithModifier,
10
10
  openDocumentSettingsSidebar,
11
11
  getListViewBlocks,
12
+ switchBlockInspectorTab,
12
13
  } from '@wordpress/e2e-test-utils';
13
14
 
14
15
  async function openListViewSidebar() {
@@ -20,6 +21,20 @@ async function tabToColumnsControl() {
20
21
  let isColumnsControl = false;
21
22
  do {
22
23
  await page.keyboard.press( 'Tab' );
24
+
25
+ const isBlockInspectorTab = await page.evaluate( () => {
26
+ const activeElement = document.activeElement;
27
+ return (
28
+ activeElement.getAttribute( 'role' ) === 'tab' &&
29
+ activeElement.attributes.getNamedItem( 'aria-label' ).value ===
30
+ 'Styles'
31
+ );
32
+ } );
33
+
34
+ if ( isBlockInspectorTab ) {
35
+ await page.keyboard.press( 'ArrowRight' );
36
+ }
37
+
23
38
  isColumnsControl = await page.evaluate( () => {
24
39
  const activeElement = document.activeElement;
25
40
  return (
@@ -60,6 +75,7 @@ describe( 'Navigating the block hierarchy', () => {
60
75
 
61
76
  // Tweak the columns count.
62
77
  await openDocumentSettingsSidebar();
78
+ await switchBlockInspectorTab( 'Settings' );
63
79
  await page.focus(
64
80
  '.block-editor-block-inspector [aria-label="Columns"][type="number"]'
65
81
  );
@@ -111,16 +127,14 @@ describe( 'Navigating the block hierarchy', () => {
111
127
 
112
128
  // Move focus to the sidebar area.
113
129
  await pressKeyWithModifier( 'ctrl', '`' );
114
- await pressKeyWithModifier( 'ctrl', '`' );
115
- await pressKeyWithModifier( 'ctrl', '`' );
116
130
  await tabToColumnsControl();
117
131
 
118
132
  // Tweak the columns count by increasing it by one.
119
133
  await page.keyboard.press( 'ArrowRight' );
120
134
 
121
135
  // Navigate to the third column in the columns block.
122
- await pressKeyWithModifier( 'ctrl', '`' );
123
- await pressKeyWithModifier( 'ctrl', '`' );
136
+ await pressKeyWithModifier( 'ctrlShift', '`' );
137
+ await pressKeyWithModifier( 'ctrlShift', '`' );
124
138
  await pressKeyTimes( 'Tab', 4 );
125
139
  await pressKeyTimes( 'ArrowDown', 4 );
126
140
  await page.waitForSelector(
@@ -76,7 +76,7 @@ describe( 'Block Switcher', () => {
76
76
  'core/group',
77
77
  'core/heading',
78
78
  'core/columns',
79
- ].map( ( block ) => wp.blocks.unregisterBlockType( block ) );
79
+ ].forEach( ( block ) => wp.blocks.unregisterBlockType( block ) );
80
80
  } );
81
81
 
82
82
  await page.keyboard.press( 'ArrowUp' );
@@ -22,9 +22,7 @@ describe( 'Editing modes (visual/HTML)', () => {
22
22
 
23
23
  it( 'should switch between visual and HTML modes', async () => {
24
24
  // This block should be in "visual" mode by default.
25
- let visualBlock = await page.$$(
26
- '.block-editor-block-list__layout .block-editor-block-list__block.rich-text'
27
- );
25
+ let visualBlock = await page.$$( '[data-block].rich-text' );
28
26
  expect( visualBlock ).toHaveLength( 1 );
29
27
 
30
28
  // Change editing mode from "Visual" to "HTML".
@@ -33,7 +31,7 @@ describe( 'Editing modes (visual/HTML)', () => {
33
31
 
34
32
  // Wait for the block to be converted to HTML editing mode.
35
33
  const htmlBlock = await page.$$(
36
- '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea'
34
+ '[data-block] .block-editor-block-list__block-html-textarea'
37
35
  );
38
36
  expect( htmlBlock ).toHaveLength( 1 );
39
37
 
@@ -42,9 +40,7 @@ describe( 'Editing modes (visual/HTML)', () => {
42
40
  await clickMenuItem( 'Edit visually' );
43
41
 
44
42
  // This block should be in "visual" mode by default.
45
- visualBlock = await page.$$(
46
- '.block-editor-block-list__layout .block-editor-block-list__block.rich-text'
47
- );
43
+ visualBlock = await page.$$( '[data-block].rich-text' );
48
44
  expect( visualBlock ).toHaveLength( 1 );
49
45
  } );
50
46
 
@@ -318,7 +318,7 @@ describe( 'Inserting blocks', () => {
318
318
  );
319
319
  await browseAll.click();
320
320
  const availableBlocks = await page.$$(
321
- '.block-editor-block-types-list__list-item'
321
+ '.edit-post-editor__inserter-panel .block-editor-block-types-list__list-item'
322
322
  );
323
323
  expect( availableBlocks ).toHaveLength( 1 );
324
324
  } );
@@ -23,6 +23,9 @@ const navigateToContentEditorTop = async () => {
23
23
  // Use 'Ctrl+`' to return to the top of the editor.
24
24
  await pressKeyWithModifier( 'ctrl', '`' );
25
25
  await pressKeyWithModifier( 'ctrl', '`' );
26
+ await pressKeyWithModifier( 'ctrl', '`' );
27
+ await pressKeyWithModifier( 'ctrl', '`' );
28
+ await pressKeyWithModifier( 'ctrl', '`' );
26
29
  };
27
30
 
28
31
  const tabThroughParagraphBlock = async ( paragraphText ) => {
@@ -36,6 +39,10 @@ const tabThroughParagraphBlock = async ( paragraphText ) => {
36
39
 
37
40
  await page.keyboard.press( 'Tab' );
38
41
  await expect( await getActiveLabel() ).toBe( 'Open document settings' );
42
+
43
+ // Need to shift+tab here to end back in the block. If not, we'll be in the next region and it will only require 4 region jumps instead of 5.
44
+ await pressKeyWithModifier( 'shift', 'Tab' );
45
+ await expect( await getActiveLabel() ).toBe( 'Paragraph block' );
39
46
  };
40
47
 
41
48
  const tabThroughBlockToolbar = async () => {
@@ -96,8 +96,6 @@ describe( 'Sidebar', () => {
96
96
 
97
97
  // Region navigate to Sidebar.
98
98
  await pressKeyWithModifier( 'ctrl', '`' );
99
- await pressKeyWithModifier( 'ctrl', '`' );
100
- await pressKeyWithModifier( 'ctrl', '`' );
101
99
 
102
100
  // Tab lands at first (presumed selected) option "Post".
103
101
  await page.keyboard.press( 'Tab' );
@@ -15,6 +15,7 @@ import {
15
15
  closeGlobalBlockInserter,
16
16
  openListView,
17
17
  closeListView,
18
+ canvas,
18
19
  } from '@wordpress/e2e-test-utils';
19
20
 
20
21
  /**
@@ -32,6 +33,34 @@ import {
32
33
 
33
34
  jest.setTimeout( 1000000 );
34
35
 
36
+ async function loadHtmlIntoTheBlockEditor( html ) {
37
+ await page.evaluate( ( _html ) => {
38
+ const { parse } = window.wp.blocks;
39
+ const { dispatch } = window.wp.data;
40
+ const blocks = parse( _html );
41
+
42
+ blocks.forEach( ( block ) => {
43
+ if ( block.name === 'core/image' ) {
44
+ delete block.attributes.id;
45
+ delete block.attributes.url;
46
+ }
47
+ } );
48
+
49
+ dispatch( 'core/block-editor' ).resetBlocks( blocks );
50
+ }, html );
51
+ }
52
+
53
+ async function load1000Paragraphs() {
54
+ await page.evaluate( () => {
55
+ const { createBlock } = window.wp.blocks;
56
+ const { dispatch } = window.wp.data;
57
+ const blocks = Array.from( { length: 1000 } ).map( () =>
58
+ createBlock( 'core/paragraph' )
59
+ );
60
+ dispatch( 'core/block-editor' ).resetBlocks( blocks );
61
+ } );
62
+ }
63
+
35
64
  describe( 'Post Editor Performance', () => {
36
65
  const results = {
37
66
  serverResponse: [],
@@ -41,6 +70,7 @@ describe( 'Post Editor Performance', () => {
41
70
  firstContentfulPaint: [],
42
71
  firstBlock: [],
43
72
  type: [],
73
+ typeContainer: [],
44
74
  focus: [],
45
75
  listViewOpen: [],
46
76
  inserterOpen: [],
@@ -50,29 +80,6 @@ describe( 'Post Editor Performance', () => {
50
80
  const traceFile = __dirname + '/trace.json';
51
81
  let traceResults;
52
82
 
53
- beforeAll( async () => {
54
- const html = readFile(
55
- join( __dirname, '../../assets/large-post.html' )
56
- );
57
-
58
- await createNewPost();
59
- await page.evaluate( ( _html ) => {
60
- const { parse } = window.wp.blocks;
61
- const { dispatch } = window.wp.data;
62
- const blocks = parse( _html );
63
-
64
- blocks.forEach( ( block ) => {
65
- if ( block.name === 'core/image' ) {
66
- delete block.attributes.id;
67
- delete block.attributes.url;
68
- }
69
- } );
70
-
71
- dispatch( 'core/block-editor' ).resetBlocks( blocks );
72
- }, html );
73
- await saveDraft();
74
- } );
75
-
76
83
  afterAll( async () => {
77
84
  const resultsFilename = basename( __filename, '.js' ) + '.results.json';
78
85
  writeFileSync(
@@ -83,6 +90,7 @@ describe( 'Post Editor Performance', () => {
83
90
  } );
84
91
 
85
92
  beforeEach( async () => {
93
+ await createNewPost();
86
94
  // Disable auto-save to avoid impacting the metrics.
87
95
  await page.evaluate( () => {
88
96
  window.wp.data.dispatch( 'core/editor' ).updateEditorSettings( {
@@ -93,11 +101,17 @@ describe( 'Post Editor Performance', () => {
93
101
  } );
94
102
 
95
103
  it( 'Loading', async () => {
96
- // Measuring loading time.
104
+ await loadHtmlIntoTheBlockEditor(
105
+ readFile( join( __dirname, '../../assets/large-post.html' ) )
106
+ );
107
+ await saveDraft();
97
108
  let i = 5;
98
109
  while ( i-- ) {
99
110
  await page.reload();
100
- await page.waitForSelector( '.wp-block' );
111
+ await page.waitForSelector( '.edit-post-layout', {
112
+ timeout: 120000,
113
+ } );
114
+ await canvas().waitForSelector( '.wp-block', { timeout: 120000 } );
101
115
  const {
102
116
  serverResponse,
103
117
  firstPaint,
@@ -117,7 +131,9 @@ describe( 'Post Editor Performance', () => {
117
131
  } );
118
132
 
119
133
  it( 'Typing', async () => {
120
- // Measuring typing performance.
134
+ await loadHtmlIntoTheBlockEditor(
135
+ readFile( join( __dirname, '../../assets/large-post.html' ) )
136
+ );
121
137
  await insertBlock( 'Paragraph' );
122
138
  let i = 20;
123
139
  await page.tracing.start( {
@@ -151,18 +167,59 @@ describe( 'Post Editor Performance', () => {
151
167
  }
152
168
  } );
153
169
 
154
- it( 'Selecting blocks', async () => {
155
- // Measuring block selection performance.
156
- await createNewPost();
157
- await page.evaluate( () => {
158
- const { createBlock } = window.wp.blocks;
159
- const { dispatch } = window.wp.data;
160
- const blocks = Array.from( { length: 1000 } ).map( () =>
161
- createBlock( 'core/paragraph' )
162
- );
163
- dispatch( 'core/block-editor' ).resetBlocks( blocks );
170
+ it( 'Typing within containers', async () => {
171
+ await loadHtmlIntoTheBlockEditor(
172
+ readFile(
173
+ join(
174
+ __dirname,
175
+ '../../assets/small-post-with-containers.html'
176
+ )
177
+ )
178
+ );
179
+ // Select the block where we type in
180
+ await canvas().waitForSelector( 'p[aria-label="Paragraph block"]' );
181
+ await canvas().click( 'p[aria-label="Paragraph block"]' );
182
+ // Ignore firsted typed character because it's different
183
+ // It probably deserves a dedicated metric.
184
+ // (isTyping triggers so it's slower)
185
+ await page.keyboard.type( 'x' );
186
+
187
+ let i = 10;
188
+ await page.tracing.start( {
189
+ path: traceFile,
190
+ screenshots: false,
191
+ categories: [ 'devtools.timeline' ],
164
192
  } );
165
- const paragraphs = await page.$$( '.wp-block' );
193
+
194
+ while ( i-- ) {
195
+ // Wait for the browser to be idle before starting the monitoring.
196
+ // eslint-disable-next-line no-restricted-syntax
197
+ await page.waitForTimeout( 500 );
198
+ await page.keyboard.type( 'x' );
199
+ }
200
+ // eslint-disable-next-line no-restricted-syntax
201
+ await page.waitForTimeout( 500 );
202
+ await page.tracing.stop();
203
+ traceResults = JSON.parse( readFile( traceFile ) );
204
+ const [ keyDownEvents, keyPressEvents, keyUpEvents ] =
205
+ getTypingEventDurations( traceResults );
206
+ if (
207
+ keyDownEvents.length === keyPressEvents.length &&
208
+ keyPressEvents.length === keyUpEvents.length
209
+ ) {
210
+ // The first character typed triggers a longer time (isTyping change)
211
+ // It can impact the stability of the metric, so we exclude it.
212
+ for ( let j = 1; j < keyDownEvents.length; j++ ) {
213
+ results.typeContainer.push(
214
+ keyDownEvents[ j ] + keyPressEvents[ j ] + keyUpEvents[ j ]
215
+ );
216
+ }
217
+ }
218
+ } );
219
+
220
+ it( 'Selecting blocks', async () => {
221
+ await load1000Paragraphs();
222
+ const paragraphs = await canvas().$$( '.wp-block' );
166
223
  await page.tracing.start( {
167
224
  path: traceFile,
168
225
  screenshots: false,
@@ -182,8 +239,7 @@ describe( 'Post Editor Performance', () => {
182
239
  } );
183
240
 
184
241
  it( 'Opening persistent list view', async () => {
185
- // Measure time to open inserter.
186
- await page.waitForSelector( '.edit-post-layout' );
242
+ await load1000Paragraphs();
187
243
  for ( let j = 0; j < 10; j++ ) {
188
244
  await page.tracing.start( {
189
245
  path: traceFile,
@@ -202,8 +258,7 @@ describe( 'Post Editor Performance', () => {
202
258
  } );
203
259
 
204
260
  it( 'Opening the inserter', async () => {
205
- // Measure time to open inserter.
206
- await page.waitForSelector( '.edit-post-layout' );
261
+ await load1000Paragraphs();
207
262
  for ( let j = 0; j < 10; j++ ) {
208
263
  await page.tracing.start( {
209
264
  path: traceFile,
@@ -225,8 +280,7 @@ describe( 'Post Editor Performance', () => {
225
280
  function sum( arr ) {
226
281
  return arr.reduce( ( a, b ) => a + b, 0 );
227
282
  }
228
-
229
- // Measure time to search the inserter and get results.
283
+ await load1000Paragraphs();
230
284
  await openGlobalBlockInserter();
231
285
  for ( let j = 0; j < 10; j++ ) {
232
286
  // Wait for the browser to be idle before starting the monitoring.
@@ -258,7 +312,7 @@ describe( 'Post Editor Performance', () => {
258
312
  } );
259
313
 
260
314
  it( 'Hovering Inserter Items', async () => {
261
- // Measure inserter hover performance.
315
+ await load1000Paragraphs();
262
316
  const paragraphBlockItem =
263
317
  '.block-editor-inserter__menu .editor-block-list-item-paragraph';
264
318
  const headingBlockItem =
@@ -51,6 +51,7 @@ describe( 'Site Editor Performance', () => {
51
51
  firstContentfulPaint: [],
52
52
  firstBlock: [],
53
53
  type: [],
54
+ typeContainer: [],
54
55
  focus: [],
55
56
  inserterOpen: [],
56
57
  inserterHover: [],