@wordpress/e2e-tests 10.2.0 → 10.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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 10.3.0 (2026-12-02)
6
+
5
7
  ## 10.2.0 (2026-11-18)
6
8
 
7
9
  ## 10.1.0 (2026-11-04)
@@ -5,6 +5,8 @@
5
5
  * The sync module reads its polling intervals via applyFilters at load time.
6
6
  * The sync module is bundled into the wp-core-data script, so the filters
7
7
  * must be registered before that script executes.
8
+ *
9
+ * @package gutenberg
8
10
  */
9
11
  add_action(
10
12
  'enqueue_block_editor_assets',
@@ -1,4 +1,9 @@
1
1
  <?php
2
+ /**
3
+ * Server timing MU-plugin for e2e tests.
4
+ *
5
+ * @package gutenberg
6
+ */
2
7
 
3
8
  /*
4
9
  * Note: As of WordPress 6.9, there is a template enhancement output buffer which can be used instead of the following
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "10.2.0",
3
+ "version": "10.3.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",
@@ -23,8 +23,8 @@
23
23
  "node": ">=22.13.0"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/interactivity": "^8.2.0",
27
- "@wordpress/interactivity-router": "^3.2.0"
26
+ "@wordpress/interactivity": "^8.3.0",
27
+ "@wordpress/interactivity-router": "^3.3.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "y-websocket": "^3.0.0"
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "1000cdf1dffd5b5e69f75cc4360aa76db8252264"
39
+ "gitHead": "7f19202f61aeba8f4bdce892a1a0df485ad76e2b"
40
40
  }
@@ -134,6 +134,41 @@ function hierarchical_without_title_cpt() {
134
134
  }
135
135
  add_action( 'init', 'hierarchical_without_title_cpt' );
136
136
 
137
+ /**
138
+ * Registers a non-hierarchical post type that supports page attributes.
139
+ */
140
+ function non_hierarchical_with_page_attributes_cpt() {
141
+ register_post_type(
142
+ 'non-hierarchical',
143
+ array(
144
+ 'public' => true,
145
+ 'label' => 'Non-Hierarchical',
146
+ 'show_in_rest' => true,
147
+ 'hierarchical' => false,
148
+ 'supports' => array( 'title', 'editor', 'page-attributes' ),
149
+ )
150
+ );
151
+ }
152
+ add_action( 'init', 'non_hierarchical_with_page_attributes_cpt' );
153
+
154
+ /**
155
+ * Registers a hierarchical post type that is not publicly viewable.
156
+ */
157
+ function hierarchical_not_viewable_cpt() {
158
+ register_post_type(
159
+ 'hierar-private',
160
+ array(
161
+ 'public' => false,
162
+ 'show_ui' => true,
163
+ 'label' => 'Hierarchical Private',
164
+ 'show_in_rest' => true,
165
+ 'hierarchical' => true,
166
+ 'supports' => array( 'title', 'editor', 'page-attributes' ),
167
+ )
168
+ );
169
+ }
170
+ add_action( 'init', 'hierarchical_not_viewable_cpt' );
171
+
137
172
  /**
138
173
  * Registers a custom post type that includes a legacy block in `template`.
139
174
  */
@@ -38,7 +38,14 @@ function updateDebugState( room, patch ) {
38
38
  }
39
39
 
40
40
  function createWebSocketProvider() {
41
- return async ( { awareness, objectType, objectId, ydoc, Y } ) => {
41
+ return async ( {
42
+ awareness,
43
+ flushLocalUpdates,
44
+ objectType,
45
+ objectId,
46
+ ydoc,
47
+ Y,
48
+ } ) => {
42
49
  // Point the bundled y-websocket and y-protocols modules at the Yjs
43
50
  // instance used by the editor. See yjs-external.js.
44
51
  setYjsModule( Y );
@@ -58,6 +65,15 @@ function createWebSocketProvider() {
58
65
  disableBc: true,
59
66
  } );
60
67
 
68
+ // Apply the local updates that the sync manager holds back before
69
+ // each sync message, which can carry a remote update. The sync
70
+ // message type of y-websocket is 0.
71
+ const handleSyncMessage = provider.messageHandlers[ 0 ];
72
+ provider.messageHandlers[ 0 ] = ( ...args ) => {
73
+ flushLocalUpdates?.();
74
+ return handleSyncMessage( ...args );
75
+ };
76
+
61
77
  const statusListeners = new Set();
62
78
 
63
79
  const onStatus = ( event ) => {
@@ -105,6 +121,7 @@ function createWebSocketProvider() {
105
121
  synced: false,
106
122
  } );
107
123
  },
124
+ supportsDeferredUpdates: true,
108
125
  on: ( event, callback ) => {
109
126
  if ( event === 'status' ) {
110
127
  statusListeners.add( callback );
@@ -1,7 +1,12 @@
1
1
  ( function () {
2
2
  const { createElement: el, Fragment } = wp.element;
3
3
  const { registerBlockType } = wp.blocks;
4
- const { InspectorControls, useBlockProps } = wp.blockEditor;
4
+ const {
5
+ InnerBlocks,
6
+ InspectorControls,
7
+ useBlockProps,
8
+ useInnerBlocksProps,
9
+ } = wp.blockEditor;
5
10
  const ServerSideRender = wp.serverSideRender;
6
11
  const { PanelBody, __experimentalNumberControl: NumberControl } =
7
12
  wp.components;
@@ -45,4 +50,41 @@
45
50
  );
46
51
  },
47
52
  } );
53
+
54
+ registerBlockType( 'test/post-context-provider', {
55
+ apiVersion: 3,
56
+ title: 'Test Post Context Provider',
57
+ icon: 'list-view',
58
+ category: 'text',
59
+
60
+ // Redundant with the server-side registration, but required since it
61
+ // is not picked up in `get_block_editor_server_block_settings`.
62
+ providesContext: {
63
+ postId: 'postId',
64
+ postType: 'postType',
65
+ },
66
+
67
+ edit: function Edit( { attributes, setAttributes } ) {
68
+ const blockProps = useBlockProps();
69
+ const innerBlocksProps = useInnerBlocksProps( blockProps );
70
+ return el(
71
+ 'div',
72
+ innerBlocksProps,
73
+ el( 'input', {
74
+ 'aria-label': 'Context post ID',
75
+ value: attributes.postId,
76
+ onChange( event ) {
77
+ setAttributes( {
78
+ postId: Number( event.currentTarget.value ),
79
+ } );
80
+ },
81
+ } ),
82
+ innerBlocksProps.children
83
+ );
84
+ },
85
+
86
+ save() {
87
+ return el( InnerBlocks.Content );
88
+ },
89
+ } );
48
90
  } )();
@@ -87,6 +87,30 @@ add_action(
87
87
  )
88
88
  );
89
89
 
90
+ // Context provider block that provides the `postId`/`postType` block
91
+ // context from its attributes, simulating query-like blocks whose
92
+ // items can reference posts the current user can't edit.
93
+ register_block_type(
94
+ 'test/post-context-provider',
95
+ array(
96
+ 'attributes' => array(
97
+ 'postId' => array(
98
+ 'type' => 'number',
99
+ 'default' => 0,
100
+ ),
101
+ 'postType' => array(
102
+ 'type' => 'string',
103
+ 'default' => 'post',
104
+ ),
105
+ ),
106
+ 'provides_context' => array(
107
+ 'postId' => 'postId',
108
+ 'postType' => 'postType',
109
+ ),
110
+ 'editor_script_handles' => array( 'server-side-rendered-block' ),
111
+ )
112
+ );
113
+
90
114
  // Add binding support for the auto-register-with-controls block.
91
115
  add_filter(
92
116
  'block_bindings_supported_attributes_test/auto-register-with-controls',