@wordpress/e2e-tests 6.1.0 → 6.2.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
+ ## 6.2.0 (2023-01-11)
6
+
5
7
  ## 6.1.0 (2023-01-02)
6
8
 
7
9
  ## 6.0.0 (2022-12-14)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2022 by the contributors
3
+ Copyright 2016-2023 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "6.1.0",
3
+ "version": "6.2.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,11 +23,11 @@
23
23
  "node": ">=14"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/e2e-test-utils": "^9.1.0",
27
- "@wordpress/jest-console": "^6.7.0",
28
- "@wordpress/jest-puppeteer-axe": "^5.7.0",
29
- "@wordpress/scripts": "^25.1.0",
30
- "@wordpress/url": "^3.25.0",
26
+ "@wordpress/e2e-test-utils": "^9.2.0",
27
+ "@wordpress/jest-console": "^6.8.0",
28
+ "@wordpress/jest-puppeteer-axe": "^5.8.0",
29
+ "@wordpress/scripts": "^25.2.0",
30
+ "@wordpress/url": "^3.26.0",
31
31
  "chalk": "^4.0.0",
32
32
  "expect-puppeteer": "^4.4.0",
33
33
  "filenamify": "^4.2.0",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "200bee7b06b15f6fa655e25b6ab69cbd6b49a357"
49
+ "gitHead": "204c880ff65295768e9695dfee6c7a9fee1fdd05"
50
50
  }
@@ -9,6 +9,7 @@ import {
9
9
  pressKeyWithModifier,
10
10
  openDocumentSettingsSidebar,
11
11
  getListViewBlocks,
12
+ switchBlockInspectorTab,
12
13
  } from '@wordpress/e2e-test-utils';
13
14
 
