@wordpress/e2e-tests 2.5.0 → 2.5.1
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/README.md +2 -2
- package/config/flaky-tests-reporter.js +94 -0
- package/config/setup-test-framework.js +7 -0
- package/jest.config.js +11 -1
- package/package.json +6 -5
- package/plugins/iframed-block/block.json +16 -0
- package/plugins/iframed-block/editor.css +6 -0
- package/plugins/iframed-block/editor.js +18 -0
- package/plugins/iframed-block/jquery.test.js +7 -0
- package/plugins/iframed-block/script.js +7 -0
- package/plugins/iframed-block/style.css +9 -0
- package/plugins/iframed-block.php +46 -0
- package/specs/editor/plugins/__snapshots__/iframed-block.test.js.snap +7 -0
- package/specs/editor/plugins/align-hook.test.js +116 -105
- package/specs/editor/plugins/iframed-block.test.js +58 -0
- package/specs/editor/various/__snapshots__/copy-cut-paste-whole-blocks.test.js.snap +28 -0
- package/specs/editor/various/__snapshots__/rich-text.test.js.snap +15 -3
- package/specs/editor/various/block-grouping.test.js +2 -2
- package/specs/editor/various/copy-cut-paste-whole-blocks.test.js +92 -0
- package/specs/editor/various/embedding.test.js +1 -1
- package/specs/editor/various/inserting-blocks.test.js +23 -0
- package/specs/editor/various/rich-text.test.js +29 -1
- package/specs/editor/various/writing-flow.test.js +4 -2
- package/specs/experiments/__snapshots__/navigation-editor.test.js.snap +27 -33
- package/specs/experiments/blocks/__snapshots__/navigation.test.js.snap +29 -19
- package/specs/experiments/blocks/navigation.test.js +93 -17
- package/specs/experiments/fixtures/menu-items-request-fixture.json +84 -0
- package/specs/experiments/navigation-editor.test.js +332 -233
- package/specs/experiments/template-revert.test.js +1 -1
- package/specs/performance/site-editor.test.js +2 -17
- package/specs/widgets/customizing-widgets.test.js +94 -1
- package/specs/widgets/editing-widgets.test.js +6 -0
@@ -67,7 +67,7 @@ const save = async () => {
|
|
67
67
|
|
68
68
|
const revertTemplate = async () => {
|
69
69
|
await page.click( '.edit-site-document-actions__get-info' );
|
70
|
-
await page.click( '.edit-site-template-details__revert
|
70
|
+
await page.click( '.edit-site-template-details__revert-button' );
|
71
71
|
await waitForNotice();
|
72
72
|
await assertSaveButtonIsEnabled();
|
73
73
|
};
|
@@ -114,24 +114,9 @@ describe( 'Site Editor Performance', () => {
|
|
114
114
|
keyUpEvents,
|
115
115
|
] = getTypingEventDurations( traceResults );
|
116
116
|
|
117
|
-
|
118
|
-
// main frame, which must be ignored. These will be the odd values in
|
119
|
-
// the array.
|
120
|
-
const _keyDownEvents = keyDownEvents.filter(
|
121
|
-
( v, ii ) => ii % 2 === 0
|
122
|
-
);
|
123
|
-
const _keyPressEvents = keyPressEvents.filter(
|
124
|
-
( v, ii ) => ii % 2 === 0
|
125
|
-
);
|
126
|
-
|
127
|
-
expect(
|
128
|
-
_keyDownEvents.length === _keyPressEvents.length &&
|
129
|
-
_keyPressEvents.length === keyUpEvents.length
|
130
|
-
).toBe( true );
|
131
|
-
|
132
|
-
for ( let j = 0; j < _keyDownEvents.length; j++ ) {
|
117
|
+
for ( let j = 0; j < keyDownEvents.length; j++ ) {
|
133
118
|
results.type.push(
|
134
|
-
|
119
|
+
keyDownEvents[ j ] + keyPressEvents[ j ] + keyUpEvents[ j ]
|
135
120
|
);
|
136
121
|
}
|
137
122
|
|
@@ -16,7 +16,8 @@ import {
|
|
16
16
|
* External dependencies
|
17
17
|
*/
|
18
18
|
// eslint-disable-next-line no-restricted-imports
|
19
|
-
import { find } from 'puppeteer-testing-library';
|
19
|
+
import { find, findAll } from 'puppeteer-testing-library';
|
20
|
+
import { first } from 'lodash';
|
20
21
|
|
21
22
|
const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
|
22
23
|
For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
|
@@ -763,6 +764,98 @@ describe( 'Widgets Customizer', () => {
|
|
763
764
|
|
764
765
|
expect( console ).toHaveErrored( twentyTwentyError );
|
765
766
|
} );
|
767
|
+
|
768
|
+
it( 'should not render Block Settings sections', async () => {
|
769
|
+
// We add Block Settings as a section, but it shouldn't display to
|
770
|
+
// the user as a section on the main menu. It's simply how we
|
771
|
+
// integrate the G sidebar inside the customizer.
|
772
|
+
const findAllBlockSettingsHeader = findAll(
|
773
|
+
{
|
774
|
+
role: 'heading',
|
775
|
+
name: /Block Settings/,
|
776
|
+
level: 3,
|
777
|
+
},
|
778
|
+
{ timeout: 0 }
|
779
|
+
);
|
780
|
+
await expect( findAllBlockSettingsHeader ).toThrowQueryEmptyError();
|
781
|
+
} );
|
782
|
+
|
783
|
+
it( 'should stay in block settings after making a change in that area', async () => {
|
784
|
+
// Open footer block widgets
|
785
|
+
const widgetsPanel = await find( {
|
786
|
+
role: 'heading',
|
787
|
+
name: /Widgets/,
|
788
|
+
level: 3,
|
789
|
+
} );
|
790
|
+
await widgetsPanel.click();
|
791
|
+
|
792
|
+
const footer1Section = await find( {
|
793
|
+
role: 'heading',
|
794
|
+
name: /^Footer #1/,
|
795
|
+
level: 3,
|
796
|
+
} );
|
797
|
+
await footer1Section.click();
|
798
|
+
|
799
|
+
// Add a block to make the publish button active.
|
800
|
+
await addBlock( 'Paragraph' );
|
801
|
+
await page.keyboard.type( 'First Paragraph' );
|
802
|
+
|
803
|
+
await waitForPreviewIframe();
|
804
|
+
|
805
|
+
// Click Publish
|
806
|
+
const publishButton = await find( {
|
807
|
+
role: 'button',
|
808
|
+
name: 'Publish',
|
809
|
+
} );
|
810
|
+
await publishButton.click();
|
811
|
+
|
812
|
+
// Wait for publishing to finish.
|
813
|
+
await page.waitForResponse( createURL( '/wp-admin/admin-ajax.php' ) );
|
814
|
+
await expect( publishButton ).toMatchQuery( {
|
815
|
+
disabled: true,
|
816
|
+
} );
|
817
|
+
|
818
|
+
// Select the paragraph block
|
819
|
+
const paragraphBlock = await find( {
|
820
|
+
role: 'document',
|
821
|
+
name: 'Paragraph block',
|
822
|
+
} );
|
823
|
+
await paragraphBlock.focus();
|
824
|
+
|
825
|
+
// Click the three dots button, then click "Show More Settings".
|
826
|
+
await showBlockToolbar();
|
827
|
+
await clickBlockToolbarButton( 'Options' );
|
828
|
+
const showMoreSettingsButton = await find( {
|
829
|
+
role: 'menuitem',
|
830
|
+
name: 'Show more settings',
|
831
|
+
} );
|
832
|
+
await showMoreSettingsButton.click();
|
833
|
+
|
834
|
+
// Change font size (Any change made in this section is sufficient; not required to be font size)
|
835
|
+
const CUSTOM_FONT_SIZE_LABEL_SELECTOR =
|
836
|
+
"//fieldset[legend[contains(text(),'Font size')]]//label[contains(text(), 'Custom')]";
|
837
|
+
await first( await page.$x( CUSTOM_FONT_SIZE_LABEL_SELECTOR ) ).click();
|
838
|
+
await page.keyboard.type( '23' );
|
839
|
+
await page.keyboard.press( 'Enter' );
|
840
|
+
|
841
|
+
// Now that we've made a change:
|
842
|
+
// (1) Publish button should be active
|
843
|
+
// (2) We should still be in the "Block Settings" area
|
844
|
+
await find( {
|
845
|
+
role: 'button',
|
846
|
+
name: 'Publish',
|
847
|
+
} );
|
848
|
+
|
849
|
+
// This fails on 539cea09 and earlier; we get kicked back to the widgets area.
|
850
|
+
// We expect to stay in block settings.
|
851
|
+
await find( {
|
852
|
+
role: 'heading',
|
853
|
+
name: 'Customizing ▸ Widgets ▸ Footer #1 Block Settings',
|
854
|
+
level: 3,
|
855
|
+
} );
|
856
|
+
|
857
|
+
expect( console ).toHaveErrored( twentyTwentyError );
|
858
|
+
} );
|
766
859
|
} );
|
767
860
|
|
768
861
|
/**
|
@@ -822,6 +822,8 @@ describe( 'Widgets screen', () => {
|
|
822
822
|
// Delete the last block and save again.
|
823
823
|
await pressKeyWithModifier( 'access', 'z' );
|
824
824
|
await saveWidgets();
|
825
|
+
// To do: clicking on the Snackbar causes focus loss.
|
826
|
+
await page.focus( '.block-editor-writing-flow' );
|
825
827
|
|
826
828
|
// Undo block deletion and save again
|
827
829
|
await pressKeyWithModifier( 'primary', 'z' );
|
@@ -889,6 +891,10 @@ async function saveWidgets() {
|
|
889
891
|
// Close the snackbar.
|
890
892
|
const savedSnackbar = await find( savedSnackbarQuery );
|
891
893
|
await savedSnackbar.click();
|
894
|
+
// Expect focus not to be lost.
|
895
|
+
await expect(
|
896
|
+
await page.evaluate( () => document.activeElement.className )
|
897
|
+
).toBe( 'components-snackbar-list edit-widgets-notices__snackbar' );
|
892
898
|
await expect( savedSnackbarQuery ).not.toBeFound();
|
893
899
|
}
|
894
900
|
|