@wordpress/e2e-tests 7.18.1 → 7.19.1-next.79a6196f.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/jest.config.js +0 -1
  4. package/package.json +8 -9
  5. package/plugins/iframed-block/block.json +1 -0
  6. package/plugins/iframed-inline-styles/block.json +1 -0
  7. package/plugins/iframed-masonry-block/block.json +1 -0
  8. package/plugins/iframed-multiple-stylesheets/block.json +1 -0
  9. package/plugins/interactive-blocks/directive-bind/block.json +1 -0
  10. package/plugins/interactive-blocks/directive-body/block.json +1 -0
  11. package/plugins/interactive-blocks/directive-class/block.json +1 -0
  12. package/plugins/interactive-blocks/directive-context/block.json +1 -0
  13. package/plugins/interactive-blocks/directive-init/block.json +1 -0
  14. package/plugins/interactive-blocks/directive-key/block.json +1 -0
  15. package/plugins/interactive-blocks/directive-on/block.json +1 -0
  16. package/plugins/interactive-blocks/directive-priorities/block.json +1 -0
  17. package/plugins/interactive-blocks/directive-slots/block.json +1 -0
  18. package/plugins/interactive-blocks/directive-style/block.json +1 -0
  19. package/plugins/interactive-blocks/directive-text/block.json +1 -0
  20. package/plugins/interactive-blocks/directive-watch/block.json +1 -0
  21. package/plugins/interactive-blocks/negation-operator/block.json +1 -0
  22. package/plugins/interactive-blocks/router-navigate/block.json +1 -0
  23. package/plugins/interactive-blocks/router-navigate/render.php +1 -0
  24. package/plugins/interactive-blocks/router-regions/block.json +1 -0
  25. package/plugins/interactive-blocks/router-regions/render.php +1 -0
  26. package/plugins/interactive-blocks/store-tag/block.json +1 -0
  27. package/plugins/interactive-blocks/store-tag/render.php +1 -0
  28. package/plugins/interactive-blocks/tovdom/block.json +1 -0
  29. package/plugins/interactive-blocks/tovdom-islands/block.json +1 -0
  30. package/plugins/interactive-blocks/tovdom-islands/render.php +12 -0
  31. package/plugins/pattern-recursion.php +22 -0
  32. package/specs/editor/various/change-detection.test.js +5 -1
  33. package/specs/editor/various/inserting-blocks.test.js +3 -5
  34. package/specs/editor/plugins/innerblocks-locking-all-embed.js +0 -56
  35. package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +0 -153
  36. package/specs/editor/various/allowed-patterns.test.js +0 -74
  37. package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +0 -110
  38. package/specs/editor/various/block-switcher.test.js +0 -130
  39. package/specs/editor/various/core-settings.test.js +0 -42
  40. package/specs/editor/various/datepicker.test.js +0 -148
  41. package/specs/editor/various/dropdown-menu.test.js +0 -143
  42. package/specs/editor/various/editor-modes.test.js +0 -160
  43. package/specs/editor/various/invalid-block.test.js +0 -100
  44. package/specs/editor/various/nux.test.js +0 -158
  45. package/specs/editor/various/preferences.test.js +0 -58
  46. package/specs/editor/various/publish-panel.test.js +0 -82
  47. package/specs/editor/various/publishing.test.js +0 -176
  48. package/specs/editor/various/scheduling.test.js +0 -65
  49. package/specs/editor/various/sidebar.test.js +0 -168
  50. package/specs/editor/various/taxonomies.test.js +0 -251
  51. package/specs/experiments/blocks/post-comments-form.test.js +0 -53
  52. package/specs/experiments/experimental-features.js +0 -39
  53. package/specs/experiments/fixtures/menu-items-request-fixture.json +0 -84
  54. package/specs/site-editor/multi-entity-saving.test.js +0 -239
  55. package/specs/site-editor/settings-sidebar.test.js +0 -122
  56. package/specs/site-editor/site-editor-export.test.js +0 -63
  57. package/specs/widgets/editing-widgets.test.js +0 -962
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 7.19.0 (2023-12-13)
6
+
5
7
  ## 7.18.0 (2023-11-29)
6
8
 
7
9
  ## 7.17.0 (2023-11-16)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2023 by the contributors
