@wordpress/e2e-tests 2.5.8 → 2.5.9

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 (21) hide show
  1. package/jest.config.js +1 -0
  2. package/package.json +2 -2
  3. package/specs/{experiments → editor}/blocks/__snapshots__/navigation.test.js.snap +0 -0
  4. package/specs/{experiments → editor}/blocks/navigation.test.js +0 -0
  5. package/specs/{experiments → editor}/fixtures/menu-items-response-fixture.json +0 -0
  6. package/specs/{experiments → editor/various}/__snapshots__/post-editor-template-mode.test.js.snap +0 -0
  7. package/specs/{misc/settings.test.js → editor/various/core-settings.test.js} +0 -0
  8. package/specs/{experiments → editor/various}/post-editor-template-mode.test.js +0 -0
  9. package/specs/editor/various/writing-flow.test.js +21 -1
  10. package/specs/experiments/experimental-features.js +39 -0
  11. package/specs/experiments/navigation-editor.test.js +1 -1
  12. package/specs/performance/site-editor.test.js +1 -1
  13. package/specs/{experiments → site-editor}/document-settings.test.js +1 -1
  14. package/specs/{experiments → site-editor}/multi-entity-editing.test.js +1 -1
  15. package/specs/{experiments → site-editor}/multi-entity-saving.test.js +1 -1
  16. package/specs/{experiments → site-editor}/settings-sidebar.test.js +1 -1
  17. package/specs/{experiments → site-editor}/site-editor-export.test.js +1 -1
  18. package/specs/{experiments → site-editor}/site-editor-inserter.test.js +1 -1
  19. package/specs/{experiments → site-editor}/template-part.test.js +1 -1
  20. package/specs/{experiments → site-editor}/template-revert.test.js +1 -1
  21. package/{experimental-features.js → specs/site-editor/utils.js} +0 -34
package/jest.config.js CHANGED
@@ -5,6 +5,7 @@ const baseConfig = require( '@wordpress/scripts/config/jest-e2e.config' );
5
5
 
6
6
  module.exports = {
7
7
  ...baseConfig,
8
+ testMatch: [ '<rootDir>/specs/**/*.test.js' ],
8
9
  setupFiles: [ '<rootDir>/config/gutenberg-phase.js' ],
9
10
  setupFilesAfterEnv: [
10
11
  '<rootDir>/config/setup-test-framework.js',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "2.5.8",
3
+ "version": "2.5.9",
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": "6d3bd917064b4b194677233ee426f5988fa441b9"
46
+ "gitHead": "49c7be0ff5dc493fc9e5a861e18273dd1f3fce8c"
47
47
  }
@@ -13,7 +13,7 @@ import {
13
13
 
14
14
  const getActiveBlockName = async () =>
15
15
  page.evaluate(
16
- () => wp.data.select( 'core/block-editor' ).getSelectedBlock().name
16
+ () => wp.data.select( 'core/block-editor' ).getSelectedBlock()?.name
17
17
  );
18
18
 
19
19
  const addParagraphsAndColumnsDemo = async () => {
@@ -626,4 +626,24 @@ describe( 'Writing Flow', () => {
626
626
  )
627
627
  ).toBe( 'Table' );
628
628
  } );
629
+
630
+ it( 'Should unselect all blocks when hitting double escape', async () => {
631
+ // Add demo content.
632
+ await page.keyboard.press( 'Enter' );
633
+ await page.keyboard.type( 'Random Paragraph' );
634
+
635
+ // Select a block.
636
+ let activeBlockName = await getActiveBlockName();
637
+ expect( activeBlockName ).toBe( 'core/paragraph' );
638
+
639
+ // First escape enters navigaiton mode.
640
+ await page.keyboard.press( 'Escape' );
641
+ activeBlockName = await getActiveBlockName();
642
+ expect( activeBlockName ).toBe( 'core/paragraph' );
643
+
644
+ // Second escape unselects the blocks.
645
+ await page.keyboard.press( 'Escape' );
646
+ activeBlockName = await getActiveBlockName();
647
+ expect( activeBlockName ).toBe( undefined );
648
+ } );
629
649
  } );
@@ -0,0 +1,39 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { addQueryArgs } from '@wordpress/url';
5
+ import { visitAdminPage } from '@wordpress/e2e-test-utils';
6
+
7
+ async function setExperimentalFeaturesState( features, enable ) {
8
+ const query = addQueryArgs( '', {
9
+ page: 'gutenberg-experiments',
10
+ } );
11
+ await visitAdminPage( '/admin.php', query );
12
+
13
+ await Promise.all(
14
+ features.map( async ( feature ) => {
15
+ await page.waitForSelector( feature );
16
+ const checkedSelector = `${ feature }[checked=checked]`;
17
+ const isChecked = !! ( await page.$( checkedSelector ) );
18
+ if ( ( ! isChecked && enable ) || ( isChecked && ! enable ) ) {
19
+ await page.click( feature );
20
+ }
21
+ } )
22
+ );
23
+ await Promise.all( [
24
+ page.waitForNavigation( { waitUntil: 'networkidle0' } ),
25
+ page.click( '#submit' ),
26
+ ] );
27
+ }
28
+
29
+ /**
30
+ * Establishes test lifecycle to enable experimental feature for the duration of
31
+ * the grouped test block.
32
+ *
33
+ * @param {Array} features Array of {string} selectors of settings to enable.
34
+ * Assumes they can be enabled with one click.
35
+ */
36
+ export function useExperimentalFeatures( features ) {
37
+ beforeAll( () => setExperimentalFeaturesState( features, true ) );
38
+ afterAll( () => setExperimentalFeaturesState( features, false ) );
39
+ }
@@ -22,7 +22,7 @@ import { addQueryArgs } from '@wordpress/url';
22
22
  /**
23
23
  * Internal dependencies
24
24
  */
