@wordpress/e2e-tests 6.1.0 → 6.3.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 +4 -0
- package/LICENSE.md +1 -1
- package/package.json +7 -7
- package/specs/editor/blocks/cover.test.js +9 -9
- package/specs/editor/blocks/query.test.js +10 -54
- package/specs/editor/various/__snapshots__/links.test.js.snap +1 -1
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +8 -6
- package/specs/editor/various/block-hierarchy-navigation.test.js +16 -0
- package/specs/editor/various/block-switcher.test.js +1 -1
- package/specs/editor/various/inserting-blocks.test.js +5 -3
- package/specs/editor/various/keyboard-navigable-blocks.test.js +1 -1
- package/specs/editor/various/links.test.js +61 -4
- package/specs/editor/various/multi-block-selection.test.js +16 -3
- package/specs/editor/various/nux.test.js +2 -2
- package/specs/editor/various/rich-text.test.js +9 -1
- package/specs/experiments/blocks/post-comments-form.test.js +10 -2
- package/specs/performance/front-end-block-theme.test.js +47 -0
- package/specs/performance/front-end-classic-theme.test.js +45 -0
- package/specs/site-editor/multi-entity-saving.test.js +7 -2
- package/assets/greeting-reusable-block.json +0 -5
- package/specs/editor/blocks/__snapshots__/classic.test.js.snap +0 -5
- package/specs/editor/blocks/classic.test.js +0 -145
- package/specs/editor/various/a11y.test.js +0 -74
- package/specs/editor/various/manage-reusable-blocks.test.js +0 -74
- package/specs/editor/various/post-visibility.test.js +0 -133
- package/specs/experiments/__snapshots__/navigation-editor.test.js.snap +0 -39
- package/specs/experiments/navigation-editor.test.js +0 -850
package/CHANGELOG.md
CHANGED
package/LICENSE.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.3.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.
|
27
|
-
"@wordpress/jest-console": "^6.
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^5.
|
29
|
-
"@wordpress/scripts": "^25.
|
30
|
-
"@wordpress/url": "^3.
|
26
|
+
"@wordpress/e2e-test-utils": "^9.3.0",
|
27
|
+
"@wordpress/jest-console": "^6.9.0",
|
28
|
+
"@wordpress/jest-puppeteer-axe": "^5.9.0",
|
29
|
+
"@wordpress/scripts": "^25.3.0",
|
30
|
+
"@wordpress/url": "^3.27.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": "
|
49
|
+
"gitHead": "cab6ebe2b4c5dbacfd753dcae4a2406559c4813c"
|
50
50
|
}
|
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
insertBlock,
|
14
14
|
createNewPost,
|
15
15
|
openDocumentSettingsSidebar,
|
16
|
+
switchBlockInspectorTab,
|
16
17
|
transformBlockTo,
|
17
18
|
} from '@wordpress/e2e-test-utils';
|
18
19
|
|
@@ -126,7 +127,7 @@ describe( 'Cover', () => {
|
|
126
127
|
'.components-circular-option-picker__option-wrapper:first-child button'
|
127
128
|
);
|
128
129
|
|
129
|
-
// Select the cover block.By default the child paragraph gets selected.
|
130
|
+
// Select the cover block. By default the child paragraph gets selected.
|
130
131
|
await page.click(
|
131
132
|
'.edit-post-header-toolbar__document-overview-toggle'
|
132
133
|
);
|
@@ -134,16 +135,15 @@ describe( 'Cover', () => {
|
|
134
135
|
'.block-editor-list-view-block__contents-container a'
|
135
136
|
);
|
136
137
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
)[ 0 ];
|
138
|
+
switchBlockInspectorTab( 'Styles' );
|
139
|
+
const heightInputHandle = await page.waitForSelector(
|
140
|
+
'input[id*="block-cover-height-input"]'
|
141
|
+
);
|
142
142
|
|
143
143
|
// Verify the height of the cover is not defined.
|
144
144
|
expect(
|
145
|
-
await page.evaluate( ( { value } ) => value,
|
146
|
-
).
|
145
|
+
await page.evaluate( ( { value } ) => value, heightInputHandle )
|
146
|
+
).toBe( '' );
|
147
147
|
|
148
148
|
const resizeButton = await page.$(
|
149
149
|
'.components-resizable-box__handle-bottom'
|
@@ -188,7 +188,7 @@ describe( 'Cover', () => {
|
|
188
188
|
expect(
|
189
189
|
await page.evaluate(
|
190
190
|
( { value } ) => Number.parseInt( value ),
|
191
|
-
|
191
|
+
heightInputHandle
|
192
192
|
)
|
193
193
|
).toBeGreaterThan( 100 );
|
194
194
|
} );
|
@@ -31,7 +31,7 @@ describe( 'Query block', () => {
|
|
31
31
|
await trashAllPosts( 'page' );
|
32
32
|
} );
|
33
33
|
describe( 'Query block insertion', () => {
|
34
|
-
it( '
|
34
|
+
it( 'List', async () => {
|
35
35
|
await insertBlock( 'Query' );
|
36
36
|
// Wait for the choose pattern button
|
37
37
|
const choosePatternButton = await page.waitForSelector(
|
@@ -40,64 +40,20 @@ describe( 'Query block', () => {
|
|
40
40
|
await choosePatternButton.click();
|
41
41
|
// Wait for pattern blocks to be loaded.
|
42
42
|
await page.waitForSelector(
|
43
|
-
'.block-
|
43
|
+
'.block-library-query-pattern__selection-content iframe[title="Editor canvas"]'
|
44
44
|
);
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
*/
|
49
|
-
await page.waitForSelector(
|
50
|
-
'li.pattern-slide.active-slide[aria-label="Query Test 1"]'
|
51
|
-
);
|
52
|
-
const nextPatternButton = await page.waitForSelector(
|
53
|
-
'.block-editor-block-pattern-setup__navigation button[aria-label="Next pattern"]'
|
54
|
-
);
|
55
|
-
await nextPatternButton.click();
|
56
|
-
await page.waitForSelector(
|
57
|
-
'li.pattern-slide.active-slide[aria-label="Query Test 2"]'
|
45
|
+
// Choose the standard pattern.
|
46
|
+
const chosenPattern = await page.waitForSelector(
|
47
|
+
'.block-editor-block-patterns-list__item[aria-label="Standard"]'
|
58
48
|
);
|
59
|
-
|
60
|
-
const chooseButton = await page.waitForXPath(
|
61
|
-
'//div[contains(@class, "block-editor-block-pattern-setup__actions")]//button[text()="Choose"]'
|
62
|
-
);
|
63
|
-
chooseButton.click();
|
49
|
+
chosenPattern.click();
|
64
50
|
// Wait for pattern setup to go away.
|
65
|
-
await page.waitForSelector( '.block-editor-block-pattern-setup', {
|
66
|
-
hidden: true,
|
67
|
-
} );
|
68
|
-
/**
|
69
|
-
* We can't use `getEditedPostContent` easily for now because
|
70
|
-
* `query` makes used of `instanceId` so it's not very reliable.
|
71
|
-
* This should be revisited.
|
72
|
-
*/
|
73
|
-
await page.waitForSelector( '.wp-block-post-date' );
|
74
|
-
await page.waitForSelector( '.wp-block-post-title' );
|
75
|
-
} );
|
76
|
-
it( 'Grid view', async () => {
|
77
|
-
await insertBlock( 'Query' );
|
78
|
-
// Wait for the choose pattern button
|
79
|
-
const choosePatternButton = await page.waitForSelector(
|
80
|
-
'div[data-type="core/query"] button.is-primary'
|
81
|
-
);
|
82
|
-
await choosePatternButton.click();
|
83
|
-
// Wait for patterns setup to be loaded.
|
84
51
|
await page.waitForSelector(
|
85
|
-
'.block-
|
52
|
+
'.block-library-query-pattern__selection-content',
|
53
|
+
{
|
54
|
+
hidden: true,
|
55
|
+
}
|
86
56
|
);
|
87
|
-
// Click the Grid view button.
|
88
|
-
const gridViewButton = await page.waitForSelector(
|
89
|
-
'.block-editor-block-pattern-setup__display-controls button[aria-label="Grid view"]'
|
90
|
-
);
|
91
|
-
await gridViewButton.click();
|
92
|
-
// Wait for patterns to be loaded and click the wanted pattern.
|
93
|
-
const gridPattern = await page.waitForSelector(
|
94
|
-
'.block-editor-block-pattern-setup-list__list-item[aria-label="Query Test 2"]'
|
95
|
-
);
|
96
|
-
await gridPattern.click();
|
97
|
-
// Wait for pattern setup to go away.
|
98
|
-
await page.waitForSelector( '.block-editor-block-pattern-setup', {
|
99
|
-
hidden: true,
|
100
|
-
} );
|
101
57
|
/**
|
102
58
|
* We can't use `getEditedPostContent` easily for now because
|
103
59
|
* `query` makes used of `instanceId` so it's not very reliable.
|
@@ -68,6 +68,6 @@ exports[`Links should contain a label when it should open in a new tab 1`] = `
|
|
68
68
|
|
69
69
|
exports[`Links should contain a label when it should open in a new tab 2`] = `
|
70
70
|
"<!-- wp:paragraph -->
|
71
|
-
<p>This is <a href=\\"http://wordpress.org\\">WordPress</a></p>
|
71
|
+
<p>This is <a href=\\"http://wordpress.org\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\">WordPress</a></p>
|
72
72
|
<!-- /wp:paragraph -->"
|
73
73
|
`;
|
@@ -50,9 +50,10 @@ describe( 'block editor keyboard shortcuts', () => {
|
|
50
50
|
it( 'should move the blocks up', async () => {
|
51
51
|
await createTestParagraphBlocks();
|
52
52
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
53
|
-
await
|
54
|
-
await page.
|
55
|
-
|
53
|
+
await pressKeyWithModifier( 'shift', 'ArrowUp' );
|
54
|
+
await page.waitForSelector(
|
55
|
+
'[aria-label="Multiple selected blocks"]'
|
56
|
+
);
|
56
57
|
await moveUp();
|
57
58
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
58
59
|
} );
|
@@ -61,9 +62,10 @@ describe( 'block editor keyboard shortcuts', () => {
|
|
61
62
|
await createTestParagraphBlocks();
|
62
63
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
63
64
|
await page.keyboard.press( 'ArrowUp' );
|
64
|
-
await
|
65
|
-
await page.
|
66
|
-
|
65
|
+
await pressKeyWithModifier( 'shift', 'ArrowUp' );
|
66
|
+
await page.waitForSelector(
|
67
|
+
'[aria-label="Multiple selected blocks"]'
|
68
|
+
);
|
67
69
|
await moveDown();
|
68
70
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
69
71
|
} );
|
@@ -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
|
);
|
@@ -76,7 +76,7 @@ describe( 'Block Switcher', () => {
|
|
76
76
|
'core/group',
|
77
77
|
'core/heading',
|
78
78
|
'core/columns',
|
79
|
-
].
|
79
|
+
].forEach( ( block ) => wp.blocks.unregisterBlockType( block ) );
|
80
80
|
} );
|
81
81
|
|
82
82
|
await page.keyboard.press( 'ArrowUp' );
|
@@ -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
|
} );
|
@@ -347,8 +347,10 @@ describe( 'Inserting blocks', () => {
|
|
347
347
|
|
348
348
|
it( 'shows block preview when hovering over block in inserter', async () => {
|
349
349
|
await openGlobalBlockInserter();
|
350
|
-
|
351
|
-
|
350
|
+
const paragraphButton = (
|
351
|
+
await page.$x( `//button//span[contains(text(), 'Paragraph')]` )
|
352
|
+
)[ 0 ];
|
353
|
+
await paragraphButton.hover();
|
352
354
|
const preview = await page.waitForSelector(
|
353
355
|
'.block-editor-inserter__preview',
|
354
356
|
{
|
@@ -56,7 +56,7 @@ const tabThroughBlockToolbar = async () => {
|
|
56
56
|
await expect( await getActiveLabel() ).toBe( 'Move down' );
|
57
57
|
|
58
58
|
await page.keyboard.press( 'ArrowRight' );
|
59
|
-
await expect( await getActiveLabel() ).toBe( 'Align' );
|
59
|
+
await expect( await getActiveLabel() ).toBe( 'Align text' );
|
60
60
|
|
61
61
|
await page.keyboard.press( 'ArrowRight' );
|
62
62
|
await expect( await getActiveLabel() ).toBe( 'Bold' );
|
@@ -121,7 +121,6 @@ describe( 'Links', () => {
|
|
121
121
|
|
122
122
|
// Navigate to and toggle the "Open in new tab" checkbox.
|
123
123
|
await page.keyboard.press( 'Tab' );
|
124
|
-
await page.keyboard.press( 'Tab' );
|
125
124
|
await page.keyboard.press( 'Space' );
|
126
125
|
|
127
126
|
// Toggle should still have focus and be checked.
|
@@ -134,7 +133,7 @@ describe( 'Links', () => {
|
|
134
133
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
135
134
|
|
136
135
|
// Tab back to the Submit and apply the link.
|
137
|
-
await
|
136
|
+
await page.keyboard.press( 'Tab' );
|
138
137
|
await page.keyboard.press( 'Enter' );
|
139
138
|
|
140
139
|
// The link should have been inserted.
|
@@ -527,7 +526,6 @@ describe( 'Links', () => {
|
|
527
526
|
|
528
527
|
// Navigate to and toggle the "Open in new tab" checkbox.
|
529
528
|
await page.keyboard.press( 'Tab' );
|
530
|
-
await page.keyboard.press( 'Tab' );
|
531
529
|
await page.keyboard.press( 'Space' );
|
532
530
|
|
533
531
|
// Confirm that focus was not prematurely returned to the paragraph on
|
@@ -536,7 +534,8 @@ describe( 'Links', () => {
|
|
536
534
|
|
537
535
|
// Close dialog. Expect that "Open in new tab" would have been applied
|
538
536
|
// immediately.
|
539
|
-
|
537
|
+
|
538
|
+
await pressKeyWithModifier( 'shift', 'Tab' );
|
540
539
|
await page.keyboard.press( 'Enter' );
|
541
540
|
|
542
541
|
// Wait for Gutenberg to finish the job.
|
@@ -766,6 +765,7 @@ describe( 'Links', () => {
|
|
766
765
|
await page.keyboard.press( 'Tab' );
|
767
766
|
await page.keyboard.press( 'Tab' );
|
768
767
|
await page.keyboard.press( 'Tab' );
|
768
|
+
await page.keyboard.press( 'Tab' );
|
769
769
|
|
770
770
|
// Make a selection within the RichText.
|
771
771
|
await pressKeyWithModifier( 'shift', 'ArrowRight' );
|
@@ -940,5 +940,62 @@ describe( 'Links', () => {
|
|
940
940
|
)
|
941
941
|
).toBeNull();
|
942
942
|
} );
|
943
|
+
|
944
|
+
// Based on issue reported in https://github.com/WordPress/gutenberg/issues/41771/.
|
945
|
+
it( 'should correctly replace targetted links text within rich text value when multiple matching values exist', async () => {
|
946
|
+
// Create a block with some text.
|
947
|
+
await clickBlockAppender();
|
948
|
+
|
949
|
+
// Note the two instances of the string "a".
|
950
|
+
await page.keyboard.type( `a b c a` );
|
951
|
+
|
952
|
+
// Select the last "a" only.
|
953
|
+
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
954
|
+
|
955
|
+
// Click on the Link button.
|
956
|
+
await page.click( 'button[aria-label="Link"]' );
|
957
|
+
|
958
|
+
// Wait for the URL field to auto-focus.
|
959
|
+
await waitForURLFieldAutoFocus();
|
960
|
+
|
961
|
+
// Type a URL.
|
962
|
+
await page.keyboard.type( 'www.wordpress.org' );
|
963
|
+
|
964
|
+
// Update the link.
|
965
|
+
await page.keyboard.press( 'Enter' );
|
966
|
+
|
967
|
+
await page.keyboard.press( 'ArrowLeft' );
|
968
|
+
|
969
|
+
// Move to "Edit" button in Link UI
|
970
|
+
await page.keyboard.press( 'Tab' );
|
971
|
+
await page.keyboard.press( 'Tab' );
|
972
|
+
await page.keyboard.press( 'Enter' );
|
973
|
+
|
974
|
+
// Move to Link Text field.
|
975
|
+
await pressKeyWithModifier( 'shift', 'Tab' );
|
976
|
+
|
977
|
+
// Change text to "z"
|
978
|
+
await page.keyboard.type( 'z' );
|
979
|
+
|
980
|
+
await page.keyboard.press( 'Enter' );
|
981
|
+
|
982
|
+
const richTextText = await page.evaluate(
|
983
|
+
() =>
|
984
|
+
document.querySelector(
|
985
|
+
'.block-editor-rich-text__editable'
|
986
|
+
).textContent
|
987
|
+
);
|
988
|
+
// Check that the correct (i.e. last) instance of "a" was replaced with "z".
|
989
|
+
expect( richTextText ).toBe( 'a b c z' );
|
990
|
+
|
991
|
+
const richTextLink = await page.evaluate(
|
992
|
+
() =>
|
993
|
+
document.querySelector(
|
994
|
+
'.block-editor-rich-text__editable a'
|
995
|
+
).textContent
|
996
|
+
);
|
997
|
+
// Check that the correct (i.e. last) instance of "a" was replaced with "z".
|
998
|
+
expect( richTextLink ).toBe( 'z' );
|
999
|
+
} );
|
943
1000
|
} );
|
944
1001
|
} );
|
@@ -395,7 +395,7 @@ describe( 'Multi-block selection', () => {
|
|
395
395
|
await page.keyboard.press( 'Enter' );
|
396
396
|
await page.keyboard.type( '/group' );
|
397
397
|
await page.waitForXPath(
|
398
|
-
|
398
|
+
'//button[@aria-selected="true"][text()="Group"]'
|
399
399
|
);
|
400
400
|
await page.keyboard.press( 'Enter' );
|
401
401
|
|
@@ -624,7 +624,7 @@ describe( 'Multi-block selection', () => {
|
|
624
624
|
await page.keyboard.type( '2' );
|
625
625
|
await pressKeyWithModifier( 'primary', 'a' );
|
626
626
|
await pressKeyWithModifier( 'primary', 'a' );
|
627
|
-
await clickBlockToolbarButton( 'Align' );
|
627
|
+
await clickBlockToolbarButton( 'Align text' );
|
628
628
|
await clickButton( 'Align text center' );
|
629
629
|
|
630
630
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
@@ -658,6 +658,9 @@ describe( 'Multi-block selection', () => {
|
|
658
658
|
it( 'should gradually multi-select', async () => {
|
659
659
|
await clickBlockAppender();
|
660
660
|
await page.keyboard.type( '/columns' );
|
661
|
+
await page.waitForXPath(
|
662
|
+
'//button[@aria-selected="true"][text()="Columns"]'
|
663
|
+
);
|
661
664
|
await page.keyboard.press( 'Enter' );
|
662
665
|
// Select two columns.
|
663
666
|
await page.keyboard.press( 'ArrowRight' );
|
@@ -665,9 +668,13 @@ describe( 'Multi-block selection', () => {
|
|
665
668
|
// Navigate to appender.
|
666
669
|
await page.keyboard.press( 'ArrowRight' );
|
667
670
|
await page.keyboard.press( 'Enter' );
|
668
|
-
//
|
671
|
+
// Wait for inserter results to appear and then select a paragraph.
|
672
|
+
await page.waitForSelector(
|
673
|
+
'.block-editor-inserter__quick-inserter-results .block-editor-block-types-list__item'
|
674
|
+
);
|
669
675
|
await page.keyboard.press( 'Tab' );
|
670
676
|
await page.keyboard.press( 'Enter' );
|
677
|
+
// Type two paragraphs
|
671
678
|
await page.keyboard.type( '1' );
|
672
679
|
await page.keyboard.press( 'Enter' );
|
673
680
|
await page.keyboard.type( '2' );
|
@@ -705,6 +712,9 @@ describe( 'Multi-block selection', () => {
|
|
705
712
|
await page.keyboard.press( 'Enter' );
|
706
713
|
// Add a list.
|
707
714
|
await page.keyboard.type( '/list' );
|
715
|
+
await page.waitForXPath(
|
716
|
+
'//button[@aria-selected="true"][text()="List"]'
|
717
|
+
);
|
708
718
|
await page.keyboard.press( 'Enter' );
|
709
719
|
await page.keyboard.type( '1' );
|
710
720
|
|
@@ -924,6 +934,9 @@ describe( 'Multi-block selection', () => {
|
|
924
934
|
await page.keyboard.press( 'Enter' );
|
925
935
|
await page.keyboard.press( 'Enter' );
|
926
936
|
await page.keyboard.type( '/hr' );
|
937
|
+
await page.waitForXPath(
|
938
|
+
'//button[@aria-selected="true"][text()="Separator"]'
|
939
|
+
);
|
927
940
|
await page.keyboard.press( 'Enter' );
|
928
941
|
await page.keyboard.press( 'ArrowUp' );
|
929
942
|
await page.keyboard.press( 'ArrowUp' );
|
@@ -105,7 +105,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
105
105
|
expect( welcomeGuide ).not.toBeNull();
|
106
106
|
|
107
107
|
// Close the guide
|
108
|
-
await page.click( 'button[aria-label="Close
|
108
|
+
await page.click( '[role="dialog"] button[aria-label="Close"]' );
|
109
109
|
|
110
110
|
// Reload the editor.
|
111
111
|
await page.reload();
|
@@ -125,7 +125,7 @@ describe( 'New User Experience (NUX)', () => {
|
|
125
125
|
expect( welcomeGuide ).not.toBeNull();
|
126
126
|
|
127
127
|
// Close the guide.
|
128
|
-
await page.click( 'button[aria-label="Close
|
128
|
+
await page.click( '[role="dialog"] button[aria-label="Close"]' );
|
129
129
|
|
130
130
|
// Focus should be in post title field.
|
131
131
|
const postTitle = await page.waitForSelector(
|
@@ -408,6 +408,10 @@ describe( 'RichText', () => {
|
|
408
408
|
await button.evaluate( ( element ) => element.scrollIntoView() );
|
409
409
|
await button.click();
|
410
410
|
|
411
|
+
// Wait for the popover with "Text" tab to appear.
|
412
|
+
await page.waitForXPath(
|
413
|
+
'//button[@role="tab"][@aria-selected="true"][text()="Text"]'
|
414
|
+
);
|
411
415
|
// Tab to the "Text" tab.
|
412
416
|
await page.keyboard.press( 'Tab' );
|
413
417
|
// Tab to black.
|
@@ -511,11 +515,15 @@ describe( 'RichText', () => {
|
|
511
515
|
// text in the DOM directly, setting selection in the right place, and
|
512
516
|
// firing `compositionend`.
|
513
517
|
// See https://github.com/puppeteer/puppeteer/issues/4981.
|
514
|
-
await page.evaluate( () => {
|
518
|
+
await page.evaluate( async () => {
|
515
519
|
document.activeElement.textContent = '`a`';
|
516
520
|
const selection = window.getSelection();
|
521
|
+
// The `selectionchange` and `compositionend` events should run in separate event
|
522
|
+
// loop ticks to process all data store updates in time. Native events would be
|
523
|
+
// scheduled the same way.
|
517
524
|
selection.selectAllChildren( document.activeElement );
|
518
525
|
selection.collapseToEnd();
|
526
|
+
await new Promise( ( r ) => setTimeout( r, 0 ) );
|
519
527
|
document.activeElement.dispatchEvent(
|
520
528
|
new CompositionEvent( 'compositionend' )
|
521
529
|
);
|
@@ -12,15 +12,23 @@ import {
|
|
12
12
|
} from '@wordpress/e2e-test-utils';
|
13
13
|
|
14
14
|
describe( 'Post Comments Form', () => {
|
15
|
+
let previousCommentStatus;
|
16
|
+
|
15
17
|
beforeAll( async () => {
|
16
18
|
await activateTheme( 'emptytheme' );
|
17
19
|
await deleteAllTemplates( 'wp_template' );
|
20
|
+
previousCommentStatus = await setOption(
|
21
|
+
'default_comment_status',
|
22
|
+
'closed'
|
23
|
+
);
|
24
|
+
} );
|
25
|
+
|
26
|
+
afterAll( async () => {
|
27
|
+
await setOption( 'default_comment_status', previousCommentStatus );
|
18
28
|
} );
|
19
29
|
|
20
30
|
describe( 'placeholder', () => {
|
21
31
|
it( 'displays in site editor even when comments are closed by default', async () => {
|
22
|
-
await setOption( 'default_comment_status', 'closed' );
|
23
|
-
|
24
32
|
// Navigate to "Singular" post template
|
25
33
|
await visitSiteEditor();
|
26
34
|
await expect( page ).toClick(
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/**
|
2
|
+
* External dependencies
|
3
|
+
*/
|
4
|
+
import { basename, join } from 'path';
|
5
|
+
import { writeFileSync } from 'fs';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* WordPress dependencies
|
9
|
+
*/
|
10
|
+
import { activateTheme, createURL, logout } from '@wordpress/e2e-test-utils';
|
11
|
+
|
12
|
+
describe( 'Front End Performance', () => {
|
13
|
+
const results = {
|
14
|
+
timeToFirstByte: [],
|
15
|
+
};
|
16
|
+
|
17
|
+
beforeAll( async () => {
|
18
|
+
await activateTheme( 'twentytwentythree' );
|
19
|
+
await logout();
|
20
|
+
} );
|
21
|
+
|
22
|
+
afterAll( async () => {
|
23
|
+
await activateTheme( 'twentytwentyone' );
|
24
|
+
const resultsFilename = basename( __filename, '.js' ) + '.results.json';
|
25
|
+
writeFileSync(
|
26
|
+
join( __dirname, resultsFilename ),
|
27
|
+
JSON.stringify( results, null, 2 )
|
28
|
+
);
|
29
|
+
} );
|
30
|
+
|
31
|
+
it( 'Time To First Byte (TTFB)', async () => {
|
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
|
+
} );
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/**
|
2
|
+
* External dependencies
|
3
|
+
*/
|
4
|
+
import { basename, join } from 'path';
|
5
|
+
import { writeFileSync } from 'fs';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* WordPress dependencies
|
9
|
+
*/
|
10
|
+
import { createURL, logout } from '@wordpress/e2e-test-utils';
|
11
|
+
|
12
|
+
describe( 'Front End Performance', () => {
|
13
|
+
const results = {
|
14
|
+
timeToFirstByte: [],
|
15
|
+
};
|
16
|
+
|
17
|
+
beforeAll( async () => {
|
18
|
+
await logout();
|
19
|
+
} );
|
20
|
+
|
21
|
+
afterAll( async () => {
|
22
|
+
const resultsFilename = basename( __filename, '.js' ) + '.results.json';
|
23
|
+
writeFileSync(
|
24
|
+
join( __dirname, resultsFilename ),
|
25
|
+
JSON.stringify( results, null, 2 )
|
26
|
+
);
|
27
|
+
} );
|
28
|
+
|
29
|
+
it( 'Time To First Byte (TTFB)', async () => {
|
30
|
+
// We derive the 75th percentile of the TTFB based on these results.
|
31
|
+
// By running it 16 times, the percentile value would be (75/100)*16=12,
|
32
|
+
// meaning that we discard the worst 4 values.
|
33
|
+
let i = 16;
|
34
|
+
while ( i-- ) {
|
35
|
+
await page.goto( createURL( '/' ) );
|
36
|
+
const navigationTimingJson = await page.evaluate( () =>
|
37
|
+
JSON.stringify( performance.getEntriesByType( 'navigation' ) )
|
38
|
+
);
|
39
|
+
const [ navigationTiming ] = JSON.parse( navigationTimingJson );
|
40
|
+
results.timeToFirstByte.push(
|
41
|
+
navigationTiming.responseStart - navigationTiming.startTime
|
42
|
+
);
|
43
|
+
}
|
44
|
+
} );
|
45
|
+
} );
|
@@ -314,7 +314,12 @@ describe( 'Multi-entity save flow', () => {
|
|
314
314
|
// Open the block settings.
|
315
315
|
await page.click( 'button[aria-label="Settings"]' );
|
316
316
|
|
317
|
-
//
|
317
|
+
// Wait for the font size picker controls.
|
318
|
+
await page.waitForSelector(
|
319
|
+
'.components-font-size-picker__controls'
|
320
|
+
);
|
321
|
+
|
322
|
+
// Change the font size.
|
318
323
|
await page.click(
|
319
324
|
'.components-font-size-picker__controls button[aria-label="Small"]'
|
320
325
|
);
|
@@ -322,7 +327,7 @@ describe( 'Multi-entity save flow', () => {
|
|
322
327
|
// Save all changes.
|
323
328
|
await saveAllChanges();
|
324
329
|
|
325
|
-
// Change the font size
|
330
|
+
// Change the font size.
|
326
331
|
await page.click(
|
327
332
|
'.components-font-size-picker__controls button[aria-label="Medium"]'
|
328
333
|
);
|