3
+ Copyright 2016-2024 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
package/jest.config.js CHANGED
@@ -12,7 +12,6 @@ module.exports = {
12
12
  '@wordpress/jest-console',
13
13
  '@wordpress/jest-puppeteer-axe',
14
14
  'expect-puppeteer',
15
- 'puppeteer-testing-library/extend-expect',
16
15
  ],
17
16
  testPathIgnorePatterns: [ '/node_modules/' ],
18
17
  snapshotFormat: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "7.18.1",
3
+ "version": "7.19.1-next.79a6196f.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,18 +23,17 @@
23
23
  "node": ">=14"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/e2e-test-utils": "^10.18.0",
27
- "@wordpress/interactivity": "^3.0.1",
28
- "@wordpress/jest-console": "^7.18.0",
29
- "@wordpress/jest-puppeteer-axe": "^6.18.0",
30
- "@wordpress/scripts": "^26.18.0",
31
- "@wordpress/url": "^3.48.0",
26
+ "@wordpress/e2e-test-utils": "^10.19.1-next.79a6196f.0",
27
+ "@wordpress/interactivity": "^3.1.2-next.79a6196f.0",
28
+ "@wordpress/jest-console": "^7.19.1-next.79a6196f.0",
29
+ "@wordpress/jest-puppeteer-axe": "^6.19.1-next.79a6196f.0",
30
+ "@wordpress/scripts": "^27.0.1-next.79a6196f.0",
31
+ "@wordpress/url": "^3.49.1-next.79a6196f.0",
32
32
  "chalk": "^4.0.0",
33
33
  "expect-puppeteer": "^4.4.0",
34
34
  "filenamify": "^4.2.0",
35
35
  "jest-message-util": "^29.6.2",
36
36
  "jest-snapshot": "^29.6.2",
37
- "puppeteer-testing-library": "^0.5.0",
38
37
  "uuid": "^9.0.1"
39
38
  },
40
39
  "peerDependencies": {
@@ -46,5 +45,5 @@
46
45
  "publishConfig": {
47
46
  "access": "public"
48
47
  },
49
- "gitHead": "12b897d7feff1cb00ddbf9016b62c1177d9c0081"
48
+ "gitHead": "1e74b942ac0119a22ceaaf5c9594263f3ec516ab"
50
49
  }
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 3,
3
4
  "name": "test/iframed-block",
4
5
  "title": "Iframed Block",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 3,
3
4
  "name": "test/iframed-inline-styles",
4
5
  "title": "Iframed Inline Styles",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 3,
3
4
  "name": "test/iframed-masonry-block",
4
5
  "title": "Iframed Masonry Block",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 3,
3
4
  "name": "test/iframed-multiple-stylesheets",
4
5
  "title": "Iframed Multiple Stylesheets",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-bind",
4
5
  "title": "E2E Interactivity tests - directive bind",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-body",
4
5
  "title": "E2E Interactivity tests - directive body",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-class",
4
5
  "title": "E2E Interactivity tests - directive class",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-context",
4
5
  "title": "E2E Interactivity tests - directive context",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-init",
4
5
  "title": "E2E Interactivity tests - directive init",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-key",
4
5
  "title": "E2E Interactivity tests - directive key",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-on",
4
5
  "title": "E2E Interactivity tests - directive on",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-priorities",
4
5
  "title": "E2E Interactivity tests - directive priorities",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-slots",
4
5
  "title": "E2E Interactivity tests - directive slots",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-style",
4
5
  "title": "E2E Interactivity tests - directive style",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-text",
4
5
  "title": "E2E Interactivity tests - directive text",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-watch",
4
5
  "title": "E2E Interactivity tests - directive watch",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/negation-operator",
4
5
  "title": "E2E Interactivity tests - negation operator",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/router-navigate",
4
5
  "title": "E2E Interactivity tests - router navigate",
@@ -3,6 +3,7 @@
3
3
  * HTML for testing the router navigate function.
4
4
  *
5
5
  * @package gutenberg-test-interactive-blocks
6
+ *
6
7
  * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
7
8
  */
8
9
 
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/router-regions",
4
5
  "title": "E2E Interactivity tests - router regions",
@@ -3,6 +3,7 @@
3
3
  * HTML for testing the hydration of router regions.
4
4
  *
5
5
  * @package gutenberg-test-interactive-blocks
6
+ *
6
7
  * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
7
8
  */
8
9
 
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/store-tag",
4
5
  "title": "E2E Interactivity tests - store tag",
@@ -3,6 +3,7 @@
3
3
  * HTML for testing the hydration of the serialized store.
