@wordpress/e2e-tests 9.20.0 → 9.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/mu-plugins/e2e-fast-sync-polling.php +29 -0
- package/package.json +5 -6
- package/plugins/connectors-empty-state.php +2 -2
- package/plugins/interactive-blocks/directive-bind/view.js +3 -3
- package/plugins/interactive-blocks/directive-context/render.php +1 -1
- package/plugins/interactive-blocks/directive-each/view.js +2 -3
- package/plugins/interactive-blocks/directive-key/view.js +2 -3
- package/plugins/interactive-blocks/directive-run/view.js +2 -3
- package/plugins/interactive-blocks/get-server-context/view.js +2 -3
- package/plugins/interactive-blocks/get-server-state/view.js +2 -3
- package/plugins/interactive-blocks/router-navigate/view.js +2 -3
- package/plugins/interactive-blocks/router-regions/view.js +2 -3
- package/plugins/interactive-blocks/router-script-modules-wrapper/view.js +4 -6
- package/plugins/interactive-blocks/router-styles-wrapper/view.js +6 -9
- package/plugins/media-upload-filter/index.js +30 -0
- package/plugins/media-upload-filter.php +23 -0
- package/plugins/rtc-websocket-provider/src/index.js +6 -1
- package/plugins/rtc-websocket-provider/src/yjs-external.js +13 -9
- package/plugins/rtc-websocket-provider.php +1 -1
- package/plugins/starter-page-patterns.php +64 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* MU-plugin: Speed up collaboration sync polling in e2e tests.
|
|
4
|
+
*
|
|
5
|
+
* The sync module reads its polling intervals via applyFilters at load time,
|
|
6
|
+
* so the filters must be registered before the wp-sync script executes.
|
|
7
|
+
* Hooked to admin_init so the wp-sync handle is already registered.
|
|
8
|
+
*/
|
|
9
|
+
add_action(
|
|
10
|
+
'enqueue_block_editor_assets',
|
|
11
|
+
function () {
|
|
12
|
+
wp_add_inline_script(
|
|
13
|
+
'wp-sync',
|
|
14
|
+
<<<'JS'
|
|
15
|
+
wp.hooks.addFilter(
|
|
16
|
+
'sync.pollingManager.pollingInterval',
|
|
17
|
+
'e2e-tests',
|
|
18
|
+
() => 500
|
|
19
|
+
);
|
|
20
|
+
wp.hooks.addFilter(
|
|
21
|
+
'sync.pollingManager.pollingIntervalWithCollaborators',
|
|
22
|
+
'e2e-tests',
|
|
23
|
+
() => 100
|
|
24
|
+
);
|
|
25
|
+
JS,
|
|
26
|
+
'before'
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/e2e-tests",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.21.0",
|
|
4
4
|
"description": "Test plugins and mu-plugins for E2E tests in WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -20,12 +20,11 @@
|
|
|
20
20
|
"url": "https://github.com/WordPress/gutenberg/issues"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=18.12.0"
|
|
24
|
-
"npm": ">=8.19.2"
|
|
23
|
+
"node": ">=18.12.0"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@wordpress/interactivity": "^6.
|
|
28
|
-
"@wordpress/interactivity-router": "^2.
|
|
26
|
+
"@wordpress/interactivity": "^6.56.0",
|
|
27
|
+
"@wordpress/interactivity-router": "^2.56.0"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"y-websocket": "^3.0.0"
|
|
@@ -38,5 +37,5 @@
|
|
|
38
37
|
"publishConfig": {
|
|
39
38
|
"access": "public"
|
|
40
39
|
},
|
|
41
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "56d8058eda6e30c4cc8bfc37818fa6ed972f7dc2"
|
|
42
41
|
}
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* @package gutenberg-test-connectors-empty-state
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
// Remove the
|
|
12
|
+
// Remove the filter that provides default connector data.
|
|
13
13
|
add_action(
|
|
14
14
|
'init',
|
|
15
15
|
static function () {
|
|
16
|
-
remove_filter( 'script_module_data_options-connectors-wp-admin', '
|
|
16
|
+
remove_filter( 'script_module_data_options-connectors-wp-admin', '_wp_connectors_get_connector_script_module_data' );
|
|
17
17
|
},
|
|
18
18
|
PHP_INT_MAX
|
|
19
19
|
);
|
|
@@ -23,9 +23,9 @@ const { state, foo } = store( 'directive-bind', {
|
|
|
23
23
|
'previousValue' in context
|
|
24
24
|
? context.previousValue
|
|
25
25
|
: // Any string works here; we just want to toggle the value
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
// to ensure Preact renders the same we are hydrating in the
|
|
27
|
+
// first place.
|
|
28
|
+
'tacocat';
|
|
29
29
|
|
|
30
30
|
context.previousValue = context.value;
|
|
31
31
|
context.value = previousValue;
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
<button data-testid="async navigate" data-wp-on--click="actions.asyncNavigate">Async Navigate</button>
|
|
167
167
|
</div>
|
|
168
168
|
|
|
169
|
-
<!-- Count of
|
|
169
|
+
<!-- Count of successful client-side navigations -->
|
|
170
170
|
<div
|
|
171
171
|
data-testid="navigation count"
|
|
172
172
|
data-wp-interactive="directive-context-navigate"
|
|
@@ -224,9 +224,8 @@ store( 'directive-each', {
|
|
|
224
224
|
},
|
|
225
225
|
actions: {
|
|
226
226
|
*navigate() {
|
|
227
|
-
const { actions } =
|
|
228
|
-
'@wordpress/interactivity-router'
|
|
229
|
-
);
|
|
227
|
+
const { actions } =
|
|
228
|
+
yield import( '@wordpress/interactivity-router' );
|
|
230
229
|
return actions.navigate( window.location, {
|
|
231
230
|
force: true,
|
|
232
231
|
html,
|
|
@@ -15,9 +15,8 @@ const html = `
|
|
|
15
15
|
store( 'directive-key', {
|
|
16
16
|
actions: {
|
|
17
17
|
*navigate() {
|
|
18
|
-
const { actions } =
|
|
19
|
-
'@wordpress/interactivity-router'
|
|
20
|
-
);
|
|
18
|
+
const { actions } =
|
|
19
|
+
yield import( '@wordpress/interactivity-router' );
|
|
21
20
|
return actions.navigate( window.location, {
|
|
22
21
|
force: true,
|
|
23
22
|
html,
|
|
@@ -62,9 +62,8 @@ const { state } = store( 'directive-run', {
|
|
|
62
62
|
state.clickCount = state.clickCount + 1;
|
|
63
63
|
},
|
|
64
64
|
*navigate() {
|
|
65
|
-
const { actions } =
|
|
66
|
-
'@wordpress/interactivity-router'
|
|
67
|
-
);
|
|
65
|
+
const { actions } =
|
|
66
|
+
yield import( '@wordpress/interactivity-router' );
|
|
68
67
|
return actions.navigate( window.location, {
|
|
69
68
|
force: true,
|
|
70
69
|
html,
|
|
@@ -14,9 +14,8 @@ store( 'test/get-server-context', {
|
|
|
14
14
|
actions: {
|
|
15
15
|
navigate: withSyncEvent( function* ( e ) {
|
|
16
16
|
e.preventDefault();
|
|
17
|
-
const { actions } =
|
|
18
|
-
'@wordpress/interactivity-router'
|
|
19
|
-
);
|
|
17
|
+
const { actions } =
|
|
18
|
+
yield import( '@wordpress/interactivity-router' );
|
|
20
19
|
yield actions.navigate( e.target.href );
|
|
21
20
|
} ),
|
|
22
21
|
attemptModification() {
|
|
@@ -9,9 +9,8 @@ const { state } = store( 'test/get-server-state', {
|
|
|
9
9
|
actions: {
|
|
10
10
|
navigate: withSyncEvent( function* ( e ) {
|
|
11
11
|
e.preventDefault();
|
|
12
|
-
const { actions } =
|
|
13
|
-
'@wordpress/interactivity-router'
|
|
14
|
-
);
|
|
12
|
+
const { actions } =
|
|
13
|
+
yield import( '@wordpress/interactivity-router' );
|
|
15
14
|
yield actions.navigate( e.target.href );
|
|
16
15
|
} ),
|
|
17
16
|
attemptModification() {
|
|
@@ -25,9 +25,8 @@ const { state } = store( 'router', {
|
|
|
25
25
|
const force = e.target.dataset.forceNavigation === 'true';
|
|
26
26
|
const { timeout } = state;
|
|
27
27
|
|
|
28
|
-
const { actions } =
|
|
29
|
-
'@wordpress/interactivity-router'
|
|
30
|
-
);
|
|
28
|
+
const { actions } =
|
|
29
|
+
yield import( '@wordpress/interactivity-router' );
|
|
31
30
|
|
|
32
31
|
try {
|
|
33
32
|
yield actions.navigate( e.target.href, { force, timeout } );
|
|
@@ -23,9 +23,8 @@ const { state } = store( 'router-regions', {
|
|
|
23
23
|
router: {
|
|
24
24
|
navigate: withSyncEvent( function* ( e ) {
|
|
25
25
|
e.preventDefault();
|
|
26
|
-
const { actions } =
|
|
27
|
-
'@wordpress/interactivity-router'
|
|
28
|
-
);
|
|
26
|
+
const { actions } =
|
|
27
|
+
yield import( '@wordpress/interactivity-router' );
|
|
29
28
|
yield actions.navigate( e.target.href );
|
|
30
29
|
} ),
|
|
31
30
|
back: withSyncEvent( function* ( e ) {
|
|
@@ -9,17 +9,15 @@ const { state } = store( 'test/router-script-modules', {
|
|
|
9
9
|
*navigate( e ) {
|
|
10
10
|
e.preventDefault();
|
|
11
11
|
state.clientSideNavigation = false;
|
|
12
|
-
const { actions } =
|
|
13
|
-
'@wordpress/interactivity-router'
|
|
14
|
-
);
|
|
12
|
+
const { actions } =
|
|
13
|
+
yield import( '@wordpress/interactivity-router' );
|
|
15
14
|
yield actions.navigate( e.target.href );
|
|
16
15
|
state.clientSideNavigation = true;
|
|
17
16
|
},
|
|
18
17
|
*prefetch() {
|
|
19
18
|
const { ref } = getElement();
|
|
20
|
-
const { actions } =
|
|
21
|
-
'@wordpress/interactivity-router'
|
|
22
|
-
);
|
|
19
|
+
const { actions } =
|
|
20
|
+
yield import( '@wordpress/interactivity-router' );
|
|
23
21
|
yield actions.prefetch( ref.href );
|
|
24
22
|
},
|
|
25
23
|
pushName( name ) {
|
|
@@ -10,27 +10,24 @@ const { state } = store( 'test/router-styles', {
|
|
|
10
10
|
navigate: withSyncEvent( function* ( e ) {
|
|
11
11
|
e.preventDefault();
|
|
12
12
|
state.clientSideNavigation = false;
|
|
13
|
-
const { actions } =
|
|
14
|
-
'@wordpress/interactivity-router'
|
|
15
|
-
);
|
|
13
|
+
const { actions } =
|
|
14
|
+
yield import( '@wordpress/interactivity-router' );
|
|
16
15
|
yield actions.navigate( e.target.href );
|
|
17
16
|
state.clientSideNavigation = true;
|
|
18
17
|
} ),
|
|
19
18
|
navigateForce: withSyncEvent( function* ( e ) {
|
|
20
19
|
e.preventDefault();
|
|
21
20
|
state.clientSideNavigation = false;
|
|
22
|
-
const { actions } =
|
|
23
|
-
'@wordpress/interactivity-router'
|
|
24
|
-
);
|
|
21
|
+
const { actions } =
|
|
22
|
+
yield import( '@wordpress/interactivity-router' );
|
|
25
23
|
yield actions.navigate( e.target.href, { force: true } );
|
|
26
24
|
state.clientSideNavigation = true;
|
|
27
25
|
} ),
|
|
28
26
|
*prefetch() {
|
|
29
27
|
state.prefetching = true;
|
|
30
28
|
const { ref } = getElement();
|
|
31
|
-
const { actions } =
|
|
32
|
-
'@wordpress/interactivity-router'
|
|
33
|
-
);
|
|
29
|
+
const { actions } =
|
|
30
|
+
yield import( '@wordpress/interactivity-router' );
|
|
34
31
|
yield actions.prefetch( ref.href );
|
|
35
32
|
state.prefetching = false;
|
|
36
33
|
},
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
( function () {
|
|
2
|
+
const el = wp.element.createElement;
|
|
3
|
+
const Fragment = wp.element.Fragment;
|
|
4
|
+
|
|
5
|
+
// Wraps the media picker with a marker exposing the prop plugins use to
|
|
6
|
+
// recognize the featured image.
|
|
7
|
+
wp.hooks.addFilter(
|
|
8
|
+
'editor.MediaUpload',
|
|
9
|
+
'gutenberg-test/media-upload-filter',
|
|
10
|
+
function ( MediaUpload ) {
|
|
11
|
+
return function ( props ) {
|
|
12
|
+
return el(
|
|
13
|
+
Fragment,
|
|
14
|
+
{},
|
|
15
|
+
el( MediaUpload, props ),
|
|
16
|
+
el(
|
|
17
|
+
'div',
|
|
18
|
+
{
|
|
19
|
+
className: 'e2e-media-upload-filter',
|
|
20
|
+
'data-featured-image-flow': String(
|
|
21
|
+
!! props.featuredImageFlow
|
|
22
|
+
),
|
|
23
|
+
},
|
|
24
|
+
'Media upload filter'
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
} )();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: Gutenberg Test Media Upload Filter
|
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
|
5
|
+
* Author: Gutenberg Team
|
|
6
|
+
*
|
|
7
|
+
* @package gutenberg-test-media-upload-filter
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Enqueues a script extending the media picker through `editor.MediaUpload`.
|
|
12
|
+
*/
|
|
13
|
+
function enqueue_media_upload_filter_plugin_script() {
|
|
14
|
+
wp_enqueue_script(
|
|
15
|
+
'gutenberg-test-media-upload-filter',
|
|
16
|
+
plugins_url( 'media-upload-filter/index.js', __FILE__ ),
|
|
17
|
+
array( 'wp-element', 'wp-hooks', 'wp-editor' ),
|
|
18
|
+
filemtime( plugin_dir_path( __FILE__ ) . 'media-upload-filter/index.js' ),
|
|
19
|
+
true
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
add_action( 'enqueue_block_editor_assets', 'enqueue_media_upload_filter_plugin_script' );
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { WebsocketProvider } from 'y-websocket';
|
|
11
|
+
import { setYjsModule } from './yjs-external';
|
|
11
12
|
|
|
12
13
|
const TEST_PROVIDER_NAMESPACE = 'gutenberg-test/rtc-websocket-provider';
|
|
13
14
|
const DEFAULT_URL = 'ws://127.0.0.1:18991';
|
|
@@ -37,7 +38,11 @@ function updateDebugState( room, patch ) {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
function createWebSocketProvider() {
|
|
40
|
-
return async ( { awareness, objectType, objectId, ydoc } ) => {
|
|
41
|
+
return async ( { awareness, objectType, objectId, ydoc, Y } ) => {
|
|
42
|
+
// Point the bundled y-websocket and y-protocols modules at the Yjs
|
|
43
|
+
// instance used by the editor. See yjs-external.js.
|
|
44
|
+
setYjsModule( Y );
|
|
45
|
+
|
|
41
46
|
const room = objectId ? `${ objectType }:${ objectId }` : objectType;
|
|
42
47
|
|
|
43
48
|
updateDebugState( room, {
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Shared-Yjs shim for the bundled y-websocket and y-protocols modules.
|
|
3
|
+
*
|
|
4
|
+
* The plugin build aliases the `yjs` module specifier to this file, so the
|
|
5
|
+
* bundled y-websocket and y-protocols modules resolve Yjs symbols here
|
|
6
|
+
* instead of bundling their own copy. Two Yjs instances on the same page
|
|
7
|
+
* cause silent data corruption: https://github.com/yjs/yjs/issues/438
|
|
6
8
|
*
|
|
7
9
|
* Only the symbols actually referenced by y-websocket and y-protocols
|
|
8
10
|
* need to be re-exported here.
|
|
9
11
|
*/
|
|
10
|
-
|
|
12
|
+
export let Doc;
|
|
13
|
+
export let applyUpdate;
|
|
14
|
+
export let encodeStateAsUpdate;
|
|
15
|
+
export let encodeStateVector;
|
|
11
16
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export const encodeStateVector = Y.encodeStateVector;
|
|
17
|
+
export function setYjsModule( Y ) {
|
|
18
|
+
( { Doc, applyUpdate, encodeStateAsUpdate, encodeStateVector } = Y );
|
|
19
|
+
}
|
|
@@ -40,7 +40,7 @@ function gutenberg_test_rtc_websocket_provider_enqueue() {
|
|
|
40
40
|
wp_enqueue_script(
|
|
41
41
|
'gutenberg-test-rtc-websocket-provider',
|
|
42
42
|
plugins_url( 'rtc-websocket-provider/build/index.js', __FILE__ ),
|
|
43
|
-
array( 'wp-hooks'
|
|
43
|
+
array( 'wp-hooks' ),
|
|
44
44
|
filemtime( $script_path ),
|
|
45
45
|
true
|
|
46
46
|
);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: Gutenberg Test Starter Page Patterns
|
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
|
5
|
+
* Author: Gutenberg Team
|
|
6
|
+
*
|
|
7
|
+
* @package gutenberg-test-starter-page-patterns
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
register_block_pattern_category(
|
|
11
|
+
'test-about',
|
|
12
|
+
array( 'label' => 'Test About' )
|
|
13
|
+
);
|
|
14
|
+
register_block_pattern_category(
|
|
15
|
+
'test-services',
|
|
16
|
+
array( 'label' => 'Test Services' )
|
|
17
|
+
);
|
|
18
|
+
register_block_pattern_category(
|
|
19
|
+
'test-post-only',
|
|
20
|
+
array( 'label' => 'Test Post Only' )
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
register_block_pattern(
|
|
24
|
+
'starter-page-patterns/about',
|
|
25
|
+
array(
|
|
26
|
+
'title' => 'About page',
|
|
27
|
+
'categories' => array( 'test-about' ),
|
|
28
|
+
'blockTypes' => array( 'core/post-content' ),
|
|
29
|
+
'postTypes' => array( 'page' ),
|
|
30
|
+
'content' => '<!-- wp:heading --><h2 class="wp-block-heading">About us</h2><!-- /wp:heading --><!-- wp:paragraph --><p>We build websites.</p><!-- /wp:paragraph -->',
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
register_block_pattern(
|
|
35
|
+
'starter-page-patterns/services',
|
|
36
|
+
array(
|
|
37
|
+
'title' => 'Services page',
|
|
38
|
+
'categories' => array( 'test-services' ),
|
|
39
|
+
'blockTypes' => array( 'core/post-content' ),
|
|
40
|
+
'postTypes' => array( 'page' ),
|
|
41
|
+
'content' => '<!-- wp:heading --><h2 class="wp-block-heading">Our services</h2><!-- /wp:heading -->',
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
register_block_pattern(
|
|
46
|
+
'starter-page-patterns/no-category',
|
|
47
|
+
array(
|
|
48
|
+
'title' => 'Plain page',
|
|
49
|
+
'blockTypes' => array( 'core/post-content' ),
|
|
50
|
+
'postTypes' => array( 'page' ),
|
|
51
|
+
'content' => '<!-- wp:paragraph --><p>A plain start.</p><!-- /wp:paragraph -->',
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
register_block_pattern(
|
|
56
|
+
'starter-page-patterns/post-only',
|
|
57
|
+
array(
|
|
58
|
+
'title' => 'Post call to action',
|
|
59
|
+
'categories' => array( 'test-post-only' ),
|
|
60
|
+
'blockTypes' => array( 'core/post-content' ),
|
|
61
|
+
'postTypes' => array( 'post' ),
|
|
62
|
+
'content' => '<!-- wp:paragraph --><p>Posts only.</p><!-- /wp:paragraph -->',
|
|
63
|
+
)
|
|
64
|
+
);
|