@wordpress/e2e-tests 4.3.0 → 4.6.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 (52) hide show
  1. package/config/flaky-tests-reporter.js +3 -3
  2. package/package.json +6 -6
  3. package/specs/editor/blocks/cover.test.js +10 -14
  4. package/specs/editor/blocks/heading.test.js +1 -5
  5. package/specs/editor/blocks/navigation.test.js +72 -23
  6. package/specs/editor/plugins/cpt-locking.test.js +2 -3
  7. package/specs/editor/plugins/iframed-block.test.js +3 -2
  8. package/specs/editor/plugins/iframed-inline-styles.test.js +1 -0
  9. package/specs/editor/plugins/iframed-masonry-block.test.js +3 -2
  10. package/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +3 -1
  11. package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +1 -1
  12. package/specs/editor/various/datepicker.test.js +30 -18
  13. package/specs/editor/various/embedding.test.js +2 -4
  14. package/specs/editor/various/links.test.js +2 -3
  15. package/specs/editor/various/navigable-toolbar.test.js +2 -3
  16. package/specs/editor/various/post-visibility.test.js +1 -1
  17. package/specs/editor/various/publishing.test.js +4 -2
  18. package/specs/editor/various/scheduling.test.js +2 -2
  19. package/specs/editor/various/sidebar.test.js +4 -6
  20. package/specs/editor/various/switch-to-draft.test.js +1 -1
  21. package/specs/editor/various/taxonomies.test.js +8 -7
  22. package/specs/editor/various/writing-flow.test.js +19 -0
  23. package/specs/experiments/navigation-editor.test.js +4 -6
  24. package/specs/performance/post-editor.test.js +10 -14
  25. package/specs/performance/site-editor.test.js +2 -5
  26. package/specs/widgets/editing-widgets.test.js +12 -8
  27. package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +0 -33
  28. package/specs/editor/blocks/__snapshots__/code.test.js.snap +0 -14
  29. package/specs/editor/blocks/__snapshots__/html.test.js.snap +0 -8
  30. package/specs/editor/blocks/__snapshots__/preformatted.test.js.snap +0 -24
  31. package/specs/editor/blocks/__snapshots__/separator.test.js.snap +0 -7
  32. package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +0 -13
  33. package/specs/editor/blocks/__snapshots__/table.test.js.snap +0 -61
  34. package/specs/editor/blocks/buttons.test.js +0 -95
  35. package/specs/editor/blocks/code.test.js +0 -48
  36. package/specs/editor/blocks/html.test.js +0 -31
  37. package/specs/editor/blocks/preformatted.test.js +0 -62
  38. package/specs/editor/blocks/separator.test.js +0 -22
  39. package/specs/editor/blocks/spacer.test.js +0 -48
  40. package/specs/editor/blocks/table.test.js +0 -296
  41. package/specs/editor/various/__snapshots__/rtl.test.js.snap +0 -63
  42. package/specs/editor/various/preview.test.js +0 -425
  43. package/specs/editor/various/rtl.test.js +0 -129
  44. package/specs/site-editor/style-variations.test.js +0 -213
  45. package/specs/site-editor/template-part.test.js +0 -346
  46. package/specs/site-editor/template-revert.test.js +0 -209
  47. package/themes/style-variations/block-templates/index.html +0 -11
  48. package/themes/style-variations/index.php +0 -0
  49. package/themes/style-variations/style.css +0 -15
  50. package/themes/style-variations/styles/pink.json +0 -33
  51. package/themes/style-variations/styles/yellow.json +0 -12
  52. package/themes/style-variations/theme.json +0 -8
