@wordpress/e2e-tests 2.5.17 → 2.5.18

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.
@@ -0,0 +1,24 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Plugin, Enable Templates UI
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * @package gutenberg-test-enable-templates-ui
8
+ */
9
+
10
+ /**
11
+ * Enable Templates & Template Parts post type UI during e2e testing.
12
+ */
13
+ add_filter(
14
+ 'register_post_type_args',
15
+ static function( $args, $name ) {
16
+ if ( in_array( $name, array( 'wp_template', 'wp_template_part' ), true ) ) {
17
+ $args['show_ui'] = wp_is_block_theme();
18
+ }
19
+
20
+ return $args;
21
+ },
22
+ 20,
23
+ 2
24
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "2.5.17",
3
+ "version": "2.5.18",
4
4
  "description": "End-To-End (E2E) tests for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "823b3225e81748f8febb808e780e2b71478bc854"
46
+ "gitHead": "1246a52b9fdfecf592a9fa1d33a2804a6cc2d257"
47
47
  }
@@ -2,25 +2,25 @@
2
2
 
3
3
  exports[`Heading can be created by prefixing existing content with number signs and a space 1`] = `
4
4
  "<!-- wp:heading {\\"level\\":4} -->
5
- <h4 id=\\"4\\">4</h4>
5
+ <h4>4</h4>
6
6
  <!-- /wp:heading -->"
7
7
  `;
8
8
 
9
9
  exports[`Heading can be created by prefixing number sign and a space 1`] = `
10
10
  "<!-- wp:heading {\\"level\\":3} -->
11
- <h3 id=\\"3\\">3</h3>
11
+ <h3>3</h3>
12
12
  <!-- /wp:heading -->"
13
13
  `;
14
14
 
15
15
  exports[`Heading should correctly apply custom colors 1`] = `
16
- "<!-- wp:heading {\\"level\\":3,\\"style\\":{\\"color\\":{\\"text\\":\\"#7700ff\\"}}} -->
17
- <h3 class=\\"has-text-color\\" id=\\"heading\\" style=\\"color:#7700ff\\">Heading</h3>
16
+ "<!-- wp:heading {\\"level\\":3,\\"style\\":{\\"color\\":{\\"text\\":\\"#0782f6\\"}}} -->
17
+ <h3 class=\\"has-text-color\\" style=\\"color:#0782f6\\">Heading</h3>
18
18
  <!-- /wp:heading -->"
19
19
  `;
20
20
 
21
21
  exports[`Heading should correctly apply named colors 1`] = `
22
22
  "<!-- wp:heading {\\"textColor\\":\\"luminous-vivid-orange\\"} -->
23
- <h2 class=\\"has-luminous-vivid-orange-color has-text-color\\" id=\\"heading\\">Heading</h2>
23
+ <h2 class=\\"has-luminous-vivid-orange-color has-text-color\\">Heading</h2>
24
24
  <!-- /wp:heading -->"
25
25
  `;
26
26
 