14
15
  async function openListViewSidebar() {
@@ -20,6 +21,20 @@ async function tabToColumnsControl() {
20
21
  let isColumnsControl = false;
21
22
  do {
22
23
  await page.keyboard.press( 'Tab' );
24
+
25
+ const isBlockInspectorTab = await page.evaluate( () => {
26
+ const activeElement = document.activeElement;
27
+ return (
28
+ activeElement.getAttribute( 'role' ) === 'tab' &&
29
+ activeElement.attributes.getNamedItem( 'aria-label' ).value ===
30
+ 'Styles'
31
+ );
32
+ } );
33
+
34
+ if ( isBlockInspectorTab ) {
35
+ await page.keyboard.press( 'ArrowRight' );
36
+ }
37
+
23
38
  isColumnsControl = await page.evaluate( () => {
24
39
  const activeElement = document.activeElement;
25
40
  return (
@@ -60,6 +75,7 @@ describe( 'Navigating the block hierarchy', () => {
60
75
 
61
76
  // Tweak the columns count.
62
77
  await openDocumentSettingsSidebar();
78
+ await switchBlockInspectorTab( 'Settings' );
63
79
  await page.focus(
64
80
  '.block-editor-block-inspector [aria-label="Columns"][type="number"]'
65
81
  );
@@ -76,7 +76,7 @@ describe( 'Block Switcher', () => {
76
76
  'core/group',
77
77
  'core/heading',
78
78
  'core/columns',
79
- ].map( ( block ) => wp.blocks.unregisterBlockType( block ) );
79
+ ].forEach( ( block ) => wp.blocks.unregisterBlockType( block ) );
80
80
  } );
81
81
 
82
82
  await page.keyboard.press( 'ArrowUp' );
@@ -318,7 +318,7 @@ describe( 'Inserting blocks', () => {
318
318
  );
319
319
  await browseAll.click();
320
320
  const availableBlocks = await page.$$(
321
- '.block-editor-block-types-list__list-item'
321
+ '.edit-post-editor__inserter-panel .block-editor-block-types-list__list-item'
322
322
  );
323
323
  expect( availableBlocks ).toHaveLength( 1 );
324
324
  } );
@@ -1,5 +0,0 @@
1
- {
2
- "__file": "wp_block",
3
- "title": "Greeting",
4
- "content": "<!-- wp:paragraph -->\n<p>Hello there</p>\n<!-- /wp:paragraph -->"
5
- }
@@ -1,74 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import path from 'path';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { visitAdminPage } from '@wordpress/e2e-test-utils';
10
-
11
- describe( 'Managing reusable blocks', () => {
12
- /**
13
- * Returns a Promise which resolves to the number of post list entries on
14
- * the current page.
15
- *
16
- * @return {Promise} Promise resolving to number of post list entries.
17
- */
18
- async function getNumberOfEntries() {
19
- return page.evaluate(
20
- () => document.querySelectorAll( '.hentry' ).length
21
- );
22
- }
23
-
24
- beforeAll( async () => {
25
- await visitAdminPage( 'edit.php', 'post_type=wp_block' );
26
- } );
27
-
28
- it( 'Should import reusable blocks', async () => {
29
- const originalEntries = await getNumberOfEntries();
30
-
31
- // Import Reusable block.
32
- await page.waitForSelector( '.list-reusable-blocks__container' );
33
- const importButton = await page.$(
34
- '.list-reusable-blocks__container button'
35
- );
36
- await importButton.click();
37
-
38
- // Select the file to upload.
39
- const testReusableBlockFile = path.join(
40
- __dirname,
41
- '..',
42
- '..',
43
- '..',
44
- 'assets',
45
- 'greeting-reusable-block.json'
46
- );
47
- const input = await page.$( '.list-reusable-blocks-import-form input' );
48
- await input.uploadFile( testReusableBlockFile );
49
-
50
- // Submit the form.
51
- const button = await page.$(
52
- '.list-reusable-blocks-import-form__button'
53
- );
54
- await button.click();
55
-
56
- // Wait for the success notice.
57
- await page.waitForSelector( '.notice-success' );
58
- const noticeContent = await page.$eval(
59
- '.notice-success',
60
- ( element ) => element.textContent
61
- );
62
- expect( noticeContent ).toEqual(
63
- 'Reusable block imported successfully!'
64
- );
65
-
66
- // Refresh the page.
67
- await visitAdminPage( 'edit.php', 'post_type=wp_block' );
68
-
69
- const expectedEntries = originalEntries + 1;
70
- const actualEntries = await getNumberOfEntries();
71
-
72
- expect( actualEntries ).toBe( expectedEntries );
73
- } );
74
- } );
@@ -1,133 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- setBrowserViewport,
6
- createNewPost,
7
- openDocumentSettingsSidebar,
8
- } from '@wordpress/e2e-test-utils';
9
-
10
- describe( 'Post visibility', () => {
11
- afterEach( async () => {
12
- await setBrowserViewport( 'large' );
13
- } );
14
- [ 'large', 'small' ].forEach( ( viewport ) => {
15
- it( `can be changed when the viewport is ${ viewport }`, async () => {
16
- await setBrowserViewport( viewport );
17
-
18
- await createNewPost();
19
-
20
- await openDocumentSettingsSidebar();
21
-
22
- await page.click( '*[aria-label^="Select visibility"]' );
23
-
24
- const [ privateLabel ] = await page.$x(
25
- '//label[text()="Private"]'
26
- );
27
- await privateLabel.click();
28
-
29
- await page.waitForXPath(
30
- '//*[text()="Would you like to privately publish this post now?"]'
31
- );
32
-
33
- const [ confirmButton ] = await page.$x(
34
- '//*[@role="dialog"]//button[text()="OK"]'
35
- );
36
- await confirmButton.click();
37
-
38
- const currentStatus = await page.evaluate( () => {
39
- return wp.data
40
- .select( 'core/editor' )
41
- .getEditedPostAttribute( 'status' );
42
- } );
43
-
44
- expect( currentStatus ).toBe( 'private' );
45
- } );
46
-
47
- it( `can be canceled when the viewport is ${ viewport }`, async () => {
48
- await setBrowserViewport( viewport );
49
-
50
- await createNewPost();
51
-
52
- await openDocumentSettingsSidebar();
53
-
54
- const initialStatus = await page.evaluate( () => {
55
- return wp.data
56
- .select( 'core/editor' )
57
- .getEditedPostAttribute( 'status' );
58
- } );
59
-
60
- await page.click( '*[aria-label^="Select visibility"]' );
61
-
62
- const [ privateLabel ] = await page.$x(
63
- '//label[text()="Private"]'
64
- );
65
- await privateLabel.click();
66
- await page.waitForXPath(
67
- '//*[text()="Would you like to privately publish this post now?"]'
68
- );
69
- const cancelButton = await page.waitForXPath(
70
- '//*[@role="dialog"][not(@id="wp-link-wrap")]//button[text()="Cancel"]'
71
- );
72
- await cancelButton.click();
73
-
74
- const currentStatus = await page.evaluate( () => {
75
- return wp.data
76
- .select( 'core/editor' )
77
- .getEditedPostAttribute( 'status' );
78
- } );
79
-
80
- expect( currentStatus ).toBe( initialStatus );
81
- } );
82
- } );
83
-
84
- it( 'visibility remains private even if the publish date is in the future', async () => {
85
- await createNewPost();
86
-
87
- // Enter a title for this post.
88
- await page.type( '.editor-post-title__input', 'Title' );
89
-
90
- await openDocumentSettingsSidebar();
91
-
92
- // Set a publish date for the next month.
93
- await page.click( '*[aria-label^="Change date"]' );
94
- await page.click( '*[aria-label="View next month"]' );
95
- await (
96
- await page.$x(
97
- '//*[@role="application"][@aria-label="Calendar"]//button[text()="15"]'
98
- )
99
- )[ 0 ].click();
100
-
101
- await page.click( '*[aria-label^="Select visibility"]' );
102
-
103
- const [ privateLabel ] = await page.$x( '//label[text()="Private"]' );
104
- await privateLabel.click();
105
-
106
- await page.waitForXPath(
107
- '//*[text()="Would you like to privately publish this post now?"]'
108
- );
109
-
110
- const [ confirmButton ] = await page.$x(
111
- '//*[@role="dialog"]//button[text()="OK"]'
112
- );
113
- await confirmButton.click();
114
-
115
- // Enter a title for this post.
116
- await page.type( '.editor-post-title__input', ' Changed' );
117
-
118
- // Wait for the button to be clickable before attempting to click.
119
- // This could cause errors when we try to click before changes are registered.
120
- await page.waitForSelector(
121
- '.editor-post-publish-button[aria-disabled="false"]'
122
- );
123
- await page.click( '.editor-post-publish-button' );
124
-
125
- const currentStatus = await page.evaluate( () => {
126
- return wp.data
127
- .select( 'core/editor' )
128
- .getEditedPostAttribute( 'status' );
129
- } );
130
-
131
- expect( currentStatus ).toBe( 'private' );
132
- } );
133
- } );