@@ -681,17 +681,15 @@ describe.skip( 'Navigation editor', () => {
681
681
 
682
682
  // Get the title/label of the last Nav item inside the Nav block.
683
683
  const lastItemAttributes = await page.evaluate( () => {
684
- const { getBlockOrder, getBlocks } = wp.data.select(
685
- 'core/block-editor'
686
- );
684
+ const { getBlockOrder, getBlocks } =
685
+ wp.data.select( 'core/block-editor' );
687
686
 
688
687
  const lockedNavigationBlock = getBlockOrder()[ 0 ];
689
688
 
690
689
  const navItemBlocks = getBlocks( lockedNavigationBlock );
691
690
 
692
- const { attributes } = navItemBlocks[
693
- navItemBlocks.length - 1
694
- ];
691
+ const { attributes } =
692
+ navItemBlocks[ navItemBlocks.length - 1 ];
695
693
 
696
694
  return attributes;
697
695
  } );
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import { basename, join } from 'path';
5
5
  import { writeFileSync } from 'fs';
6
- import { sum } from 'lodash';
7
6
 
8
7
  /**
9
8
  * WordPress dependencies
@@ -136,11 +135,8 @@ describe( 'Post Editor Performance', () => {
136
135
  }
137
136
  await page.tracing.stop();
138
137
  traceResults = JSON.parse( readFile( traceFile ) );
139
- const [
140
- keyDownEvents,
141
- keyPressEvents,
142
- keyUpEvents,
143
- ] = getTypingEventDurations( traceResults );
138
+ const [ keyDownEvents, keyPressEvents, keyUpEvents ] =
139
+ getTypingEventDurations( traceResults );
144
140
  if (
145
141
  keyDownEvents.length === keyPressEvents.length &&
146
142
  keyPressEvents.length === keyUpEvents.length
@@ -226,6 +222,10 @@ describe( 'Post Editor Performance', () => {
226
222
  } );
227
223
 
228
224
  it( 'Searching the inserter', async () => {
225
+ function sum( arr ) {
226
+ return arr.reduce( ( a, b ) => a + b, 0 );
227
+ }
228
+
229
229
  // Measure time to search the inserter and get results.
230
230
  await openGlobalBlockInserter();
231
231
  for ( let j = 0; j < 10; j++ ) {
@@ -240,11 +240,8 @@ describe( 'Post Editor Performance', () => {
240
240
  await page.keyboard.type( 'p' );
241
241
  await page.tracing.stop();
242
242
  traceResults = JSON.parse( readFile( traceFile ) );
243
- const [
244
- keyDownEvents,
245
- keyPressEvents,
246
- keyUpEvents,
247
- ] = getTypingEventDurations( traceResults );
243
+ const [ keyDownEvents, keyPressEvents, keyUpEvents ] =
244
+ getTypingEventDurations( traceResults );
248
245
  if (
249
246
  keyDownEvents.length === keyPressEvents.length &&
250
247
  keyPressEvents.length === keyUpEvents.length
@@ -284,9 +281,8 @@ describe( 'Post Editor Performance', () => {
284
281
  await page.tracing.stop();
285
282
 
286
283
  traceResults = JSON.parse( readFile( traceFile ) );
287
- const [ mouseOverEvents, mouseOutEvents ] = getHoverEventDurations(
288
- traceResults
289
- );
284
+ const [ mouseOverEvents, mouseOutEvents ] =
285
+ getHoverEventDurations( traceResults );
290
286
  for ( let k = 0; k < mouseOverEvents.length; k++ ) {
291
287
  results.inserterHover.push(
292
288
  mouseOverEvents[ k ] + mouseOutEvents[ k ]
@@ -130,11 +130,8 @@ describe( 'Site Editor Performance', () => {
130
130
  }
131
131
  await page.tracing.stop();
132
132
  const traceResults = JSON.parse( readFile( traceFile ) );
133
- const [
134
- keyDownEvents,
135
- keyPressEvents,
136
- keyUpEvents,
137
- ] = getTypingEventDurations( traceResults );
133
+ const [ keyDownEvents, keyPressEvents, keyUpEvents ] =
134
+ getTypingEventDurations( traceResults );
138
135
 
139
136
  for ( let j = 0; j < keyDownEvents.length; j++ ) {
140
137
  results.type.push(
@@ -113,7 +113,8 @@ describe( 'Widgets screen', () => {
113
113
  const insertionPointIndicator = await page.$(
114
114
  '.block-editor-block-list__insertion-point-indicator'
115
115
  );
116
- const insertionPointIndicatorBoundingBox = await insertionPointIndicator.boundingBox();
116
+ const insertionPointIndicatorBoundingBox =
117
+ await insertionPointIndicator.boundingBox();
117
118
 
118
119
  expect(
119
120
  insertionPointIndicatorBoundingBox.y > lastBlockBoundingBox.y
@@ -298,7 +299,8 @@ describe( 'Widgets screen', () => {
298
299
  firstParagraphBlock
299
300
  );
300
301
 
301
- const secondParagraphBlockBoundingBox = await secondParagraphBlock.boundingBox();
302
+ const secondParagraphBlockBoundingBox =
303
+ await secondParagraphBlock.boundingBox();
302
304
 
303
305
  // Click outside the block to move the focus back to the widget area.
304
306
  await page.mouse.click(
@@ -560,16 +562,18 @@ describe( 'Widgets screen', () => {
560
562
  {},
561
563
  firstParagraphBlock
562
564
  );
563
- const duplicatedParagraphBlock = await firstParagraphBlock.evaluateHandle(
564
- ( paragraph ) => paragraph.nextSibling
565
- );
565
+ const duplicatedParagraphBlock =
566
+ await firstParagraphBlock.evaluateHandle(
567
+ ( paragraph ) => paragraph.nextSibling
568
+ );
566
569
 
567
570
  const firstParagraphBlockClientId = await firstParagraphBlock.evaluate(
568
571
  ( node ) => node.dataset.block
569
572
  );
570
- const duplicatedParagraphBlockClientId = await duplicatedParagraphBlock.evaluate(
571
- ( node ) => node.dataset.block
572
- );
573
+ const duplicatedParagraphBlockClientId =
574
+ await duplicatedParagraphBlock.evaluate(
575
+ ( node ) => node.dataset.block
576
+ );
573
577
 
574
578
  expect( firstParagraphBlockClientId ).not.toBe(
575
579
  duplicatedParagraphBlockClientId
@@ -1,33 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Buttons can jump to the link editor using the keyboard shortcut 1`] = `
4
- "<!-- wp:buttons -->
5
- <div class=\\"wp-block-buttons\\"><!-- wp:button -->
6
- <div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link\\" href=\\"https://www.wordpress.org/\\">WordPress</a></div>
7
- <!-- /wp:button --></div>
8
- <!-- /wp:buttons -->"
9
- `;
10
-
11
- exports[`Buttons dismisses link editor when escape is pressed 1`] = `
12
- "<!-- wp:buttons -->
13
- <div class=\\"wp-block-buttons\\"><!-- wp:button -->
14
- <div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link\\">WordPress</a></div>
15
- <!-- /wp:button --></div>
16
- <!-- /wp:buttons -->"
17
- `;
18
-
19
- exports[`Buttons has focus on button content (slash inserter) 1`] = `
20
- "<!-- wp:buttons -->
21
- <div class=\\"wp-block-buttons\\"><!-- wp:button -->
22
- <div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link\\">Content</a></div>
23
- <!-- /wp:button --></div>
24
- <!-- /wp:buttons -->"
25
- `;
26
-
27
- exports[`Buttons has focus on button content 1`] = `
28
- "<!-- wp:buttons -->
29
- <div class=\\"wp-block-buttons\\"><!-- wp:button -->
30
- <div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link\\">Content</a></div>
31
- <!-- /wp:button --></div>
32
- <!-- /wp:buttons -->"
33
- `;
@@ -1,14 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Code can be created by three backticks and enter 1`] = `
4
- "<!-- wp:code -->
5
- <pre class=\\"wp-block-code\\"><code>&lt;?php</code></pre>
6
- <!-- /wp:code -->"
7
- `;
8
-
9
- exports[`Code should paste plain text 1`] = `
10
- "<!-- wp:code -->
11
- <pre class=\\"wp-block-code\\"><code>&lt;img />
12
- &lt;br></code></pre>
13
- <!-- /wp:code -->"
14
- `;
@@ -1,8 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`HTML block can be created by typing "/html" 1`] = `
4
- "<!-- wp:html -->
5
- <p>Pythagorean theorem:
6
- <var>a</var><sup>2</sup> + <var>b</var><sup>2</sup> = <var>c</var><sup>2</sup> </p>
7
- <!-- /wp:html -->"
8
- `;
@@ -1,24 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Preformatted should preserve character newlines 1`] = `
4
- "<!-- wp:html -->
5
- <pre>1
6
- 2</pre>
7
- <!-- /wp:html -->"
8
- `;
9
-
10
- exports[`Preformatted should preserve character newlines 2`] = `
11
- "<!-- wp:preformatted -->
12
- <pre class=\\"wp-block-preformatted\\">0
13
- 1
14
- 2</pre>
15
- <!-- /wp:preformatted -->"
16
- `;
17
-
18
- exports[`Preformatted should preserve white space when merging 1`] = `
19
- "<!-- wp:preformatted -->
20
- <pre class=\\"wp-block-preformatted\\">1
21
- 2
22
- 3</pre>
23
- <!-- /wp:preformatted -->"
24
- `;
@@ -1,7 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Separator can be created by three dashes and enter 1`] = `
4
- "<!-- wp:separator -->
5
- <hr class=\\"wp-block-separator has-alpha-channel-opacity\\"/>
6
- <!-- /wp:separator -->"
7
- `;
@@ -1,13 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Spacer can be created by typing "/spacer" 1`] = `
4
- "<!-- wp:spacer -->
5
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
6
- <!-- /wp:spacer -->"
7
- `;
8
-
9
- exports[`Spacer can be resized using the drag handle and remains selected after being dragged 1`] = `
10
- "<!-- wp:spacer {\\"height\\":\\"150px\\"} -->
11
- <div style=\\"height:150px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
12
- <!-- /wp:spacer -->"
13
- `;
@@ -1,61 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Table allows a caption to be added 1`] = `
4
- "<!-- wp:table -->
5
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><figcaption>Caption!</figcaption></figure>
6
- <!-- /wp:table -->"
7
- `;
8
-
9
- exports[`Table allows adding and deleting columns across the table header, body and footer 1`] = `
10
- "<!-- wp:table -->
11
- <figure class=\\"wp-block-table\\"><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody><tfoot><tr><td></td><td></td><td></td></tr></tfoot></table></figure>
12
- <!-- /wp:table -->"
13
- `;
14
-
15
- exports[`Table allows adding and deleting columns across the table header, body and footer 2`] = `
16
- "<!-- wp:table -->
17
- <figure class=\\"wp-block-table\\"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody><tfoot><tr><td></td><td></td></tr></tfoot></table></figure>
18
- <!-- /wp:table -->"
19
- `;
20
-
21
- exports[`Table allows cells to be selected when the cell area outside of the RichText is clicked 1`] = `
22
- "<!-- wp:table {\\"hasFixedLayout\\":true} -->
23
- <figure class=\\"wp-block-table\\"><table class=\\"has-fixed-layout\\"><tbody><tr><td><br><br><br><br></td><td>Second cell.</td></tr><tr><td></td><td></td></tr></tbody></table></figure>
24
- <!-- /wp:table -->"
25
- `;
26
-
27
- exports[`Table allows columns to be aligned 1`] = `
28
- "<!-- wp:table -->
29
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td>None</td><td class=\\"has-text-align-left\\" data-align=\\"left\\">To the left</td><td class=\\"has-text-align-center\\" data-align=\\"center\\">Centered</td><td class=\\"has-text-align-right\\" data-align=\\"right\\">Right aligned</td></tr><tr><td></td><td class=\\"has-text-align-left\\" data-align=\\"left\\"></td><td class=\\"has-text-align-center\\" data-align=\\"center\\"></td><td class=\\"has-text-align-right\\" data-align=\\"right\\"></td></tr></tbody></table></figure>
30
- <!-- /wp:table -->"
31
- `;
32
-
33
- exports[`Table allows header and footer rows to be switched on and off 1`] = `
34
- "<!-- wp:table -->
35
- <figure class=\\"wp-block-table\\"><table><thead><tr><th>header</th><th></th></tr></thead><tbody><tr><td>body</td><td></td></tr><tr><td></td><td></td></tr></tbody><tfoot><tr><td>footer</td><td></td></tr></tfoot></table></figure>
36
- <!-- /wp:table -->"
37
- `;
38
-
39
- exports[`Table allows header and footer rows to be switched on and off 2`] = `
40
- "<!-- wp:table -->
41
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td>body</td><td></td></tr><tr><td></td><td></td></tr></tbody></table></figure>
42
- <!-- /wp:table -->"
43
- `;
44
-
45
- exports[`Table allows text to by typed into cells 1`] = `
46
- "<!-- wp:table -->
47
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td>This</td><td>is</td></tr><tr><td>table</td><td>block</td></tr></tbody></table></figure>
48
- <!-- /wp:table -->"
49
- `;
50
-
51
- exports[`Table displays a form for choosing the row and column count of the table 1`] = `
52
- "<!-- wp:table -->
53
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody></table></figure>
54
- <!-- /wp:table -->"
55
- `;
56
-
57
- exports[`Table up and down arrow navigation 1`] = `
58
- "<!-- wp:table -->
59
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td>1</td><td>4</td></tr><tr><td>2</td><td>3</td></tr></tbody></table></figure>
60
- <!-- /wp:table -->"
61
- `;
@@ -1,95 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- insertBlock,
6
- getEditedPostContent,
7
- createNewPost,
8
- pressKeyWithModifier,
9
- clickBlockAppender,
10
- } from '@wordpress/e2e-test-utils';
11
-
12
- describe( 'Buttons', () => {
13
- beforeEach( async () => {
14
- await createNewPost();
15
- } );
16
-
17
- it( 'has focus on button content', async () => {
18
- await insertBlock( 'Buttons' );
19
- await page.keyboard.type( 'Content' );
20
-
21
- expect( await getEditedPostContent() ).toMatchSnapshot();
22
- } );
23
-
24
- it( 'has focus on button content (slash inserter)', async () => {
25
- await clickBlockAppender();
26
- await page.keyboard.type( '/buttons' );
27
- await page.keyboard.press( 'Enter' );
28
- await page.keyboard.type( 'Content' );
29
-
30
- expect( await getEditedPostContent() ).toMatchSnapshot();
31
- } );
32
-
33
- it( 'dismisses link editor when escape is pressed', async () => {
34
- // Regression: https://github.com/WordPress/gutenberg/pull/19885
35
- await insertBlock( 'Buttons' );
36
- await pressKeyWithModifier( 'primary', 'k' );
37
- await page.waitForFunction(
38
- () => !! document.activeElement.closest( '.block-editor-url-input' )
39
- );
40
- await page.keyboard.press( 'Escape' );
41
- await page.waitForFunction(
42
- () =>
43
- document.activeElement ===
44
- document.querySelector( '.block-editor-rich-text__editable' )
45
- );
46
- await page.keyboard.type( 'WordPress' );
47
-
48
- expect( await getEditedPostContent() ).toMatchSnapshot();
49
- } );
50
-
51
- it( 'moves focus from the link editor back to the button when escape is pressed after the URL has been submitted', async () => {
52
- // Regression: https://github.com/WordPress/gutenberg/issues/34307
53
- await insertBlock( 'Buttons' );
54
- await pressKeyWithModifier( 'primary', 'k' );
55
- await page.waitForFunction(
56
- () => !! document.activeElement.closest( '.block-editor-url-input' )
57
- );
58
- await page.keyboard.type( 'https://example.com' );
59
- await page.keyboard.press( 'Enter' );
60
- await page.waitForFunction(
61
- () =>
62
- document.activeElement ===
63
- document.querySelector(
64
- '.block-editor-link-control a[href="https://example.com"]'
65
- )
66
- );
67
- await page.keyboard.press( 'Escape' );
68
-
69
- // Focus should move from the link control to the button block's text.
70
- await page.waitForFunction(
71
- () =>
72
- document.activeElement ===
73
- document.querySelector( '[aria-label="Button text"]' )
74
- );
75
-
76
- // The link control should still be visible when a URL is set.
77
- const linkControl = await page.$( '.block-editor-link-control' );
78
- expect( linkControl ).toBeTruthy();
79
- } );
80
-
81
- it( 'can jump to the link editor using the keyboard shortcut', async () => {
82
- await insertBlock( 'Buttons' );
83
- await page.keyboard.type( 'WordPress' );
84
- await pressKeyWithModifier( 'primary', 'k' );
85
- await page.keyboard.type( 'https://www.wordpress.org/' );
86
- await page.keyboard.press( 'Enter' );
87
- // Make sure that the dialog is still opened, and that focus is retained
88
- // within (focusing on the link preview).
89
- await page.waitForSelector(
90
- ':focus.block-editor-link-control__search-item-title'
91
- );
92
-
93
- expect( await getEditedPostContent() ).toMatchSnapshot();
94
- } );
95
- } );
@@ -1,48 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- insertBlock,
6
- clickBlockAppender,
7
- getEditedPostContent,
8
- createNewPost,
9
- setClipboardData,
10
- pressKeyWithModifier,
11
- } from '@wordpress/e2e-test-utils';
12
-
13
- describe( 'Code', () => {
14
- beforeEach( async () => {
15
- await createNewPost();
16
- } );
17
-
18
- it( 'can be created by three backticks and enter', async () => {
19
- await clickBlockAppender();
20
- await page.keyboard.type( '```' );
21
- await page.keyboard.press( 'Enter' );
22
- await page.keyboard.type( '<?php' );
23
-
24
- expect( await getEditedPostContent() ).toMatchSnapshot();
25
- } );
26
-
27
- it( 'should delete block when backspace in an empty code', async () => {
28
- await insertBlock( 'Code' );
29
- await page.keyboard.type( 'a' );
30
-
31
- await page.keyboard.press( 'Backspace' );
32
- await page.keyboard.press( 'Backspace' );
33
-
34
- // Expect code block to be deleted.
35
- expect( await getEditedPostContent() ).toBe( '' );
36
- } );
37
-
38
- it( 'should paste plain text', async () => {
39
- await insertBlock( 'Code' );
40
-
41
- // Test to see if HTML and white space is kept.
42
- await setClipboardData( { plainText: '<img />\n\t<br>' } );
43
-
44
- await pressKeyWithModifier( 'primary', 'v' );
45
-
46
- expect( await getEditedPostContent() ).toMatchSnapshot();
47
- } );
48
- } );
@@ -1,31 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- clickBlockAppender,
6
- getEditedPostContent,
7
- createNewPost,
8
- } from '@wordpress/e2e-test-utils';
9
-
10
- describe( 'HTML block', () => {
11
- beforeEach( async () => {
12
- await createNewPost();
13
- } );
14
-
15
- it( 'can be created by typing "/html"', async () => {
16
- // Create a Custom HTML block with the slash shortcut.
17
- await clickBlockAppender();
18
- await page.keyboard.type( '/html' );
19
- await page.waitForXPath(
20
- `//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Custom HTML')]`
21
- );
22
- await page.keyboard.press( 'Enter' );
23
- await page.keyboard.type( '<p>Pythagorean theorem: ' );
24
- await page.keyboard.press( 'Enter' );
25
- await page.keyboard.type(
26
- '<var>a</var><sup>2</sup> + <var>b</var><sup>2</sup> = <var>c</var><sup>2</sup> </p>'
27
- );
28
-
29
- expect( await getEditedPostContent() ).toMatchSnapshot();
30
- } );
31
- } );
@@ -1,62 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- clickBlockToolbarButton,
6
- clickMenuItem,
7
- getEditedPostContent,
8
- createNewPost,
9
- insertBlock,
10
- clickBlockAppender,
11
- } from '@wordpress/e2e-test-utils';
12
-
13
- describe( 'Preformatted', () => {
14
- beforeEach( async () => {
15
- await createNewPost();
16
- } );
17
-
18
- it( 'should preserve character newlines', async () => {
19
- await insertBlock( 'Custom HTML' );
20
- await page.keyboard.type( '<pre>1' );
21
- await page.keyboard.press( 'Enter' );
22
- await page.keyboard.type( '2</pre>' );
23
-
24
- expect( await getEditedPostContent() ).toMatchSnapshot();
25
-
26
- await clickBlockToolbarButton( 'Options' );
27
- await clickMenuItem( 'Convert to Blocks' );
28
- // Once it's edited, it should be saved as BR tags.
29
- await page.keyboard.type( '0' );
30
- await page.keyboard.press( 'Enter' );
31
- await clickBlockToolbarButton( 'Options' );
32
- await clickMenuItem( 'Edit as HTML' );
33
-
34
- expect( await getEditedPostContent() ).toMatchSnapshot();
35
- } );
36
-
37
- it( 'should preserve white space when merging', async () => {
38
- await insertBlock( 'Preformatted' );
39
- await page.keyboard.type( '1' );
40
- await page.keyboard.press( 'Enter' );
41
- await page.keyboard.type( '2' );
42
- await page.keyboard.press( 'Enter' );
43
- await clickBlockAppender();
44
- await page.keyboard.type( '3' );
45
- await page.keyboard.press( 'ArrowLeft' );
46
- await page.keyboard.press( 'Backspace' );
47
-
48
- expect( await getEditedPostContent() ).toMatchSnapshot();
49
- } );
50
-
51
- it( 'should delete block when backspace in an empty preformatted', async () => {
52
- await insertBlock( 'Preformatted' );
53
-
54
- await page.keyboard.type( 'a' );
55
-
56
- await page.keyboard.press( 'Backspace' );
57
- await page.keyboard.press( 'Backspace' );
58
-
59
- // Expect preformatted block to be deleted.
60
- expect( await getEditedPostContent() ).toBe( '' );
61
- } );
62
- } );
@@ -1,22 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- clickBlockAppender,
6
- getEditedPostContent,
7
- createNewPost,
8
- } from '@wordpress/e2e-test-utils';
9
-
10
- describe( 'Separator', () => {
11
- beforeEach( async () => {
12
- await createNewPost();
13
- } );
14
-
15
- it( 'can be created by three dashes and enter', async () => {
16
- await clickBlockAppender();
17
- await page.keyboard.type( '---' );
18
- await page.keyboard.press( 'Enter' );
19
-
20
- expect( await getEditedPostContent() ).toMatchSnapshot();
21
- } );
22
- } );
@@ -1,48 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- clickBlockAppender,
6
- getEditedPostContent,
7
- createNewPost,
8
- dragAndResize,
9
- } from '@wordpress/e2e-test-utils';
10
-
11
- describe( 'Spacer', () => {
12
- beforeEach( async () => {
13
- await createNewPost();
14
- } );
15
-
16
- it( 'can be created by typing "/spacer"', async () => {
17
- // Create a spacer with the slash block shortcut.
18
- await clickBlockAppender();
19
- await page.keyboard.type( '/spacer' );
20
- await page.waitForXPath(
21
- `//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Spacer')]`
22
- );
23
- await page.keyboard.press( 'Enter' );
24
-
25
- expect( await getEditedPostContent() ).toMatchSnapshot();
26
- } );
27
-
28
- it( 'can be resized using the drag handle and remains selected after being dragged', async () => {
29
- // Create a spacer with the slash block shortcut.
30
- await clickBlockAppender();
31
- await page.keyboard.type( '/spacer' );
32
- await page.waitForXPath(
33
- `//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Spacer')]`
34
- );
35
- await page.keyboard.press( 'Enter' );
36
-
37
- const resizableHandle = await page.$(
38
- '.block-library-spacer__resize-container .components-resizable-box__handle'
39
- );
40
- await dragAndResize( resizableHandle, { x: 0, y: 50 } );
41
- expect( await getEditedPostContent() ).toMatchSnapshot();
42
-
43
- const selectedSpacer = await page.$(
44
- '[data-type="core/spacer"].is-selected'
45
- );
46
- expect( selectedSpacer ).not.toBe( null );
47
- } );
48
- } );