@wordpress/e2e-tests 7.4.0 → 7.6.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/config/setup-test-framework.js +9 -0
- package/package.json +7 -7
- package/plugins/block-context.php +1 -1
- package/plugins/iframed-block/block.json +1 -1
- package/plugins/iframed-block.php +2 -2
- package/plugins/iframed-enqueue-block-assets.php +1 -1
- package/plugins/iframed-inline-styles/block.json +1 -1
- package/plugins/iframed-inline-styles/editor.js +1 -1
- package/plugins/iframed-inline-styles.php +3 -3
- package/plugins/iframed-masonry-block/block.json +1 -1
- package/plugins/iframed-masonry-block/editor.js +1 -1
- package/plugins/iframed-masonry-block.php +2 -2
- package/plugins/iframed-multiple-stylesheets/block.json +1 -1
- package/plugins/iframed-multiple-stylesheets/editor.js +1 -1
- package/plugins/iframed-multiple-stylesheets.php +2 -2
- package/plugins/inner-blocks-prioritized-inserter-blocks/index.js +82 -0
- package/plugins/inner-blocks-prioritized-inserter-blocks.php +28 -0
- package/plugins/marquee-function-widget.php +2 -2
- package/specs/editor/blocks/post-title.test.js +5 -4
- package/specs/editor/blocks/site-title.test.js +3 -2
- package/specs/editor/plugins/annotations.test.js +17 -9
- package/specs/editor/plugins/block-variations.test.js +6 -5
- package/specs/editor/plugins/child-blocks.test.js +2 -1
- package/specs/editor/plugins/cpt-locking.test.js +15 -12
- package/specs/editor/plugins/iframed-inline-styles.test.js +7 -4
- package/specs/editor/plugins/iframed-masonry-block.test.js +1 -1
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +1 -1
- package/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +10 -8
- package/specs/editor/plugins/inner-blocks-prioritized-inserter-blocks.test.js +132 -0
- package/specs/editor/various/__snapshots__/links.test.js.snap +0 -24
- package/specs/editor/various/adding-inline-tokens.test.js +0 -1
- package/specs/editor/various/autosave.test.js +2 -1
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +3 -2
- package/specs/editor/various/block-grouping.test.js +5 -4
- package/specs/editor/various/block-hierarchy-navigation.test.js +12 -9
- package/specs/editor/various/change-detection.test.js +20 -19
- package/specs/editor/various/editor-modes.test.js +7 -6
- package/specs/editor/various/embedding.test.js +21 -15
- package/specs/editor/various/inserting-blocks.test.js +19 -14
- package/specs/editor/various/invalid-block.test.js +4 -6
- package/specs/editor/various/keyboard-navigable-blocks.test.js +16 -17
- package/specs/editor/various/links.test.js +22 -154
- package/specs/editor/various/navigable-toolbar.test.js +14 -14
- package/specs/editor/various/nux.test.js +6 -2
- package/specs/editor/various/publish-button.test.js +3 -2
- package/specs/editor/various/publish-panel.test.js +4 -3
- package/specs/editor/various/publishing.test.js +9 -5
- package/specs/editor/various/reusable-blocks.test.js +22 -18
- package/specs/editor/various/rich-text.test.js +7 -6
- package/specs/editor/various/sidebar-permalink.test.js +4 -3
- package/specs/editor/various/taxonomies.test.js +4 -3
- package/specs/editor/various/typewriter.test.js +68 -50
- package/specs/performance/site-editor.test.js +2 -1
- package/specs/site-editor/settings-sidebar.test.js +2 -2
- package/specs/editor/blocks/cover.test.js +0 -177
@@ -31,13 +31,14 @@ describe( 'iframed inline styles', () => {
|
|
31
31
|
await deactivatePlugin( 'gutenberg-test-iframed-inline-styles' );
|
32
32
|
} );
|
33
33
|
|
34
|
-
|
35
|
-
it.skip( 'should load inline styles in iframe', async () => {
|
34
|
+
it( 'should load inline styles in iframe', async () => {
|
36
35
|
await insertBlock( 'Iframed Inline Styles' );
|
37
36
|
|
38
37
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
39
|
-
expect( await getComputedStyle(
|
40
|
-
expect( await getComputedStyle(
|
38
|
+
expect( await getComputedStyle( canvas(), 'padding' ) ).toBe( '20px' );
|
39
|
+
expect( await getComputedStyle( canvas(), 'border-width' ) ).toBe(
|
40
|
+
'2px'
|
41
|
+
);
|
41
42
|
|
42
43
|
await createNewTemplate( 'Iframed Test' );
|
43
44
|
|
@@ -49,5 +50,7 @@ describe( 'iframed inline styles', () => {
|
|
49
50
|
expect( await getComputedStyle( canvas(), 'border-width' ) ).toBe(
|
50
51
|
'2px'
|
51
52
|
);
|
53
|
+
|
54
|
+
expect( console ).toHaveWarned();
|
52
55
|
} );
|
53
56
|
} );
|
@@ -39,7 +39,7 @@ describe( 'iframed masonry block', () => {
|
|
39
39
|
await insertBlock( 'Iframed Masonry Block' );
|
40
40
|
|
41
41
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
42
|
-
expect( await didMasonryLoadCorrectly(
|
42
|
+
expect( await didMasonryLoadCorrectly( canvas() ) ).toBe( true );
|
43
43
|
|
44
44
|
await createNewTemplate( 'Iframed Test' );
|
45
45
|
await canvas().waitForSelector( '.grid-item[style]' );
|
@@ -35,7 +35,7 @@ describe( 'iframed multiple block stylesheets', () => {
|
|
35
35
|
it( 'should load multiple block stylesheets in iframe', async () => {
|
36
36
|
await insertBlock( 'Iframed Multiple Stylesheets' );
|
37
37
|
|
38
|
-
await
|
38
|
+
await canvas().waitForSelector(
|
39
39
|
'.wp-block-test-iframed-multiple-stylesheets'
|
40
40
|
);
|
41
41
|
await createNewTemplate( 'Iframed Test' );
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
openGlobalBlockInserter,
|
11
11
|
closeGlobalBlockInserter,
|
12
12
|
clickBlockToolbarButton,
|
13
|
+
canvas,
|
13
14
|
} from '@wordpress/e2e-test-utils';
|
14
15
|
|
15
16
|
describe( 'Allowed Blocks Setting on InnerBlocks', () => {
|
@@ -32,8 +33,8 @@ describe( 'Allowed Blocks Setting on InnerBlocks', () => {
|
|
32
33
|
const childParagraphSelector = `${ parentBlockSelector } ${ paragraphSelector }`;
|
33
34
|
await insertBlock( 'Allowed Blocks Unset' );
|
34
35
|
await closeGlobalBlockInserter();
|
35
|
-
await
|
36
|
-
await
|
36
|
+
await canvas().waitForSelector( childParagraphSelector );
|
37
|
+
await canvas().click( childParagraphSelector );
|
37
38
|
await openGlobalBlockInserter();
|
38
39
|
await expect(
|
39
40
|
(
|
@@ -47,10 +48,11 @@ describe( 'Allowed Blocks Setting on InnerBlocks', () => {
|
|
47
48
|
const childParagraphSelector = `${ parentBlockSelector } ${ paragraphSelector }`;
|
48
49
|
await insertBlock( 'Allowed Blocks Set' );
|
49
50
|
await closeGlobalBlockInserter();
|
50
|
-
await
|
51
|
-
await
|
51
|
+
await canvas().waitForSelector( childParagraphSelector );
|
52
|
+
await canvas().click( childParagraphSelector );
|
52
53
|
await openGlobalBlockInserter();
|
53
|
-
|
54
|
+
const allowedBlocks = await getAllBlockInserterItemTitles();
|
55
|
+
expect( allowedBlocks.sort() ).toEqual( [
|
54
56
|
'Button',
|
55
57
|
'Gallery',
|
56
58
|
'List',
|
@@ -65,8 +67,8 @@ describe( 'Allowed Blocks Setting on InnerBlocks', () => {
|
|
65
67
|
const parentBlockSelector = '[data-type="test/allowed-blocks-dynamic"]';
|
66
68
|
const blockAppender = '.block-list-appender button';
|
67
69
|
const appenderSelector = `${ parentBlockSelector } ${ blockAppender }`;
|
68
|
-
await
|
69
|
-
await
|
70
|
+
await canvas().waitForSelector( appenderSelector );
|
71
|
+
await canvas().click( appenderSelector );
|
70
72
|
expect( await getAllBlockInserterItemTitles() ).toEqual( [
|
71
73
|
'Image',
|
72
74
|
'List',
|
@@ -75,7 +77,7 @@ describe( 'Allowed Blocks Setting on InnerBlocks', () => {
|
|
75
77
|
await page.$x( `//button//span[contains(text(), 'List')]` )
|
76
78
|
)[ 0 ];
|
77
79
|
await insertButton.click();
|
78
|
-
// Select the list wrapper so the image is
|
80
|
+
// Select the list wrapper so the image is insertable.
|
79
81
|
await page.keyboard.press( 'ArrowUp' );
|
80
82
|
await insertBlock( 'Image' );
|
81
83
|
await closeGlobalBlockInserter();
|
@@ -0,0 +1,132 @@
|
|
1
|
+
/**
|
2
|
+
* WordPress dependencies
|
3
|
+
*/
|
4
|
+
import {
|
5
|
+
activatePlugin,
|
6
|
+
createNewPost,
|
7
|
+
deactivatePlugin,
|
8
|
+
getAllBlockInserterItemTitles,
|
9
|
+
insertBlock,
|
10
|
+
closeGlobalBlockInserter,
|
11
|
+
canvas,
|
12
|
+
} from '@wordpress/e2e-test-utils';
|
13
|
+
|
14
|
+
const QUICK_INSERTER_RESULTS_SELECTOR =
|
15
|
+
'.block-editor-inserter__quick-inserter-results';
|
16
|
+
|
17
|
+
describe( 'Prioritized Inserter Blocks Setting on InnerBlocks', () => {
|
18
|
+
beforeAll( async () => {
|
19
|
+
await activatePlugin(
|
20
|
+
'gutenberg-test-innerblocks-prioritized-inserter-blocks'
|
21
|
+
);
|
22
|
+
} );
|
23
|
+
|
24
|
+
beforeEach( async () => {
|
25
|
+
await createNewPost();
|
26
|
+
} );
|
27
|
+
|
28
|
+
afterAll( async () => {
|
29
|
+
await deactivatePlugin(
|
30
|
+
'gutenberg-test-innerblocks-prioritized-inserter-blocks'
|
31
|
+
);
|
32
|
+
} );
|
33
|
+
|
34
|
+
describe( 'Quick inserter', () => {
|
35
|
+
it( 'uses defaulting ordering if prioritzed blocks setting was not set', async () => {
|
36
|
+
const parentBlockSelector =
|
37
|
+
'[data-type="test/prioritized-inserter-blocks-unset"]';
|
38
|
+
await insertBlock( 'Prioritized Inserter Blocks Unset' );
|
39
|
+
await closeGlobalBlockInserter();
|
40
|
+
|
41
|
+
await page.waitForSelector( parentBlockSelector );
|
42
|
+
|
43
|
+
await page.click(
|
44
|
+
`${ parentBlockSelector } .block-list-appender .block-editor-inserter__toggle`
|
45
|
+
);
|
46
|
+
|
47
|
+
await page.waitForSelector( QUICK_INSERTER_RESULTS_SELECTOR );
|
48
|
+
|
49
|
+
await expect( await getAllBlockInserterItemTitles() ).toHaveLength(
|
50
|
+
6
|
51
|
+
);
|
52
|
+
} );
|
53
|
+
|
54
|
+
it( 'uses the priority ordering if prioritzed blocks setting is set', async () => {
|
55
|
+
const parentBlockSelector =
|
56
|
+
'[data-type="test/prioritized-inserter-blocks-set"]';
|
57
|
+
await insertBlock( 'Prioritized Inserter Blocks Set' );
|
58
|
+
await closeGlobalBlockInserter();
|
59
|
+
|
60
|
+
await page.waitForSelector( parentBlockSelector );
|
61
|
+
|
62
|
+
await page.click(
|
63
|
+
`${ parentBlockSelector } .block-list-appender .block-editor-inserter__toggle`
|
64
|
+
);
|
65
|
+
|
66
|
+
await page.waitForSelector( QUICK_INSERTER_RESULTS_SELECTOR );
|
67
|
+
|
68
|
+
// Should still be only 6 results regardless of the priority ordering.
|
69
|
+
const inserterItems = await getAllBlockInserterItemTitles();
|
70
|
+
|
71
|
+
// Should still be only 6 results regardless of the priority ordering.
|
72
|
+
expect( inserterItems ).toHaveLength( 6 );
|
73
|
+
|
74
|
+
expect( inserterItems.slice( 0, 3 ) ).toEqual( [
|
75
|
+
'Audio',
|
76
|
+
'Spacer',
|
77
|
+
'Code',
|
78
|
+
] );
|
79
|
+
} );
|
80
|
+
|
81
|
+
it( 'obeys allowed blocks over prioritzed blocks setting if conflicted', async () => {
|
82
|
+
const parentBlockSelector =
|
83
|
+
'[data-type="test/prioritized-inserter-blocks-set-with-conflicting-allowed-blocks"]';
|
84
|
+
await insertBlock(
|
85
|
+
'Prioritized Inserter Blocks Set With Conflicting Allowed Blocks'
|
86
|
+
);
|
87
|
+
await closeGlobalBlockInserter();
|
88
|
+
|
89
|
+
await page.waitForSelector( parentBlockSelector );
|
90
|
+
|
91
|
+
await page.click(
|
92
|
+
`${ parentBlockSelector } .block-list-appender .block-editor-inserter__toggle`
|
93
|
+
);
|
94
|
+
|
95
|
+
await page.waitForSelector( QUICK_INSERTER_RESULTS_SELECTOR );
|
96
|
+
|
97
|
+
const inserterItems = await getAllBlockInserterItemTitles();
|
98
|
+
|
99
|
+
expect( inserterItems.slice( 0, 3 ) ).toEqual( [
|
100
|
+
'Spacer',
|
101
|
+
'Code',
|
102
|
+
'Paragraph',
|
103
|
+
] );
|
104
|
+
expect( inserterItems ).toEqual(
|
105
|
+
expect.not.arrayContaining( [ 'Audio' ] )
|
106
|
+
);
|
107
|
+
} );
|
108
|
+
} );
|
109
|
+
describe( 'Slash inserter', () => {
|
110
|
+
it( 'uses the priority ordering if prioritzed blocks setting is set', async () => {
|
111
|
+
await insertBlock( 'Prioritized Inserter Blocks Set' );
|
112
|
+
await canvas().click( '[data-type="core/image"]' );
|
113
|
+
await page.keyboard.press( 'Enter' );
|
114
|
+
await page.keyboard.type( '/' );
|
115
|
+
// Wait for the results to display.
|
116
|
+
await page.waitForSelector( '.components-autocomplete__result' );
|
117
|
+
const inserterItemTitles = await page.evaluate( () => {
|
118
|
+
return Array.from(
|
119
|
+
document.querySelectorAll(
|
120
|
+
'.components-autocomplete__result'
|
121
|
+
)
|
122
|
+
).map( ( { innerText } ) => innerText );
|
123
|
+
} );
|
124
|
+
expect( inserterItemTitles ).toHaveLength( 9 ); // Default suggested blocks number.
|
125
|
+
expect( inserterItemTitles.slice( 0, 3 ) ).toEqual( [
|
126
|
+
'Audio',
|
127
|
+
'Spacer',
|
128
|
+
'Code',
|
129
|
+
] );
|
130
|
+
} );
|
131
|
+
} );
|
132
|
+
} );
|
@@ -12,18 +12,6 @@ exports[`Links can be created by selecting text and clicking Link 1`] = `
|
|
12
12
|
<!-- /wp:paragraph -->"
|
13
13
|
`;
|
14
14
|
|
15
|
-
exports[`Links can be created by selecting text and using keyboard shortcuts 1`] = `
|
16
|
-
"<!-- wp:paragraph -->
|
17
|
-
<p>This is Gutenberg</p>
|
18
|
-
<!-- /wp:paragraph -->"
|
19
|
-
`;
|
20
|
-
|
21
|
-
exports[`Links can be created by selecting text and using keyboard shortcuts 2`] = `
|
22
|
-
"<!-- wp:paragraph -->
|
23
|
-
<p>This is <a href="https://wordpress.org/gutenberg" target="_blank" rel="noreferrer noopener">Gutenberg</a></p>
|
24
|
-
<!-- /wp:paragraph -->"
|
25
|
-
`;
|
26
|
-
|
27
15
|
exports[`Links can be created instantly when a URL is selected 1`] = `
|
28
16
|
"<!-- wp:paragraph -->
|
29
17
|
<p>This is Gutenberg: <a href="https://wordpress.org/gutenberg">https://wordpress.org/gutenberg</a></p>
|
@@ -59,15 +47,3 @@ exports[`Links can be removed 1`] = `
|
|
59
47
|
<p>This is Gutenberg</p>
|
60
48
|
<!-- /wp:paragraph -->"
|
61
49
|
`;
|
62
|
-
|
63
|
-
exports[`Links should contain a label when it should open in a new tab 1`] = `
|
64
|
-
"<!-- wp:paragraph -->
|
65
|
-
<p>This is <a href="http://w.org" target="_blank" rel="noreferrer noopener">WordPress</a></p>
|
66
|
-
<!-- /wp:paragraph -->"
|
67
|
-
`;
|
68
|
-
|
69
|
-
exports[`Links should contain a label when it should open in a new tab 2`] = `
|
70
|
-
"<!-- wp:paragraph -->
|
71
|
-
<p>This is <a href="http://wordpress.org" target="_blank" rel="noreferrer noopener">WordPress</a></p>
|
72
|
-
<!-- /wp:paragraph -->"
|
73
|
-
`;
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
publishPost,
|
10
10
|
saveDraft,
|
11
11
|
toggleOfflineMode,
|
12
|
+
canvas,
|
12
13
|
} from '@wordpress/e2e-test-utils';
|
13
14
|
|
14
15
|
// Constant to override editor preference
|
@@ -258,7 +259,7 @@ describe( 'autosave', () => {
|
|
258
259
|
await page.keyboard.type( 'before publish' );
|
259
260
|
await publishPost();
|
260
261
|
|
261
|
-
await
|
262
|
+
await canvas().click( '[data-type="core/paragraph"]' );
|
262
263
|
await page.keyboard.type( ' after publish' );
|
263
264
|
|
264
265
|
// Trigger remote autosave.
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
clickBlockToolbarButton,
|
10
10
|
clickMenuItem,
|
11
11
|
clickOnCloseModalButton,
|
12
|
+
canvas,
|
12
13
|
} from '@wordpress/e2e-test-utils';
|
13
14
|
|
14
15
|
const createTestParagraphBlocks = async () => {
|
@@ -51,7 +52,7 @@ describe( 'block editor keyboard shortcuts', () => {
|
|
51
52
|
await createTestParagraphBlocks();
|
52
53
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
53
54
|
await pressKeyWithModifier( 'shift', 'ArrowUp' );
|
54
|
-
await
|
55
|
+
await canvas().waitForSelector(
|
55
56
|
'[aria-label="Multiple selected blocks"]'
|
56
57
|
);
|
57
58
|
await moveUp();
|
@@ -63,7 +64,7 @@ describe( 'block editor keyboard shortcuts', () => {
|
|
63
64
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
64
65
|
await page.keyboard.press( 'ArrowUp' );
|
65
66
|
await pressKeyWithModifier( 'shift', 'ArrowUp' );
|
66
|
-
await
|
67
|
+
await canvas().waitForSelector(
|
67
68
|
'[aria-label="Multiple selected blocks"]'
|
68
69
|
);
|
69
70
|
await moveDown();
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
activatePlugin,
|
15
15
|
deactivatePlugin,
|
16
16
|
createReusableBlock,
|
17
|
+
canvas,
|
17
18
|
} from '@wordpress/e2e-test-utils';
|
18
19
|
|
19
20
|
async function insertBlocksOfSameType() {
|
@@ -115,8 +116,8 @@ describe( 'Block Grouping', () => {
|
|
115
116
|
const getParagraphText = async () => {
|
116
117
|
const paragraphInReusableSelector =
|
117
118
|
'.block-editor-block-list__block[data-type="core/block"] p';
|
118
|
-
await
|
119
|
-
return
|
119
|
+
await canvas().waitForSelector( paragraphInReusableSelector );
|
120
|
+
return canvas().$eval(
|
120
121
|
paragraphInReusableSelector,
|
121
122
|
( element ) => element.innerText
|
122
123
|
);
|
@@ -128,14 +129,14 @@ describe( 'Block Grouping', () => {
|
|
128
129
|
await clickBlockToolbarButton( 'Options' );
|
129
130
|
await clickMenuItem( 'Group' );
|
130
131
|
|
131
|
-
let group = await
|
132
|
+
let group = await canvas().$$( '[data-type="core/group"]' );
|
132
133
|
expect( group ).toHaveLength( 1 );
|
133
134
|
// Make sure the paragraph in reusable block exists.
|
134
135
|
expect( await getParagraphText() ).toMatch( paragraphText );
|
135
136
|
|
136
137
|
await clickBlockToolbarButton( 'Options' );
|
137
138
|
await clickMenuItem( 'Ungroup' );
|
138
|
-
group = await
|
139
|
+
group = await canvas().$$( '[data-type="core/group"]' );
|
139
140
|
expect( group ).toHaveLength( 0 );
|
140
141
|
// Make sure the paragraph in reusable block exists.
|
141
142
|
expect( await getParagraphText() ).toEqual( paragraphText );
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
openDocumentSettingsSidebar,
|
11
11
|
getListViewBlocks,
|
12
12
|
switchBlockInspectorTab,
|
13
|
+
canvas,
|
13
14
|
} from '@wordpress/e2e-test-utils';
|
14
15
|
|
15
16
|
async function openListViewSidebar() {
|
@@ -53,7 +54,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
53
54
|
|
54
55
|
it( 'should navigate using the list view sidebar', async () => {
|
55
56
|
await insertBlock( 'Columns' );
|
56
|
-
await
|
57
|
+
await canvas().click( '[aria-label="Two columns; equal split"]' );
|
57
58
|
|
58
59
|
// Add a paragraph in the first column.
|
59
60
|
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
|
@@ -114,7 +115,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
114
115
|
it( 'should navigate block hierarchy using only the keyboard', async () => {
|
115
116
|
await insertBlock( 'Columns' );
|
116
117
|
await openDocumentSettingsSidebar();
|
117
|
-
await
|
118
|
+
await canvas().click( '[aria-label="Two columns; equal split"]' );
|
118
119
|
|
119
120
|
// Add a paragraph in the first column.
|
120
121
|
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
|
@@ -141,13 +142,15 @@ describe( 'Navigating the block hierarchy', () => {
|
|
141
142
|
// Navigate to the third column in the columns block.
|
142
143
|
await pressKeyWithModifier( 'ctrlShift', '`' );
|
143
144
|
await pressKeyWithModifier( 'ctrlShift', '`' );
|
144
|
-
await pressKeyTimes( 'Tab',
|
145
|
+
await pressKeyTimes( 'Tab', 3 );
|
145
146
|
await pressKeyTimes( 'ArrowDown', 4 );
|
146
|
-
await
|
147
|
+
await canvas().waitForSelector(
|
147
148
|
'.is-highlighted[aria-label="Block: Column (3 of 3)"]'
|
148
149
|
);
|
149
150
|
await page.keyboard.press( 'Enter' );
|
150
|
-
await
|
151
|
+
await canvas().waitForSelector(
|
152
|
+
'.is-selected[data-type="core/column"]'
|
153
|
+
);
|
151
154
|
|
152
155
|
// Insert text in the last column block.
|
153
156
|
await page.keyboard.press( 'ArrowDown' ); // Navigate to inserter.
|
@@ -190,12 +193,12 @@ describe( 'Navigating the block hierarchy', () => {
|
|
190
193
|
// Insert a group block.
|
191
194
|
await insertBlock( 'Group' );
|
192
195
|
// Select the default, selected Group layout from the variation picker.
|
193
|
-
await
|
196
|
+
await canvas().click(
|
194
197
|
'button[aria-label="Group: Gather blocks in a container."]'
|
195
198
|
);
|
196
199
|
// Insert some random blocks.
|
197
200
|
// The last block shouldn't be a textual block.
|
198
|
-
await
|
201
|
+
await canvas().click( '.block-list-appender .block-editor-inserter' );
|
199
202
|
const paragraphMenuItem = (
|
200
203
|
await page.$x( `//button//span[contains(text(), 'Paragraph')]` )
|
201
204
|
)[ 0 ];
|
@@ -207,7 +210,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
207
210
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
208
211
|
|
209
212
|
// Unselect the blocks.
|
210
|
-
await
|
213
|
+
await canvas().click( '.editor-post-title' );
|
211
214
|
|
212
215
|
// Try selecting the group block using the Outline.
|
213
216
|
await page.click(
|
@@ -217,7 +220,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
217
220
|
await groupMenuItem.click();
|
218
221
|
|
219
222
|
// The group block's wrapper should be selected.
|
220
|
-
const isGroupBlockSelected = await
|
223
|
+
const isGroupBlockSelected = await canvas().evaluate(
|
221
224
|
() =>
|
222
225
|
document.activeElement.getAttribute( 'data-type' ) ===
|
223
226
|
'core/group'
|
@@ -11,6 +11,7 @@ import {
|
|
11
11
|
openDocumentSettingsSidebar,
|
12
12
|
isCurrentURL,
|
13
13
|
openTypographyToolsPanelMenu,
|
14
|
+
canvas,
|
14
15
|
} from '@wordpress/e2e-test-utils';
|
15
16
|
|
16
17
|
describe( 'Change detection', () => {
|
@@ -78,7 +79,7 @@ describe( 'Change detection', () => {
|
|
78
79
|
} );
|
79
80
|
|
80
81
|
it( 'Should autosave post', async () => {
|
81
|
-
await
|
82
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
82
83
|
|
83
84
|
// Force autosave to occur immediately.
|
84
85
|
await Promise.all( [
|
@@ -94,7 +95,7 @@ describe( 'Change detection', () => {
|
|
94
95
|
} );
|
95
96
|
|
96
97
|
it( 'Should prompt to confirm unsaved changes for autosaved draft for non-content fields', async () => {
|
97
|
-
await
|
98
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
98
99
|
|
99
100
|
// Toggle post as needing review (not persisted for autosave).
|
100
101
|
await ensureSidebarOpened();
|
@@ -117,7 +118,7 @@ describe( 'Change detection', () => {
|
|
117
118
|
} );
|
118
119
|
|
119
120
|
it( 'Should prompt to confirm unsaved changes for autosaved published post', async () => {
|
120
|
-
await
|
121
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
121
122
|
|
122
123
|
await publishPost();
|
123
124
|
|
@@ -130,7 +131,7 @@ describe( 'Change detection', () => {
|
|
130
131
|
] );
|
131
132
|
|
132
133
|
// Should be dirty after autosave change of published post.
|
133
|
-
await
|
134
|
+
await canvas().type( '.editor-post-title__input', '!' );
|
134
135
|
|
135
136
|
await Promise.all( [
|
136
137
|
page.waitForSelector(
|
@@ -162,7 +163,7 @@ describe( 'Change detection', () => {
|
|
162
163
|
} );
|
163
164
|
|
164
165
|
it( 'Should prompt if property changed without save', async () => {
|
165
|
-
await
|
166
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
166
167
|
|
167
168
|
await assertIsDirty( true );
|
168
169
|
} );
|
@@ -175,7 +176,7 @@ describe( 'Change detection', () => {
|
|
175
176
|
} );
|
176
177
|
|
177
178
|
it( 'Should not prompt if changes saved', async () => {
|
178
|
-
await
|
179
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
179
180
|
|
180
181
|
await saveDraft();
|
181
182
|
|
@@ -192,7 +193,7 @@ describe( 'Change detection', () => {
|
|
192
193
|
} );
|
193
194
|
|
194
195
|
it( 'Should not save if all changes saved', async () => {
|
195
|
-
await
|
196
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
196
197
|
|
197
198
|
await saveDraft();
|
198
199
|
|
@@ -205,7 +206,7 @@ describe( 'Change detection', () => {
|
|
205
206
|
} );
|
206
207
|
|
207
208
|
it( 'Should prompt if save failed', async () => {
|
208
|
-
await
|
209
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
209
210
|
|
210
211
|
await page.setOfflineMode( true );
|
211
212
|
|
@@ -231,7 +232,7 @@ describe( 'Change detection', () => {
|
|
231
232
|
} );
|
232
233
|
|
233
234
|
it( 'Should prompt if changes and save is in-flight', async () => {
|
234
|
-
await
|
235
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
235
236
|
|
236
237
|
// Hold the posts request so we don't deal with race conditions of the
|
237
238
|
// save completing early. Other requests should be allowed to continue,
|
@@ -247,7 +248,7 @@ describe( 'Change detection', () => {
|
|
247
248
|
} );
|
248
249
|
|
249
250
|
it( 'Should prompt if changes made while save is in-flight', async () => {
|
250
|
-
await
|
251
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
251
252
|
|
252
253
|
// Hold the posts request so we don't deal with race conditions of the
|
253
254
|
// save completing early. Other requests should be allowed to continue,
|
@@ -257,7 +258,7 @@ describe( 'Change detection', () => {
|
|
257
258
|
// Keyboard shortcut Ctrl+S save.
|
258
259
|
await pressKeyWithModifier( 'primary', 'S' );
|
259
260
|
|
260
|
-
await
|
261
|
+
await canvas().type( '.editor-post-title__input', '!' );
|
261
262
|
await page.waitForSelector( '.editor-post-save-draft' );
|
262
263
|
|
263
264
|
await releaseSaveIntercept();
|
@@ -266,7 +267,7 @@ describe( 'Change detection', () => {
|
|
266
267
|
} );
|
267
268
|
|
268
269
|
it( 'Should prompt if property changes made while save is in-flight, and save completes', async () => {
|
269
|
-
await
|
270
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
270
271
|
|
271
272
|
// Hold the posts request so we don't deal with race conditions of the
|
272
273
|
// save completing early.
|
@@ -282,7 +283,7 @@ describe( 'Change detection', () => {
|
|
282
283
|
);
|
283
284
|
|
284
285
|
// Dirty post while save is in-flight.
|
285
|
-
await
|
286
|
+
await canvas().type( '.editor-post-title__input', '!' );
|
286
287
|
|
287
288
|
// Allow save to complete. Disabling interception flushes pending.
|
288
289
|
await Promise.all( [ savedPromise, releaseSaveIntercept() ] );
|
@@ -291,7 +292,7 @@ describe( 'Change detection', () => {
|
|
291
292
|
} );
|
292
293
|
|
293
294
|
it( 'Should prompt if block revision is made while save is in-flight, and save completes', async () => {
|
294
|
-
await
|
295
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
295
296
|
|
296
297
|
// Hold the posts request so we don't deal with race conditions of the
|
297
298
|
// save completing early.
|
@@ -324,7 +325,7 @@ describe( 'Change detection', () => {
|
|
324
325
|
await saveDraft();
|
325
326
|
|
326
327
|
// Verify that the title is empty.
|
327
|
-
const title = await
|
328
|
+
const title = await canvas().$eval(
|
328
329
|
'.editor-post-title__input',
|
329
330
|
// Trim padding non-breaking space.
|
330
331
|
( element ) => element.textContent.trim()
|
@@ -337,7 +338,7 @@ describe( 'Change detection', () => {
|
|
337
338
|
|
338
339
|
it( 'should not prompt to confirm unsaved changes when trashing an existing post', async () => {
|
339
340
|
// Enter title.
|
340
|
-
await
|
341
|
+
await canvas().type( '.editor-post-title__input', 'Hello World' );
|
341
342
|
|
342
343
|
// Save.
|
343
344
|
await saveDraft();
|
@@ -381,7 +382,7 @@ describe( 'Change detection', () => {
|
|
381
382
|
] );
|
382
383
|
|
383
384
|
// Change the paragraph's `drop cap`.
|
384
|
-
await
|
385
|
+
await canvas().click( '[data-type="core/paragraph"]' );
|
385
386
|
|
386
387
|
await openTypographyToolsPanelMenu();
|
387
388
|
await page.click( 'button[aria-label="Show Drop cap"]' );
|
@@ -390,7 +391,7 @@ describe( 'Change detection', () => {
|
|
390
391
|
"//label[contains(text(), 'Drop cap')]"
|
391
392
|
);
|
392
393
|
await dropCapToggle.click();
|
393
|
-
await
|
394
|
+
await canvas().click( '[data-type="core/paragraph"]' );
|
394
395
|
|
395
396
|
// Check that the post is dirty.
|
396
397
|
await page.waitForSelector( '.editor-post-save-draft' );
|
@@ -402,7 +403,7 @@ describe( 'Change detection', () => {
|
|
402
403
|
] );
|
403
404
|
|
404
405
|
// Change the paragraph's `drop cap` again.
|
405
|
-
await
|
406
|
+
await canvas().click( '[data-type="core/paragraph"]' );
|
406
407
|
await dropCapToggle.click();
|
407
408
|
|
408
409
|
// Check that the post is dirty.
|
@@ -11,6 +11,7 @@ import {
|
|
11
11
|
pressKeyTimes,
|
12
12
|
pressKeyWithModifier,
|
13
13
|
openTypographyToolsPanelMenu,
|
14
|
+
canvas,
|
14
15
|
} from '@wordpress/e2e-test-utils';
|
15
16
|
|
16
17
|
describe( 'Editing modes (visual/HTML)', () => {
|
@@ -22,7 +23,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
22
23
|
|
23
24
|
it( 'should switch between visual and HTML modes', async () => {
|
24
25
|
// This block should be in "visual" mode by default.
|
25
|
-
let visualBlock = await
|
26
|
+
let visualBlock = await canvas().$$( '[data-block].rich-text' );
|
26
27
|
expect( visualBlock ).toHaveLength( 1 );
|
27
28
|
|
28
29
|
// Change editing mode from "Visual" to "HTML".
|
@@ -30,7 +31,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
30
31
|
await clickMenuItem( 'Edit as HTML' );
|
31
32
|
|
32
33
|
// Wait for the block to be converted to HTML editing mode.
|
33
|
-
const htmlBlock = await
|
34
|
+
const htmlBlock = await canvas().$$(
|
34
35
|
'[data-block] .block-editor-block-list__block-html-textarea'
|
35
36
|
);
|
36
37
|
expect( htmlBlock ).toHaveLength( 1 );
|
@@ -40,7 +41,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
40
41
|
await clickMenuItem( 'Edit visually' );
|
41
42
|
|
42
43
|
// This block should be in "visual" mode by default.
|
43
|
-
visualBlock = await
|
44
|
+
visualBlock = await canvas().$$( '[data-block].rich-text' );
|
44
45
|
expect( visualBlock ).toHaveLength( 1 );
|
45
46
|
} );
|
46
47
|
|
@@ -67,7 +68,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
67
68
|
await clickMenuItem( 'Edit as HTML' );
|
68
69
|
|
69
70
|
// Make sure the paragraph content is rendered as expected.
|
70
|
-
let htmlBlockContent = await
|
71
|
+
let htmlBlockContent = await canvas().$eval(
|
71
72
|
'.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea',
|
72
73
|
( node ) => node.textContent
|
73
74
|
);
|
@@ -83,7 +84,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
83
84
|
await dropCapToggle.click();
|
84
85
|
|
85
86
|
// Make sure the HTML content updated.
|
86
|
-
htmlBlockContent = await
|
87
|
+
htmlBlockContent = await canvas().$eval(
|
87
88
|
'.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea',
|
88
89
|
( node ) => node.textContent
|
89
90
|
);
|
@@ -138,7 +139,7 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
138
139
|
const editPosition = textContent.indexOf( 'Hello' );
|
139
140
|
|
140
141
|
// Replace the word 'Hello' with 'Hi'.
|
141
|
-
await
|
142
|
+
await canvas().click( '.editor-post-title__input' );
|
142
143
|
await page.keyboard.press( 'Tab' );
|
143
144
|
await pressKeyTimes( 'ArrowRight', editPosition );
|
144
145
|
await pressKeyTimes( 'Delete', 5 );
|