4
4
  *
5
5
  * @package gutenberg-test-interactive-blocks
6
+ *
6
7
  * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
7
8
  */
8
9
 
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/tovdom",
4
5
  "title": "E2E Interactivity tests - tovdom",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/tovdom-islands",
4
5
  "title": "E2E Interactivity tests - tovdom islands",
@@ -68,4 +68,16 @@ gutenberg_enqueue_module( 'tovdom-islands-view' );
68
68
  </div>
69
69
  </div>
70
70
  </div>
71
+
72
+
73
+
74
+ <div data-wp-interactive='{ "namespace": "tovdom-islands" }'>
75
+ <div data-wp-interactive='{ "namespace": "something-new" }'></div>
76
+ <div data-wp-show-mock="state.falseValue">
77
+ <span data-testid="directive after different namespace">
78
+ The directive above should keep the `tovdom-island` namespace,
79
+ so this message should not be visible.
80
+ </span>
81
+ </div>
82
+ </div>
71
83
  </div>
@@ -0,0 +1,22 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Protection Against Recursive Patterns
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * @package gutenberg-test-pattern-recursion
8
+ */
9
+
10
+ add_filter(
11
+ 'init',
12
+ function () {
13
+ register_block_pattern(
14
+ 'evil/recursive',
15
+ array(
16
+ 'title' => 'Evil recursive',
17
+ 'description' => 'Evil recursive',
18
+ 'content' => '<!-- wp:paragraph --><p>Hello</p><!-- /wp:paragraph --><!-- wp:pattern {"slug":"evil/recursive"} /-->',
19
+ )
20
+ );
21
+ }
22
+ );
@@ -370,7 +370,11 @@ describe( 'Change detection', () => {
370
370
  it( 'consecutive edits to the same attribute should mark the post as dirty after a save', async () => {
371
371
  // Open the sidebar block settings.
372
372
  await openDocumentSettingsSidebar();
373
- await page.click( '.edit-post-sidebar__panel-tab[data-label="Block"]' );
373
+
374
+ const blockInspectorTab = await page.waitForXPath(
375
+ '//button[@role="tab"][contains(text(), "Block")]'
376
+ );
377
+ await blockInspectorTab.click();
374
378
 
375
379
  // Insert a paragraph.
376
380
  await clickBlockAppender();
@@ -323,7 +323,7 @@ describe( 'Inserting blocks', () => {
323
323
  );
324
324
  await browseAll.click();
325
325
  const availableBlocks = await page.$$(
326
- '.edit-post-editor__inserter-panel .block-editor-block-types-list__list-item'
326
+ '.editor-inserter-sidebar .block-editor-block-types-list__list-item'
327
327
  );
328
328
  expect( availableBlocks ).toHaveLength( 1 );
329
329
  } );
@@ -332,13 +332,11 @@ describe( 'Inserting blocks', () => {
332
332
  it( 'closes the main inserter after inserting a single-use block, like the More block', async () => {
333
333
  await insertBlock( 'More' );
334
334
  await page.waitForSelector(
335
- '.edit-post-header-toolbar__inserter-toggle:not(.is-pressed)'
335
+ '.editor-document-tools__inserter-toggle:not(.is-pressed)'
336
336
  );
337
337
 
338
338
  // The inserter panel should've closed.
339
- const inserterPanels = await page.$$(
340
- '.edit-post-editor__inserter-panel'
341
- );
339
+ const inserterPanels = await page.$$( '.editor-inserter-sidebar' );
342
340
  expect( inserterPanels.length ).toBe( 0 );
343
341
 
344
342
  // The editable 'Read More' text should be focused.
@@ -1,56 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- activatePlugin,
6
- createNewPost,
7
- deactivatePlugin,
8
- insertBlock,
9
- createEmbeddingMatcher,
10
- createJSONResponse,
11
- setUpResponseMocking,
12
- } from '@wordpress/e2e-test-utils';
13
-
14
- const MOCK_RESPONSES = [
15
- {
16
- match: createEmbeddingMatcher( 'https://twitter.com/wordpress' ),
17
- onRequestMatch: createJSONResponse( {
18
- url: 'https://twitter.com/wordpress',
19
- html: '<p>Mock success response.</p>',
20
- type: 'rich',
21
- provider_name: 'Twitter',
22
- provider_url: 'https://twitter.com',
23
- version: '1.0',
24
- } ),
25
- },
26
- ];
27
-
28
- describe( 'Embed block inside a locked all parent', () => {
29
- beforeAll( async () => {
30
- await activatePlugin( 'gutenberg-test-innerblocks-locking-all-embed' );
31
- } );
32
-
33
- beforeEach( async () => {
34
- await setUpResponseMocking( MOCK_RESPONSES );
35
- await createNewPost();
36
- } );
37
-
38
- afterAll( async () => {
39
- await deactivatePlugin(
40
- 'gutenberg-test-innerblocks-locking-all-embed'
41
- );
42
- } );
43
-
44
- it( 'embed block should be able to embed external content', async () => {
45
- await insertBlock( 'Test Inner Blocks Locking All Embed' );
46
- const embedInputSelector =
47
- '.components-placeholder__input[aria-label="Embed URL"]';
48
- await page.waitForSelector( embedInputSelector );
49
- await page.click( embedInputSelector );
50
- // This URL should not have a trailing slash.
51
- await page.keyboard.type( 'https://twitter.com/wordpress' );
52
- await page.keyboard.press( 'Enter' );
53
- // The twitter block should appear correctly.
54
- await page.waitForSelector( 'figure.wp-block-embed' );
55
- } );
56
- } );
@@ -1,153 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 1`] = `
4
- "<!-- wp:paragraph -->
5
- <p>1st</p>
6
- <!-- /wp:paragraph -->
7
-
8
- <!-- wp:paragraph -->
9
- <p>2nd</p>
10
- <!-- /wp:paragraph -->
11
-
12
- <!-- wp:paragraph -->
13
- <p>3rd</p>
14
- <!-- /wp:paragraph -->"
15
- `;
16
-
17
- exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 2`] = `
18
- "<!-- wp:paragraph -->
19
- <p>3rd</p>
20
- <!-- /wp:paragraph -->
21
-
22
- <!-- wp:paragraph -->
23
- <p>1st</p>
24
- <!-- /wp:paragraph -->
25
-
26
- <!-- wp:paragraph -->
27
- <p>2nd</p>
28
- <!-- /wp:paragraph -->"
29
- `;
30
-
31
- exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 1`] = `
32
- "<!-- wp:paragraph -->
33
- <p>1st</p>
34
- <!-- /wp:paragraph -->
35
-
36
- <!-- wp:paragraph -->
37
- <p>2nd</p>
38
- <!-- /wp:paragraph -->
39
-
40
- <!-- wp:paragraph -->
41
- <p>3rd</p>
42
- <!-- /wp:paragraph -->"
43
- `;
44
-
45
- exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 2`] = `
46
- "<!-- wp:paragraph -->
47
- <p>2nd</p>
48
- <!-- /wp:paragraph -->
49
-
50
- <!-- wp:paragraph -->
51
- <p>3rd</p>
52
- <!-- /wp:paragraph -->
53
-
54
- <!-- wp:paragraph -->
55
- <p>1st</p>
56
- <!-- /wp:paragraph -->"
57
- `;
58
-
59
- exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 1`] = `
60
- "<!-- wp:paragraph -->
61
- <p>1st</p>
62
- <!-- /wp:paragraph -->
63
-
64
- <!-- wp:paragraph -->
65
- <p>2nd</p>
66
- <!-- /wp:paragraph -->
67
-
68
- <!-- wp:paragraph -->
69
- <p>3rd</p>
70
- <!-- /wp:paragraph -->"
71
- `;
72
-
73
- exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 2`] = `
74
- "<!-- wp:paragraph -->
75
- <p>1st</p>
76
- <!-- /wp:paragraph -->
77
-
78
- <!-- wp:paragraph -->
79
- <p>3rd</p>
80
- <!-- /wp:paragraph -->
81
-
82
- <!-- wp:paragraph -->
83
- <p>2nd</p>
84
- <!-- /wp:paragraph -->"
85
- `;
86
-
87
- exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 1`] = `
88
- "<!-- wp:paragraph -->
89
- <p>1st</p>
90
- <!-- /wp:paragraph -->
91
-
92
- <!-- wp:paragraph -->
93
- <p>2nd</p>
94
- <!-- /wp:paragraph -->
95
-
96
- <!-- wp:paragraph -->
97
- <p>3rd</p>
98
- <!-- /wp:paragraph -->"
99
- `;
100
-
101
- exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 2`] = `
102
- "<!-- wp:paragraph -->
103
- <p>3rd</p>
104
- <!-- /wp:paragraph -->
105
-
106
- <!-- wp:paragraph -->
107
- <p>1st</p>
108
- <!-- /wp:paragraph -->
109
-
110
- <!-- wp:paragraph -->
111
- <p>2nd</p>
112
- <!-- /wp:paragraph -->"
113
- `;
114
-
115
- exports[`block editor keyboard shortcuts test shortcuts handling through portals in the same tree should prevent deleting multiple selected blocks from inputs 1`] = `
116
- "<!-- wp:paragraph -->
117
- <p>1st</p>
118
- <!-- /wp:paragraph -->
119
-
120
- <!-- wp:paragraph -->
121
- <p>2nd</p>
122
- <!-- /wp:paragraph -->
123
-
124
- <!-- wp:paragraph -->
125
- <p>3rd</p>
126
- <!-- /wp:paragraph -->"
127
- `;
128
-
129
- exports[`block editor keyboard shortcuts test shortcuts handling through portals in the same tree should propagate properly and duplicate selected blocks 1`] = `
130
- "<!-- wp:paragraph -->
131
- <p>1st</p>
132
- <!-- /wp:paragraph -->
133
-
134
- <!-- wp:paragraph -->
135
- <p>2nd</p>
136
- <!-- /wp:paragraph -->
137
-
138
- <!-- wp:paragraph -->
139
- <p>3rd</p>
140
- <!-- /wp:paragraph -->
141
-
142
- <!-- wp:paragraph -->
143
- <p>1st</p>
144
- <!-- /wp:paragraph -->
145
-
146
- <!-- wp:paragraph -->
147
- <p>2nd</p>
148
- <!-- /wp:paragraph -->
149
-
150
- <!-- wp:paragraph -->
151
- <p>3rd</p>
152
- <!-- /wp:paragraph -->"
153
- `;
@@ -1,74 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- activatePlugin,
6
- createNewPost,
7
- deactivatePlugin,
8
- searchForPattern,
9
- toggleGlobalBlockInserter,
10
- } from '@wordpress/e2e-test-utils';
11
-
12
- const checkPatternExistence = async ( name, available = true ) => {
13
- await searchForPattern( name );
14
- const patternElement = await page.waitForXPath(
15
- `//div[@role = 'option']//div[contains(text(), '${ name }')]`,
16
- { timeout: 5000, visible: available, hidden: ! available }
17
- );
18
- const patternExists = !! patternElement;
19
- await toggleGlobalBlockInserter();
20
- return patternExists;
21
- };
22
-
23
- const TEST_PATTERNS = [
24
- [ 'Test: Single heading', true ],
25
- [ 'Test: Single paragraph', false ],
26
- [ 'Test: Paragraph inside group', false ],
27
- ];
28
-
29
- describe( 'Allowed Patterns', () => {
30
- beforeAll( async () => {
31
- await activatePlugin( 'gutenberg-test-allowed-patterns' );
32
- await createNewPost();
33
- } );
34
- afterAll( async () => {
35
- await deactivatePlugin( 'gutenberg-test-allowed-patterns' );
36
- } );
37
-
38
- describe( 'Disable blocks plugin disabled', () => {
39
- for ( const [ patternName ] of TEST_PATTERNS ) {
40
- it( `should show test pattern "${ patternName }"`, async () => {
41
- expect( await checkPatternExistence( patternName, true ) ).toBe(
42
- true
43
- );
44
- } );
45
- }
46
- } );
47
-
48
- describe( 'Disable blocks plugin enabled', () => {
49
- beforeAll( async () => {
50
- await activatePlugin(
51
- 'gutenberg-test-allowed-patterns-disable-blocks'
52
- );
53
- await createNewPost();
54
- } );
55
- afterAll( async () => {
56
- await deactivatePlugin(
57
- 'gutenberg-test-allowed-patterns-disable-blocks'
58
- );
59
- } );
60
-
61
- for ( const [ patternName, shouldBeAvailable ] of TEST_PATTERNS ) {
62
- it( `should${
63
- shouldBeAvailable ? '' : ' not'
64
- } show test "pattern ${ patternName }"`, async () => {
65
- expect(
66
- await checkPatternExistence(
67
- patternName,
68
- shouldBeAvailable
69
- )
70
- ).toBe( shouldBeAvailable );
71
- } );
72
- }
73
- } );
74
- } );