25
- import { useExperimentalFeatures } from '../../experimental-features';
25
+ import { useExperimentalFeatures } from './experimental-features';
26
26
  import menuItemsFixture from './fixtures/menu-items-request-fixture.json';
27
27
 
28
28
  const TYPE_NAMES = {
@@ -19,7 +19,7 @@ import {
19
19
  /**
20
20
  * Internal dependencies
21
21
  */
22
- import { siteEditor } from '../../experimental-features';
22
+ import { siteEditor } from '../site-editor/utils';
23
23
  import {
24
24
  readFile,
25
25
  deleteFile,
@@ -6,7 +6,7 @@ import { trashAllPosts, activateTheme } from '@wordpress/e2e-test-utils';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import { siteEditor } from '../../experimental-features';
9
+ import { siteEditor } from './utils';
10
10
 
11
11
  async function getDocumentSettingsTitle() {
12
12
  const titleElement = await page.waitForSelector(
@@ -16,7 +16,7 @@ import {
16
16
  /**
17
17
  * Internal dependencies
18
18
  */
19
- import { navigationPanel, siteEditor } from '../../experimental-features';
19
+ import { navigationPanel, siteEditor } from './utils';
20
20
 
21
21
  const clickTemplateItem = async ( menus, itemName ) => {
22
22
  await navigationPanel.open();
@@ -14,7 +14,7 @@ import {
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
- import { siteEditor } from '../../experimental-features';
17
+ import { siteEditor } from './utils';
18
18
 
19
19
  describe( 'Multi-entity save flow', () => {
20
20
  // Selectors - usable between Post/Site editors.
@@ -12,7 +12,7 @@ import {
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
- import { siteEditor } from '../../experimental-features';
15
+ import { siteEditor } from './utils';
16
16
 
17
17
  async function toggleSidebar() {
18
18
  await page.click(
@@ -13,7 +13,7 @@ import { trashAllPosts, activateTheme } from '@wordpress/e2e-test-utils';
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
- import { siteEditor } from '../../experimental-features';
16
+ import { siteEditor } from './utils';
17
17
 
18
18
  async function waitForFileExists( filePath, timeout = 10000 ) {
19
19
  const start = Date.now();
@@ -6,7 +6,7 @@ import { trashAllPosts, activateTheme } from '@wordpress/e2e-test-utils';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import { siteEditor } from '../../experimental-features';
9
+ import { siteEditor } from './utils';
10
10
 
11
11
  describe( 'Site Editor Inserter', () => {
12
12
  beforeAll( async () => {
@@ -16,7 +16,7 @@ import {
16
16
  /**
17
17
  * Internal dependencies
18
18
  */
19
- import { siteEditor } from '../../experimental-features';
19
+ import { siteEditor } from './utils';
20
20
 
21
21
  const templatePartNameInput =
22
22
  '.edit-site-create-template-part-modal .components-text-control__input';
@@ -14,7 +14,7 @@ import { addQueryArgs } from '@wordpress/url';
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
- import { siteEditor } from '../../experimental-features';
17
+ import { siteEditor } from './utils';
18
18
 
19
19
  const {
20
20
  visit: visitSiteEditor,
@@ -4,40 +4,6 @@
4
4
  import { addQueryArgs } from '@wordpress/url';
5
5
  import { visitAdminPage } from '@wordpress/e2e-test-utils';
6
6
 
7
- async function setExperimentalFeaturesState( features, enable ) {
8
- const query = addQueryArgs( '', {
9
- page: 'gutenberg-experiments',
10
- } );
11
- await visitAdminPage( '/admin.php', query );
12
-
13
- await Promise.all(
14
- features.map( async ( feature ) => {
15
- await page.waitForSelector( feature );
16
- const checkedSelector = `${ feature }[checked=checked]`;
17
- const isChecked = !! ( await page.$( checkedSelector ) );
18
- if ( ( ! isChecked && enable ) || ( isChecked && ! enable ) ) {
19
- await page.click( feature );
20
- }
21
- } )
22
- );
23
- await Promise.all( [
24
- page.waitForNavigation( { waitUntil: 'networkidle0' } ),
25
- page.click( '#submit' ),
26
- ] );
27
- }
28
-
29
- /**
30
- * Establishes test lifecycle to enable experimental feature for the duration of
31
- * the grouped test block.
32
- *
33
- * @param {Array} features Array of {string} selectors of settings to enable.
34
- * Assumes they can be enabled with one click.
35
- */
36
- export function useExperimentalFeatures( features ) {
37
- beforeAll( () => setExperimentalFeaturesState( features, true ) );
38
- afterAll( () => setExperimentalFeaturesState( features, false ) );
39
- }
40
-
41
7
  export const navigationPanel = {
42
8
  async open() {
43
9
  const isOpen = !! ( await page.$(