@@ -30,13 +30,13 @@ exports[`Heading should create a paragraph block above when pressing enter at th
30
30
  <!-- /wp:paragraph -->
31
31
 
32
32
  <!-- wp:heading -->
33
- <h2 id=\\"a\\">a</h2>
33
+ <h2>a</h2>
34
34
  <!-- /wp:heading -->"
35
35
  `;
36
36
 
37
37
  exports[`Heading should create a paragraph block below when pressing enter at the end 1`] = `
38
38
  "<!-- wp:heading -->
39
- <h2 id=\\"a\\">a</h2>
39
+ <h2>a</h2>
40
40
  <!-- /wp:heading -->
41
41
 
42
42
  <!-- wp:paragraph -->
@@ -46,12 +46,12 @@ exports[`Heading should create a paragraph block below when pressing enter at th
46
46
 
47
47
  exports[`Heading should not work with the list input rule 1`] = `
48
48
  "<!-- wp:heading -->
49
- <h2 id=\\"1-h\\">1. H</h2>
49
+ <h2>1. H</h2>
50
50
  <!-- /wp:heading -->"
51
51
  `;
52
52
 
53
53
  exports[`Heading should work with the format input rules 1`] = `
54
54
  "<!-- wp:heading -->
55
- <h2 id=\\"code\\"><code>code</code></h2>
55
+ <h2><code>code</code></h2>
56
56
  <!-- /wp:heading -->"
57
57
  `;
@@ -40,7 +40,7 @@ exports[`Quote can be converted to paragraphs and renders only one paragraph for
40
40
 
41
41
  exports[`Quote can be created by converting a heading 1`] = `
42
42
  "<!-- wp:quote -->
43
- <blockquote class=\\"wp-block-quote\\" id=\\"test\\"><p>test</p></blockquote>
43
+ <blockquote class=\\"wp-block-quote\\"><p>test</p></blockquote>
44
44
  <!-- /wp:quote -->"
45
45
  `;
46
46
 
@@ -144,7 +144,7 @@ exports[`Quote can be split in the middle and merged back 4`] = `
144
144
 
145
145
  exports[`Quote is transformed to a heading and a quote if the quote contains a citation 1`] = `
146
146
  "<!-- wp:heading -->
147
- <h2 id=\\"one\\">one</h2>
147
+ <h2>one</h2>
148
148
  <!-- /wp:heading -->
149
149
 
150
150
  <!-- wp:quote -->
@@ -154,7 +154,7 @@ exports[`Quote is transformed to a heading and a quote if the quote contains a c
154
154
 
155
155
  exports[`Quote is transformed to a heading and a quote if the quote contains multiple paragraphs 1`] = `
156
156
  "<!-- wp:heading -->
157
- <h2 id=\\"one\\">one</h2>
157
+ <h2>one</h2>
158
158
  <!-- /wp:heading -->
159
159
 
160
160
  <!-- wp:quote -->
@@ -164,7 +164,7 @@ exports[`Quote is transformed to a heading and a quote if the quote contains mul
164
164
 
165
165
  exports[`Quote is transformed to a heading if the quote just contains one paragraph 1`] = `
166
166
  "<!-- wp:heading -->
167
- <h2 id=\\"one\\">one</h2>
167
+ <h2>one</h2>
168
168
  <!-- /wp:heading -->"
169
169
  `;
170
170
 
@@ -176,7 +176,7 @@ exports[`Quote is transformed to an empty heading if the quote is empty 1`] = `
176
176
 
177
177
  exports[`Quote the resuling quote after transforming to a heading can be transformed again 1`] = `
178
178
  "<!-- wp:heading -->
179
- <h2 id=\\"one\\">one</h2>
179
+ <h2>one</h2>
180
180
  <!-- /wp:heading -->
181
181
 
182
182
  <!-- wp:quote -->
@@ -186,11 +186,11 @@ exports[`Quote the resuling quote after transforming to a heading can be transfo
186
186
 
187
187
  exports[`Quote the resuling quote after transforming to a heading can be transformed again 2`] = `
188
188
  "<!-- wp:heading -->
189
- <h2 id=\\"one\\">one</h2>
189
+ <h2>one</h2>
190
190
  <!-- /wp:heading -->
191
191
 
192
192
  <!-- wp:heading -->
193
- <h2 id=\\"two\\">two</h2>
193
+ <h2>two</h2>
194
194
  <!-- /wp:heading -->
195
195
 
196
196
  <!-- wp:quote -->
@@ -200,14 +200,14 @@ exports[`Quote the resuling quote after transforming to a heading can be transfo
200
200
 
201
201
  exports[`Quote the resuling quote after transforming to a heading can be transformed again 3`] = `
202
202
  "<!-- wp:heading -->
203
- <h2 id=\\"one\\">one</h2>
203
+ <h2>one</h2>
204
204
  <!-- /wp:heading -->
205
205
 
206
206
  <!-- wp:heading -->
207
- <h2 id=\\"two\\">two</h2>
207
+ <h2>two</h2>
208
208
  <!-- /wp:heading -->
209
209
 
210
210
  <!-- wp:heading -->
211
- <h2 id=\\"cite\\">cite</h2>
211
+ <h2>cite</h2>
212
212
  <!-- /wp:heading -->"
213
213
  `;
@@ -7,7 +7,7 @@ exports[`Spacer can be created by typing "/spacer" 1`] = `
7
7
  `;
8
8
 
9
9
  exports[`Spacer can be resized using the drag handle and remains selected after being dragged 1`] = `
10
- "<!-- wp:spacer {\\"height\\":150} -->
10
+ "<!-- wp:spacer {\\"height\\":\\"150px\\"} -->
11
11
  <div style=\\"height:150px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
12
12
  <!-- /wp:spacer -->"
13
13
  `;
@@ -68,7 +68,7 @@ describe( 'Heading', () => {
68
68
  expect( await getEditedPostContent() ).toMatchSnapshot();
69
69
  } );
70
70
 
71
- it( 'should correctly apply custom colors', async () => {
71
+ it.skip( 'should correctly apply custom colors', async () => {
72
72
  await clickBlockAppender();
73
73
  await page.keyboard.type( '### Heading' );
74
74
  const colorPanelToggle = await page.waitForXPath(
@@ -91,7 +91,7 @@ describe( 'Heading', () => {
91
91
  expect( await getEditedPostContent() ).toMatchSnapshot();
92
92
  } );
93
93
 
94
- it( 'should correctly apply named colors', async () => {
94
+ it.skip( 'should correctly apply named colors', async () => {
95
95
  await clickBlockAppender();
96
96
  await page.keyboard.type( '## Heading' );
97
97
  const [ colorPanelToggle ] = await page.$x(
@@ -3,7 +3,7 @@
3
3
  exports[`Block Grouping Group creation creates a group from multiple blocks of different types via block transforms 1`] = `
4
4
  "<!-- wp:group -->
5
5
  <div class=\\"wp-block-group\\"><!-- wp:heading -->
6
- <h2 id=\\"group-heading\\">Group Heading</h2>
6
+ <h2>Group Heading</h2>
7
7
  <!-- /wp:heading -->
8
8
 
9
9
  <!-- wp:image -->
@@ -51,7 +51,7 @@ exports[`Block Grouping Group creation creates a group from multiple blocks of t
51
51
  exports[`Block Grouping Group creation groups and ungroups multiple blocks of different types via options toolbar 1`] = `
52
52
  "<!-- wp:group -->
53
53
  <div class=\\"wp-block-group\\"><!-- wp:heading -->
54
- <h2 id=\\"group-heading\\">Group Heading</h2>
54
+ <h2>Group Heading</h2>
55
55
  <!-- /wp:heading -->
56
56
 
57
57
  <!-- wp:image -->
@@ -66,7 +66,7 @@ exports[`Block Grouping Group creation groups and ungroups multiple blocks of di
66
66
 
67
67
  exports[`Block Grouping Group creation groups and ungroups multiple blocks of different types via options toolbar 2`] = `
68
68
  "<!-- wp:heading -->
69
- <h2 id=\\"group-heading\\">Group Heading</h2>
69
+ <h2>Group Heading</h2>
70
70
  <!-- /wp:heading -->
71
71
 
72
72
  <!-- wp:image -->
@@ -81,7 +81,7 @@ exports[`Block Grouping Group creation groups and ungroups multiple blocks of di
81
81
  exports[`Block Grouping Preserving selected blocks attributes preserves width alignment settings of selected blocks 1`] = `
82
82
  "<!-- wp:group {\\"align\\":\\"full\\"} -->
83
83
  <div class=\\"wp-block-group alignfull\\"><!-- wp:heading -->
84
- <h2 id=\\"group-heading\\">Group Heading</h2>
84
+ <h2>Group Heading</h2>
85
85
  <!-- /wp:heading -->
86
86
 
87
87
  <!-- wp:image {\\"align\\":\\"full\\"} -->
@@ -71,7 +71,7 @@ exports[`Inserting blocks inserts a block in proper place after having clicked \
71
71
  <!-- /wp:paragraph -->
72
72
 
73
73
  <!-- wp:heading -->
74
- <h2 id=\\"heading\\">Heading</h2>
74
+ <h2>Heading</h2>
75
75
  <!-- /wp:heading -->
76
76
 
77
77
  <!-- wp:paragraph -->
@@ -93,7 +93,7 @@ exports[`Inserting blocks inserts a block in proper place after having clicked \
93
93
  <!-- /wp:cover -->
94
94
 
95
95
  <!-- wp:heading -->
96
- <h2 id=\\"heading\\">Heading</h2>
96
+ <h2>Heading</h2>
97
97
  <!-- /wp:heading -->
98
98
 
99
99
  <!-- wp:paragraph -->
@@ -420,4 +420,25 @@ describe( 'undo', () => {
420
420
  // Expect "1".
421
421
  expect( await getEditedPostContent() ).toMatchSnapshot();
422
422
  } );
423
+
424
+ it( 'should be able to undo and redo when transient changes have been made and we update/publish', async () => {
425
+ // Typing consecutive characters in a `Paragraph` block updates the same
426
+ // block attribute as in the previous action and results in transient edits
427
+ // and skipping `undo` history steps.
428
+ const text = 'tonis';
429
+ await clickBlockAppender();
430
+ await page.keyboard.type( text );
431
+ await publishPost();
432
+ await pressKeyWithModifier( 'primary', 'z' );
433
+ expect( await getEditedPostContent() ).toBe( '' );
434
+ await page.waitForSelector(
435
+ '.editor-history__redo[aria-disabled="false"]'
436
+ );
437
+ await page.click( '.editor-history__redo[aria-disabled="false"]' );
438
+ expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
439
+ "<!-- wp:paragraph -->
440
+ <p>tonis</p>
441
+ <!-- /wp:paragraph -->"
442
+ ` );
443
+ } );
423
444
  } );
@@ -22,29 +22,31 @@ const {
22
22
  disableWelcomeGuide,
23
23
  } = siteEditor;
24
24
 
25
- const assertSaveButtonIsDisabled = () =>
25
+ const assertSaveButtonIsDisabled = async () =>
26
26
  page.waitForSelector(
27
27
  '.edit-site-save-button__button[aria-disabled="true"]'
28
28
  );
29
29
 
30
- const assertSaveButtonIsEnabled = () =>
30
+ const assertSaveButtonIsEnabled = async () =>
31
31
  page.waitForSelector(
32
32
  '.edit-site-save-button__button[aria-disabled="false"]'
33
33
  );
34
34
 
35
- const waitForNotice = () => page.waitForSelector( '.components-snackbar' );
36
-
37
35
  const clickButtonInNotice = async () => {
38
36
  const selector = '.components-snackbar button';
39
37
  await page.waitForSelector( selector );
40
38
  await page.click( selector );
41
39
  };
42
40
 
43
- const clickUndoInHeaderToolbar = () =>
41
+ const clickUndoInHeaderToolbar = async () =>
44
42
  page.click( '.edit-site-header__toolbar button[aria-label="Undo"]' );
45
43
 
46
- const clickRedoInHeaderToolbar = () =>
47
- page.click( '.edit-site-header__toolbar button[aria-label="Redo"]' );
44
+ const clickRedoInHeaderToolbar = async () => {
45
+ await page.waitForSelector(
46
+ '.edit-site-header__toolbar button[aria-label="Redo"][aria-disabled="false"]'
47
+ );
48
+ return page.click( '.edit-site-header__toolbar button[aria-label="Redo"]' );
49
+ };
48
50
 
49
51
  const undoRevertInHeaderToolbar = async () => {
50
52
  await clickUndoInHeaderToolbar();
@@ -72,7 +74,9 @@ const save = async () => {
72
74
  const revertTemplate = async () => {
73
75
  await page.click( '.edit-site-document-actions__get-info' );
74
76
  await page.click( '.edit-site-template-details__revert-button' );
75
- await waitForNotice();
77
+ await page.waitForXPath(
78
+ '//*[contains(@class, "components-snackbar") and contains(text(), "Template reverted")]'
79
+ );
76
80
  await assertSaveButtonIsEnabled();
77
81
  };
78
82