@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
package/CHANGELOG.md
CHANGED
@@ -158,6 +158,15 @@ function observeConsoleLogging() {
|
|
158
158
|
return;
|
159
159
|
}
|
160
160
|
|
161
|
+
// Ignore framer-motion warnings about reduced motion.
|
162
|
+
if (
|
163
|
+
text.includes(
|
164
|
+
'You have Reduced Motion enabled on your device. Animations may not appear as expected.'
|
165
|
+
)
|
166
|
+
) {
|
167
|
+
return;
|
168
|
+
}
|
169
|
+
|
161
170
|
const logFunction = OBSERVED_CONSOLE_MESSAGE_TYPES[ type ];
|
162
171
|
|
163
172
|
// As of Puppeteer 1.6.1, `message.text()` wrongly returns an object of
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.6.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": "^10.
|
27
|
-
"@wordpress/jest-console": "^7.
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^6.
|
29
|
-
"@wordpress/scripts": "^26.
|
30
|
-
"@wordpress/url": "^3.
|
26
|
+
"@wordpress/e2e-test-utils": "^10.6.0",
|
27
|
+
"@wordpress/jest-console": "^7.6.0",
|
28
|
+
"@wordpress/jest-puppeteer-axe": "^6.6.0",
|
29
|
+
"@wordpress/scripts": "^26.6.0",
|
30
|
+
"@wordpress/url": "^3.36.0",
|
31
31
|
"chalk": "^4.0.0",
|
32
32
|
"expect-puppeteer": "^4.4.0",
|
33
33
|
"filenamify": "^4.2.0",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"publishConfig": {
|
46
46
|
"access": "public"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "a92f606309b1541b834ff9b0a76ed2a466fc45ed"
|
49
49
|
}
|
@@ -52,7 +52,7 @@ function gutenberg_test_register_context_blocks() {
|
|
52
52
|
'postId',
|
53
53
|
'postType',
|
54
54
|
),
|
55
|
-
'render_callback' => function( $attributes, $content, $block ) {
|
55
|
+
'render_callback' => static function( $attributes, $content, $block ) {
|
56
56
|
$ordered_context = array(
|
57
57
|
$block->context['gutenberg/recordId'],
|
58
58
|
$block->context['postId'],
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'setup_theme',
|
12
|
-
function() {
|
12
|
+
static function() {
|
13
13
|
add_theme_support( 'block-templates' );
|
14
14
|
}
|
15
15
|
);
|
16
16
|
|
17
17
|
add_action(
|
18
18
|
'init',
|
19
|
-
function() {
|
19
|
+
static function() {
|
20
20
|
wp_register_script(
|
21
21
|
'iframed-block-jquery-test',
|
22
22
|
plugin_dir_url( __FILE__ ) . 'iframed-block/jquery.test.js',
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'setup_theme',
|
12
|
-
function() {
|
12
|
+
static function() {
|
13
13
|
add_theme_support( 'block-templates' );
|
14
14
|
}
|
15
15
|
);
|
16
16
|
|
17
17
|
add_action(
|
18
18
|
'init',
|
19
|
-
function() {
|
19
|
+
static function() {
|
20
20
|
wp_register_script(
|
21
21
|
'iframed-inline-styles-editor-script',
|
22
22
|
plugin_dir_url( __FILE__ ) . 'iframed-inline-styles/editor.js',
|
@@ -40,7 +40,7 @@ add_action(
|
|
40
40
|
|
41
41
|
add_action(
|
42
42
|
'enqueue_block_editor_assets',
|
43
|
-
function() {
|
43
|
+
static function() {
|
44
44
|
wp_enqueue_style(
|
45
45
|
'iframed-inline-styles-compat-style',
|
46
46
|
plugin_dir_url( __FILE__ ) . 'iframed-inline-styles/compat-style.css',
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'setup_theme',
|
12
|
-
function() {
|
12
|
+
static function() {
|
13
13
|
add_theme_support( 'block-templates' );
|
14
14
|
}
|
15
15
|
);
|
16
16
|
|
17
17
|
add_action(
|
18
18
|
'init',
|
19
|
-
function() {
|
19
|
+
static function() {
|
20
20
|
wp_register_script(
|
21
21
|
'iframed-masonry-block-editor',
|
22
22
|
plugin_dir_url( __FILE__ ) . 'iframed-masonry-block/editor.js',
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'setup_theme',
|
12
|
-
function() {
|
12
|
+
static function() {
|
13
13
|
add_theme_support( 'block-templates' );
|
14
14
|
}
|
15
15
|
);
|
16
16
|
|
17
17
|
add_action(
|
18
18
|
'init',
|
19
|
-
function() {
|
19
|
+
static function() {
|
20
20
|
wp_register_script(
|
21
21
|
'iframed-multiple-stylesheets-editor-script',
|
22
22
|
plugin_dir_url( __FILE__ ) . 'iframed-multiple-stylesheets/editor.js',
|
@@ -0,0 +1,82 @@
|
|
1
|
+
( function () {
|
2
|
+
const { registerBlockType } = wp.blocks;
|
3
|
+
const { createElement: el } = wp.element;
|
4
|
+
const { InnerBlocks } = wp.blockEditor;
|
5
|
+
|
6
|
+
const divProps = {
|
7
|
+
className: 'product',
|
8
|
+
style: { outline: '1px solid gray', padding: 5 },
|
9
|
+
};
|
10
|
+
|
11
|
+
// without a placeholder within the inner blocks it can be difficult to select the block using e2e tests
|
12
|
+
// especially using Puppeteer, so we use an image block which has a placeholder.
|
13
|
+
const template = [
|
14
|
+
[ 'core/image' ],
|
15
|
+
];
|
16
|
+
|
17
|
+
const save = function () {
|
18
|
+
return el( 'div', divProps, el( InnerBlocks.Content ) );
|
19
|
+
};
|
20
|
+
registerBlockType( 'test/prioritized-inserter-blocks-unset', {
|
21
|
+
title: 'Prioritized Inserter Blocks Unset',
|
22
|
+
icon: 'carrot',
|
23
|
+
category: 'text',
|
24
|
+
|
25
|
+
edit() {
|
26
|
+
return el( 'div', divProps, el( InnerBlocks, { template } ) );
|
27
|
+
},
|
28
|
+
|
29
|
+
save,
|
30
|
+
} );
|
31
|
+
|
32
|
+
registerBlockType( 'test/prioritized-inserter-blocks-set', {
|
33
|
+
title: 'Prioritized Inserter Blocks Set',
|
34
|
+
icon: 'carrot',
|
35
|
+
category: 'text',
|
36
|
+
edit() {
|
37
|
+
return el(
|
38
|
+
'div',
|
39
|
+
divProps,
|
40
|
+
el( InnerBlocks, {
|
41
|
+
template,
|
42
|
+
prioritizedInserterBlocks: [
|
43
|
+
'core/audio',
|
44
|
+
'core/spacer',
|
45
|
+
'core/code',
|
46
|
+
],
|
47
|
+
} )
|
48
|
+
);
|
49
|
+
},
|
50
|
+
|
51
|
+
save,
|
52
|
+
} );
|
53
|
+
|
54
|
+
registerBlockType( 'test/prioritized-inserter-blocks-set-with-conflicting-allowed-blocks', {
|
55
|
+
title: 'Prioritized Inserter Blocks Set With Conflicting Allowed Blocks',
|
56
|
+
icon: 'carrot',
|
57
|
+
category: 'text',
|
58
|
+
edit() {
|
59
|
+
return el(
|
60
|
+
'div',
|
61
|
+
divProps,
|
62
|
+
el( InnerBlocks, {
|
63
|
+
template,
|
64
|
+
allowedBlocks: [
|
65
|
+
'core/spacer',
|
66
|
+
'core/code',
|
67
|
+
'core/paragraph',
|
68
|
+
'core/heading'
|
69
|
+
],
|
70
|
+
prioritizedInserterBlocks: [
|
71
|
+
'core/audio', // this is **not** in the allowedBlocks list
|
72
|
+
'core/spacer',
|
73
|
+
'core/code',
|
74
|
+
],
|
75
|
+
} )
|
76
|
+
);
|
77
|
+
},
|
78
|
+
|
79
|
+
save,
|
80
|
+
} );
|
81
|
+
|
82
|
+
} )();
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Plugin Name: Gutenberg Test InnerBlocks Prioritized Inserter Blocks
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
5
|
+
* Author: Gutenberg Team
|
6
|
+
*
|
7
|
+
* @package gutenberg-test-inner-blocks-prioritized-inserter-blocks
|
8
|
+
*/
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Registers a custom script for the plugin.
|
12
|
+
*/
|
13
|
+
function enqueue_inner_blocks_prioritized_inserter_blocks_script() {
|
14
|
+
wp_enqueue_script(
|
15
|
+
'gutenberg-test-inner-blocks-prioritized-inserter-blocks',
|
16
|
+
plugins_url( 'inner-blocks-prioritized-inserter-blocks/index.js', __FILE__ ),
|
17
|
+
array(
|
18
|
+
'wp-blocks',
|
19
|
+
'wp-block-editor',
|
20
|
+
'wp-element',
|
21
|
+
'wp-i18n',
|
22
|
+
),
|
23
|
+
filemtime( plugin_dir_path( __FILE__ ) . 'inner-blocks-prioritized-inserter-blocks/index.js' ),
|
24
|
+
true
|
25
|
+
);
|
26
|
+
}
|
27
|
+
|
28
|
+
add_action( 'init', 'enqueue_inner_blocks_prioritized_inserter_blocks_script' );
|
@@ -14,7 +14,7 @@ function marquee_greeting_init() {
|
|
14
14
|
wp_register_sidebar_widget(
|
15
15
|
'marquee_greeting',
|
16
16
|
'Marquee Greeting',
|
17
|
-
function() {
|
17
|
+
static function() {
|
18
18
|
$greeting = get_option( 'marquee_greeting', 'Hello!' );
|
19
19
|
printf( '<marquee>%s</marquee>', esc_html( $greeting ) );
|
20
20
|
}
|
@@ -23,7 +23,7 @@ function marquee_greeting_init() {
|
|
23
23
|
wp_register_widget_control(
|
24
24
|
'marquee_greeting',
|
25
25
|
'Marquee Greeting',
|
26
|
-
function() {
|
26
|
+
static function() {
|
27
27
|
if ( isset( $_POST['marquee-greeting'] ) ) {
|
28
28
|
update_option(
|
29
29
|
'marquee_greeting',
|
@@ -5,6 +5,7 @@ import {
|
|
5
5
|
createNewPost,
|
6
6
|
insertBlock,
|
7
7
|
saveDraft,
|
8
|
+
canvas,
|
8
9
|
} from '@wordpress/e2e-test-utils';
|
9
10
|
|
10
11
|
describe( 'Post Title block', () => {
|
@@ -14,11 +15,11 @@ describe( 'Post Title block', () => {
|
|
14
15
|
|
15
16
|
it( 'Can edit the post title', async () => {
|
16
17
|
// Create a block with some text that will trigger a list creation.
|
17
|
-
await insertBlock( '
|
18
|
+
await insertBlock( 'Title' );
|
18
19
|
const editablePostTitleSelector =
|
19
20
|
'.wp-block-post-title[contenteditable="true"]';
|
20
|
-
await
|
21
|
-
await
|
21
|
+
await canvas().waitForSelector( editablePostTitleSelector );
|
22
|
+
await canvas().focus( editablePostTitleSelector );
|
22
23
|
|
23
24
|
// Create a second list item.
|
24
25
|
await page.keyboard.type( 'Just tweaking the post title' );
|
@@ -26,7 +27,7 @@ describe( 'Post Title block', () => {
|
|
26
27
|
await saveDraft();
|
27
28
|
await page.reload();
|
28
29
|
await page.waitForSelector( '.edit-post-layout' );
|
29
|
-
const title = await
|
30
|
+
const title = await canvas().$eval(
|
30
31
|
'.editor-post-title__input',
|
31
32
|
( element ) => element.textContent
|
32
33
|
);
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
pressKeyWithModifier,
|
10
10
|
setOption,
|
11
11
|
openDocumentSettingsSidebar,
|
12
|
+
canvas,
|
12
13
|
} from '@wordpress/e2e-test-utils';
|
13
14
|
|
14
15
|
const saveEntities = async () => {
|
@@ -45,8 +46,8 @@ describe( 'Site Title block', () => {
|
|
45
46
|
await insertBlock( 'Site Title' );
|
46
47
|
const editableSiteTitleSelector =
|
47
48
|
'[aria-label="Block: Site Title"] a[contenteditable="true"]';
|
48
|
-
await
|
49
|
-
await
|
49
|
+
await canvas().waitForSelector( editableSiteTitleSelector );
|
50
|
+
await canvas().focus( editableSiteTitleSelector );
|
50
51
|
await pressKeyWithModifier( 'primary', 'a' );
|
51
52
|
|
52
53
|
await page.keyboard.type( 'New Site Title' );
|
@@ -8,6 +8,7 @@ import {
|
|
8
8
|
clickOnMoreMenuItem,
|
9
9
|
createNewPost,
|
10
10
|
deactivatePlugin,
|
11
|
+
canvas,
|
11
12
|
} from '@wordpress/e2e-test-utils';
|
12
13
|
|
13
14
|
const clickOnBlockSettingsMenuItem = async ( buttonLabel ) => {
|
@@ -28,6 +29,13 @@ describe( 'Annotations', () => {
|
|
28
29
|
|
29
30
|
beforeEach( async () => {
|
30
31
|
await createNewPost();
|
32
|
+
// To do: run with iframe.
|
33
|
+
await page.evaluate( () => {
|
34
|
+
window.wp.blocks.registerBlockType( 'test/v2', {
|
35
|
+
apiVersion: '2',
|
36
|
+
title: 'test',
|
37
|
+
} );
|
38
|
+
} );
|
31
39
|
} );
|
32
40
|
|
33
41
|
/**
|
@@ -51,7 +59,7 @@ describe( 'Annotations', () => {
|
|
51
59
|
await page.$x( "//button[contains(text(), 'Add annotation')]" )
|
52
60
|
)[ 0 ];
|
53
61
|
await addAnnotationButton.click();
|
54
|
-
await
|
62
|
+
await canvas().evaluate( () =>
|
55
63
|
document.querySelector( '.wp-block-paragraph' ).focus()
|
56
64
|
);
|
57
65
|
}
|
@@ -67,7 +75,7 @@ describe( 'Annotations', () => {
|
|
67
75
|
await page.$x( "//button[contains(text(), 'Remove annotations')]" )
|
68
76
|
)[ 0 ];
|
69
77
|
await addAnnotationButton.click();
|
70
|
-
await
|
78
|
+
await canvas().evaluate( () =>
|
71
79
|
document.querySelector( '[contenteditable]' ).focus()
|
72
80
|
);
|
73
81
|
}
|
@@ -78,11 +86,11 @@ describe( 'Annotations', () => {
|
|
78
86
|
* @return {Promise<string>} The annotated text.
|
79
87
|
*/
|
80
88
|
async function getAnnotatedText() {
|
81
|
-
const annotations = await
|
89
|
+
const annotations = await canvas().$$( ANNOTATIONS_SELECTOR );
|
82
90
|
|
83
91
|
const annotation = annotations[ 0 ];
|
84
92
|
|
85
|
-
return await
|
93
|
+
return await canvas().evaluate( ( el ) => el.innerText, annotation );
|
86
94
|
}
|
87
95
|
|
88
96
|
/**
|
@@ -91,7 +99,7 @@ describe( 'Annotations', () => {
|
|
91
99
|
* @return {Promise<string>} Inner HTML.
|
92
100
|
*/
|
93
101
|
async function getRichTextInnerHTML() {
|
94
|
-
const htmlContent = await
|
102
|
+
const htmlContent = await canvas().$$( '.wp-block-paragraph' );
|
95
103
|
return await page.evaluate( ( el ) => {
|
96
104
|
return el.innerHTML;
|
97
105
|
}, htmlContent[ 0 ] );
|
@@ -102,12 +110,12 @@ describe( 'Annotations', () => {
|
|
102
110
|
|
103
111
|
await clickOnMoreMenuItem( 'Annotations' );
|
104
112
|
|
105
|
-
let annotations = await
|
113
|
+
let annotations = await canvas().$$( ANNOTATIONS_SELECTOR );
|
106
114
|
expect( annotations ).toHaveLength( 0 );
|
107
115
|
|
108
116
|
await annotateFirstBlock( 9, 13 );
|
109
117
|
|
110
|
-
annotations = await
|
118
|
+
annotations = await canvas().$$( ANNOTATIONS_SELECTOR );
|
111
119
|
expect( annotations ).toHaveLength( 1 );
|
112
120
|
|
113
121
|
const text = await getAnnotatedText();
|
@@ -115,7 +123,7 @@ describe( 'Annotations', () => {
|
|
115
123
|
|
116
124
|
await clickOnBlockSettingsMenuItem( 'Edit as HTML' );
|
117
125
|
|
118
|
-
const htmlContent = await
|
126
|
+
const htmlContent = await canvas().$$(
|
119
127
|
'.block-editor-block-list__block-html-textarea'
|
120
128
|
);
|
121
129
|
const html = await page.evaluate( ( el ) => {
|
@@ -136,7 +144,7 @@ describe( 'Annotations', () => {
|
|
136
144
|
await page.keyboard.type( 'D' );
|
137
145
|
|
138
146
|
await removeAnnotations();
|
139
|
-
const htmlContent = await
|
147
|
+
const htmlContent = await canvas().$$( '.wp-block-paragraph' );
|
140
148
|
const html = await page.evaluate( ( el ) => {
|
141
149
|
return el.innerHTML;
|
142
150
|
}, htmlContent[ 0 ] );
|
@@ -11,6 +11,7 @@ import {
|
|
11
11
|
openDocumentSettingsSidebar,
|
12
12
|
togglePreferencesOption,
|
13
13
|
toggleMoreMenu,
|
14
|
+
canvas,
|
14
15
|
} from '@wordpress/e2e-test-utils';
|
15
16
|
|
16
17
|
describe( 'Block variations', () => {
|
@@ -45,7 +46,7 @@ describe( 'Block variations', () => {
|
|
45
46
|
await insertBlock( 'Large Quote' );
|
46
47
|
|
47
48
|
expect(
|
48
|
-
await
|
49
|
+
await canvas().$(
|
49
50
|
'.wp-block[data-type="core/quote"] blockquote.is-style-large'
|
50
51
|
)
|
51
52
|
).toBeDefined();
|
@@ -58,7 +59,7 @@ describe( 'Block variations', () => {
|
|
58
59
|
await page.keyboard.press( 'Enter' );
|
59
60
|
|
60
61
|
expect(
|
61
|
-
await
|
62
|
+
await canvas().$(
|
62
63
|
'.wp-block[data-type="core/quote"] blockquote.is-style-large'
|
63
64
|
)
|
64
65
|
).toBeDefined();
|
@@ -75,7 +76,7 @@ describe( 'Block variations', () => {
|
|
75
76
|
test( 'Insert the Success Message block variation', async () => {
|
76
77
|
await insertBlock( 'Success Message' );
|
77
78
|
|
78
|
-
const successMessageBlock = await
|
79
|
+
const successMessageBlock = await canvas().$(
|
79
80
|
'.wp-block[data-type="core/paragraph"]'
|
80
81
|
);
|
81
82
|
expect( successMessageBlock ).toBeDefined();
|
@@ -86,12 +87,12 @@ describe( 'Block variations', () => {
|
|
86
87
|
test( 'Pick the additional variation in the inserted Columns block', async () => {
|
87
88
|
await insertBlock( 'Columns' );
|
88
89
|
|
89
|
-
const fourColumnsVariation = await
|
90
|
+
const fourColumnsVariation = await canvas().waitForSelector(
|
90
91
|
'.wp-block[data-type="core/columns"] .block-editor-block-variation-picker__variation[aria-label="Four columns"]'
|
91
92
|
);
|
92
93
|
await fourColumnsVariation.click();
|
93
94
|
expect(
|
94
|
-
await
|
95
|
+
await canvas().$$(
|
95
96
|
'.wp-block[data-type="core/columns"] .wp-block[data-type="core/column"]'
|
96
97
|
)
|
97
98
|
).toHaveLength( 4 );
|
@@ -56,7 +56,8 @@ describe( 'Child Blocks', () => {
|
|
56
56
|
'[data-type="test/child-blocks-restricted-parent"] .block-editor-default-block-appender'
|
57
57
|
);
|
58
58
|
await openGlobalBlockInserter();
|
59
|
-
|
59
|
+
const allowedBlocks = await getAllBlockInserterItemTitles();
|
60
|
+
expect( allowedBlocks.sort() ).toEqual( [
|
60
61
|
'Child Blocks Child',
|
61
62
|
'Image',
|
62
63
|
'Paragraph',
|
@@ -12,6 +12,7 @@ import {
|
|
12
12
|
pressKeyTimes,
|
13
13
|
pressKeyWithModifier,
|
14
14
|
setPostContent,
|
15
|
+
canvas,
|
15
16
|
} from '@wordpress/e2e-test-utils';
|
16
17
|
|
17
18
|
describe( 'cpt locking', () => {
|
@@ -35,7 +36,7 @@ describe( 'cpt locking', () => {
|
|
35
36
|
};
|
36
37
|
|
37
38
|
const shouldNotAllowBlocksToBeRemoved = async () => {
|
38
|
-
await
|
39
|
+
await canvas().type(
|
39
40
|
'.block-editor-rich-text__editable[data-type="core/paragraph"]',
|
40
41
|
'p1'
|
41
42
|
);
|
@@ -46,12 +47,12 @@ describe( 'cpt locking', () => {
|
|
46
47
|
};
|
47
48
|
|
48
49
|
const shouldAllowBlocksToBeMoved = async () => {
|
49
|
-
await
|
50
|
+
await canvas().click(
|
50
51
|
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]'
|
51
52
|
);
|
52
53
|
expect( await page.$( 'button[aria-label="Move up"]' ) ).not.toBeNull();
|
53
54
|
await page.click( 'button[aria-label="Move up"]' );
|
54
|
-
await
|
55
|
+
await canvas().type(
|
55
56
|
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]',
|
56
57
|
'p1'
|
57
58
|
);
|
@@ -71,14 +72,14 @@ describe( 'cpt locking', () => {
|
|
71
72
|
);
|
72
73
|
|
73
74
|
it( 'should not allow blocks to be moved', async () => {
|
74
|
-
await
|
75
|
+
await canvas().click(
|
75
76
|
'.block-editor-rich-text__editable[data-type="core/paragraph"]'
|
76
77
|
);
|
77
78
|
expect( await page.$( 'button[aria-label="Move up"]' ) ).toBeNull();
|
78
79
|
} );
|
79
80
|
|
80
81
|
it( 'should not error when deleting the cotents of a paragraph', async () => {
|
81
|
-
await
|
82
|
+
await canvas().click(
|
82
83
|
'.block-editor-block-list__block[data-type="core/paragraph"]'
|
83
84
|
);
|
84
85
|
const textToType = 'Paragraph';
|
@@ -88,7 +89,7 @@ describe( 'cpt locking', () => {
|
|
88
89
|
} );
|
89
90
|
|
90
91
|
it( 'should insert line breaks when using enter and shift-enter', async () => {
|
91
|
-
await
|
92
|
+
await canvas().click(
|
92
93
|
'.block-editor-block-list__block[data-type="core/paragraph"]'
|
93
94
|
);
|
94
95
|
await page.keyboard.type( 'First line' );
|
@@ -118,12 +119,14 @@ describe( 'cpt locking', () => {
|
|
118
119
|
} );
|
119
120
|
|
120
121
|
it( 'should not allow blocks to be inserted in inner blocks', async () => {
|
121
|
-
await
|
122
|
+
await canvas().click(
|
123
|
+
'button[aria-label="Two columns; equal split"]'
|
124
|
+
);
|
122
125
|
await page.evaluate(
|
123
126
|
() => new Promise( window.requestIdleCallback )
|
124
127
|
);
|
125
128
|
expect(
|
126
|
-
await
|
129
|
+
await canvas().$(
|
127
130
|
'.wp-block-column .block-editor-button-block-appender'
|
128
131
|
)
|
129
132
|
).toBeNull();
|
@@ -173,7 +176,7 @@ describe( 'cpt locking', () => {
|
|
173
176
|
} );
|
174
177
|
|
175
178
|
it( 'should allow blocks to be removed', async () => {
|
176
|
-
await
|
179
|
+
await canvas().type(
|
177
180
|
'.block-editor-rich-text__editable[data-type="core/paragraph"]',
|
178
181
|
'p1'
|
179
182
|
);
|
@@ -193,7 +196,7 @@ describe( 'cpt locking', () => {
|
|
193
196
|
} );
|
194
197
|
|
195
198
|
it( 'should allow blocks to be removed', async () => {
|
196
|
-
await
|
199
|
+
await canvas().type(
|
197
200
|
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]',
|
198
201
|
'p1'
|
199
202
|
);
|
@@ -219,7 +222,7 @@ describe( 'cpt locking', () => {
|
|
219
222
|
);
|
220
223
|
|
221
224
|
it( 'should not allow blocks to be moved', async () => {
|
222
|
-
await
|
225
|
+
await canvas().click(
|
223
226
|
'.block-editor-rich-text__editable[data-type="core/paragraph"]'
|
224
227
|
);
|
225
228
|
expect( await page.$( 'button[aria-label="Move up"]' ) ).toBeNull();
|
@@ -239,7 +242,7 @@ describe( 'cpt locking', () => {
|
|
239
242
|
);
|
240
243
|
|
241
244
|
it( 'should not allow blocks to be moved', async () => {
|
242
|
-
await
|
245
|
+
await canvas().click(
|
243
246
|
'.block-editor-rich-text__editable[data-type="core/paragraph"]'
|
244
247
|
);
|
245
248
|
expect( await page.$( 'button[aria-label="Move up"]' ) ).toBeNull();
|