@wordpress/e2e-tests 9.7.0 → 9.8.1-next.v.202604091042.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 9.8.0 (2026-04-01)
6
+
5
7
  ## 9.7.0 (2026-03-18)
6
8
 
7
9
  ## 9.6.0 (2026-03-04)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "9.7.0",
3
+ "version": "9.8.1-next.v.202604091042.0+668146787",
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",
@@ -24,8 +24,8 @@
24
24
  "npm": ">=8.19.2"
25
25
  },
26
26
  "dependencies": {
27
- "@wordpress/interactivity": "^6.42.0",
28
- "@wordpress/interactivity-router": "^2.42.0"
27
+ "@wordpress/interactivity": "^6.43.1-next.v.202604091042.0+668146787",
28
+ "@wordpress/interactivity-router": "^2.43.1-next.v.202604091042.0+668146787"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "jest": ">=29",
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "c20787b1778ae64c2db65643b1c236309d68e6ba"
39
+ "gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
40
40
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Script module that demonstrates client-side connector registration.
3
+ *
4
+ * The server registers test_custom_service with its name and description.
5
+ * This module calls registerConnector() with the same slug to add a render
6
+ * function. The store merges both registrations, so the final connector
7
+ * combines the render function from JS with the metadata from PHP.
8
+ */
9
+
10
+ // eslint-disable-next-line import/no-extraneous-dependencies
11
+ import {
12
+ __experimentalRegisterConnector as registerConnector,
13
+ __experimentalConnectorItem as ConnectorItem,
14
+ } from '@wordpress/connectors';
15
+
16
+ const h = window.React.createElement;
17
+
18
+ // Register the render function for the connector.
19
+ registerConnector( 'test_custom_service', {
20
+ render: ( props ) =>
21
+ h(
22
+ ConnectorItem,
23
+ {
24
+ className: 'connector-item--test_custom_service',
25
+ name: props.name,
26
+ description: props.description,
27
+ logo: props.logo,
28
+ },
29
+ h(
30
+ 'p',
31
+ { className: 'test-custom-service-content' },
32
+ 'Custom rendered content for testing.'
33
+ )
34
+ ),
35
+ } );
@@ -0,0 +1,68 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Connectors JS Extensibility
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * Registers two custom-type connectors on the server:
8
+ *
9
+ * 1. test_custom_service — also registered client-side via a script module using
10
+ * the merging strategy (two registerConnector calls with the same slug: one
11
+ * providing the render function, the other metadata).
12
+ * 2. test_server_only_service — server-only, with no client-side render function,
13
+ * so it should not display a card in the UI.
14
+ *
15
+ * @package gutenberg-test-connectors-js-extensibility
16
+ */
17
+
18
+ // Register two custom-type connectors for E2E testing.
19
+ add_action(
20
+ 'wp_connectors_init',
21
+ static function ( WP_Connector_Registry $registry ) {
22
+ $registry->register(
23
+ 'test_custom_service',
24
+ array(
25
+ 'name' => 'Test Custom Service',
26
+ 'description' => 'A custom service for E2E testing.',
27
+ 'type' => 'custom_service',
28
+ 'authentication' => array(
29
+ 'method' => 'none',
30
+ ),
31
+ )
32
+ );
33
+
34
+ $registry->register(
35
+ 'test_server_only_service',
36
+ array(
37
+ 'name' => 'Test Server Only Service',
38
+ 'description' => 'A server-only service with no JS render.',
39
+ 'type' => 'custom_service',
40
+ 'authentication' => array(
41
+ 'method' => 'none',
42
+ ),
43
+ )
44
+ );
45
+ }
46
+ );
47
+
48
+ // Enqueue the script module on the connectors page.
49
+ add_action(
50
+ 'admin_enqueue_scripts',
51
+ static function () {
52
+ if ( ! isset( $_GET['page'] ) || 'options-connectors-wp-admin' !== $_GET['page'] ) {
53
+ return;
54
+ }
55
+
56
+ wp_register_script_module(
57
+ 'gutenberg-test-connectors-js-extensibility',
58
+ plugins_url( 'connectors-js-extensibility/index.mjs', __FILE__ ),
59
+ array(
60
+ array(
61
+ 'id' => '@wordpress/connectors',
62
+ 'import' => 'static',
63
+ ),
64
+ )
65
+ );
66
+ wp_enqueue_script_module( 'gutenberg-test-connectors-js-extensibility' );
67
+ }
68
+ );
@@ -23,7 +23,7 @@ const { callbacks } = store( 'test/generator-scope', {
23
23
  let value = yield Promise.resolve( 1 );
24
24
  try {
25
25
  value = yield Promise.reject( 2 );
26
- } catch ( e ) {
26
+ } catch {
27
27
  value = yield Promise.resolve( 3 );
28
28
  }
29
29
  getContext().result = value;
@@ -34,7 +34,7 @@ const { state } = store( 'router', {
34
34
 
35
35
  try {
36
36
  yield actions.navigate( e.target.href, { force, timeout } );
37
- } catch ( error ) {
37
+ } catch {
38
38
  state.status = 'fail';
39
39
  }
40
40
 
@@ -0,0 +1,77 @@
1
+ ( function () {
2
+ const { createElement: el } = wp.element;
3
+ const { useSelect } = wp.data;
4
+ const {
5
+ Modal,
6
+ Button,
7
+ __experimentalVStack: VStack,
8
+ __experimentalHStack: HStack,
9
+ } = wp.components;
10
+ const { __ } = wp.i18n;
11
+ const { registerPlugin } = wp.plugins;
12
+
13
+ function CustomConnectionLimitModal() {
14
+ const connectionStatus = useSelect( function ( select ) {
15
+ return select( 'core' ).getSyncConnectionStatus() || null;
16
+ }, [] );
17
+
18
+ const error =
19
+ connectionStatus &&
20
+ connectionStatus.status === 'disconnected' &&
21
+ connectionStatus.error
22
+ ? connectionStatus.error
23
+ : null;
24
+
25
+ if ( ! error || error.code !== 'connection-limit-exceeded' ) {
26
+ return null;
27
+ }
28
+
29
+ return el(
30
+ Modal,
31
+ {
32
+ title: __( 'Collaboration limit reached' ),
33
+ isDismissible: false,
34
+ onRequestClose() {},
35
+ shouldCloseOnClickOutside: false,
36
+ shouldCloseOnEsc: false,
37
+ size: 'medium',
38
+ },
39
+ el(
40
+ VStack,
41
+ { spacing: 6 },
42
+ el(
43
+ 'p',
44
+ null,
45
+ 'Consider upgrading your hosting plan to increase the collaboration limits.'
46
+ ),
47
+ el(
48
+ HStack,
49
+ { justify: 'right' },
50
+ el(
51
+ Button,
52
+ {
53
+ variant: 'tertiary',
54
+ isDestructive: true,
55
+ href: 'edit.php',
56
+ __next40pxDefaultSize: true,
57
+ },
58
+ __( 'Back to Posts' )
59
+ ),
60
+ el(
61
+ Button,
62
+ {
63
+ variant: 'primary',
64
+ href: 'https://example.com/upgrade',
65
+ __next40pxDefaultSize: true,
66
+ },
67
+ __( 'Upgrade Plan' )
68
+ )
69
+ )
70
+ )
71
+ );
72
+ }
73
+
74
+ registerPlugin( 'custom-sync-connection-error', {
75
+ render: CustomConnectionLimitModal,
76
+ } );
77
+ } )();
@@ -0,0 +1,47 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Plugin, Sync Connection Error Filter
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * @package gutenberg-test-sync-connection-error-filter
8
+ */
9
+
10
+ /**
11
+ * Registers the editor.isSyncConnectionErrorHandled filter and custom modal.
12
+ */
13
+ function enqueue_sync_connection_error_filter_scripts() {
14
+ // Register the filter early on wp-hooks so it's available before the
15
+ // editor modal renders. Plugins return true for error codes they handle.
16
+ wp_add_inline_script(
17
+ 'wp-hooks',
18
+ "wp.hooks.addFilter(
19
+ 'editor.isSyncConnectionErrorHandled',
20
+ 'gutenberg-test/custom-sync-error',
21
+ function( isHandled, errorCode ) {
22
+ if ( errorCode === 'connection-limit-exceeded' ) {
23
+ return true;
24
+ }
25
+ return isHandled;
26
+ }
27
+ );"
28
+ );
29
+
30
+ // Enqueue the custom modal component that replaces the default UI
31
+ // for connection-limit-exceeded errors.
32
+ wp_enqueue_script(
33
+ 'gutenberg-test-sync-connection-error-filter',
34
+ plugins_url( 'sync-connection-error-filter/index.js', __FILE__ ),
35
+ array(
36
+ 'wp-components',
37
+ 'wp-data',
38
+ 'wp-element',
39
+ 'wp-i18n',
40
+ 'wp-plugins',
41
+ ),
42
+ filemtime( plugin_dir_path( __FILE__ ) . 'sync-connection-error-filter/index.js' ),
43
+ true
44
+ );
45
+ }
46
+
47
+ add_action( 'enqueue_block_editor_assets', 'enqueue_sync_connection_error_filter_scripts' );