@wordpress/e2e-tests 2.5.12 → 2.5.16
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/package.json +3 -3
- package/specs/editor/blocks/navigation.test.js +186 -75
- package/specs/editor/plugins/iframed-inline-styles.test.js +0 -6
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +0 -4
- package/specs/site-editor/multi-entity-saving.test.js +17 -5
- package/specs/site-editor/template-part.test.js +2 -1
- package/specs/widgets/customizing-widgets.test.js +0 -20
- package/specs/widgets/editing-widgets.test.js +36 -12
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "2.5.
|
3
|
+
"version": "2.5.16",
|
4
4
|
"description": "End-To-End (E2E) tests for WordPress.",
|
5
5
|
"author": "The WordPress Contributors",
|
6
6
|
"license": "GPL-2.0-or-later",
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"@wordpress/e2e-test-utils": "^5.4.10",
|
27
27
|
"@wordpress/jest-console": "^4.1.1",
|
28
28
|
"@wordpress/jest-puppeteer-axe": "^3.1.1",
|
29
|
-
"@wordpress/scripts": "^19.2.
|
29
|
+
"@wordpress/scripts": "^19.2.4",
|
30
30
|
"@wordpress/url": "^3.3.1",
|
31
31
|
"chalk": "^4.0.0",
|
32
32
|
"expect-puppeteer": "^4.4.0",
|
@@ -43,5 +43,5 @@
|
|
43
43
|
"publishConfig": {
|
44
44
|
"access": "public"
|
45
45
|
},
|
46
|
-
"gitHead": "
|
46
|
+
"gitHead": "8c2cd6a5fd8781266da858a2e7d1bdd9a3a279e4"
|
47
47
|
}
|
@@ -2,6 +2,8 @@
|
|
2
2
|
* WordPress dependencies
|
3
3
|
*/
|
4
4
|
import {
|
5
|
+
clickButton,
|
6
|
+
clickOnMoreMenuItem,
|
5
7
|
createJSONResponse,
|
6
8
|
createNewPost,
|
7
9
|
getEditedPostContent,
|
@@ -187,7 +189,10 @@ async function updateActiveNavigationLink( { url, label, type } ) {
|
|
187
189
|
};
|
188
190
|
|
189
191
|
if ( url ) {
|
190
|
-
await page.
|
192
|
+
const input = await page.waitForSelector(
|
193
|
+
'input[placeholder="Search or type url"]'
|
194
|
+
);
|
195
|
+
await input.type( url );
|
191
196
|
|
192
197
|
const suggestionPath = `//button[contains(@class, 'block-editor-link-control__search-item') and contains(@class, '${ typeClasses[ type ] }')]/span/span[@class='block-editor-link-control__search-item-title']/mark[text()="${ url }"]`;
|
193
198
|
|
@@ -235,6 +240,7 @@ const PLACEHOLDER_ACTIONS_CLASS = 'wp-block-navigation-placeholder__actions';
|
|
235
240
|
const PLACEHOLDER_ACTIONS_XPATH = `//*[contains(@class, '${ PLACEHOLDER_ACTIONS_CLASS }')]`;
|
236
241
|
const START_EMPTY_XPATH = `${ PLACEHOLDER_ACTIONS_XPATH }//button[text()='Start empty']`;
|
237
242
|
const ADD_ALL_PAGES_XPATH = `${ PLACEHOLDER_ACTIONS_XPATH }//button[text()='Add all pages']`;
|
243
|
+
const SELECT_MENU_XPATH = `${ PLACEHOLDER_ACTIONS_XPATH }//button[text()='Select menu']`;
|
238
244
|
|
239
245
|
async function createNavBlockWithAllPages() {
|
240
246
|
const allPagesButton = await page.waitForXPath( ADD_ALL_PAGES_XPATH );
|
@@ -675,6 +681,151 @@ describe.skip( 'Navigation', () => {
|
|
675
681
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
676
682
|
} );
|
677
683
|
|
684
|
+
it( 'supports navigation blocks that have inner blocks within their markup and converts them to wp_navigation posts', async () => {
|
685
|
+
// Insert 'old-school' inner blocks via the code editor.
|
686
|
+
await createNewPost();
|
687
|
+
await clickOnMoreMenuItem( 'Code editor' );
|
688
|
+
const codeEditorInput = await page.waitForSelector(
|
689
|
+
'.editor-post-text-editor'
|
690
|
+
);
|
691
|
+
await codeEditorInput.click();
|
692
|
+
const markup =
|
693
|
+
'<!-- wp:navigation --><!-- wp:page-list /--><!-- /wp:navigation -->';
|
694
|
+
await page.keyboard.type( markup );
|
695
|
+
await clickButton( 'Exit code editor' );
|
696
|
+
const navBlock = await page.waitForSelector(
|
697
|
+
'nav[aria-label="Block: Navigation"]'
|
698
|
+
);
|
699
|
+
// Select the block to convert to a wp_navigation and publish.
|
700
|
+
// The select menu button shows up when saving is complete.
|
701
|
+
await navBlock.click();
|
702
|
+
await page.waitForSelector( 'button[aria-label="Select Menu"]' );
|
703
|
+
// await publishPost();
|
704
|
+
|
705
|
+
// Check that the wp_navigation post has the page list block.
|
706
|
+
// expect( await getNavigationMenuRawContent() ).toMatchSnapshot();
|
707
|
+
} );
|
708
|
+
|
709
|
+
describe( 'Creating and restarting', () => {
|
710
|
+
const NAV_ENTITY_SELECTOR =
|
711
|
+
'//div[@class="entities-saved-states__panel"]//label//strong[contains(text(), "Navigation")]';
|
712
|
+
|
713
|
+
async function populateNavWithOneItem() {
|
714
|
+
// Add a Link block first.
|
715
|
+
const appender = await page.waitForSelector(
|
716
|
+
'.wp-block-navigation .block-list-appender'
|
717
|
+
);
|
718
|
+
await appender.click();
|
719
|
+
// Add a link to the Link block.
|
720
|
+
await updateActiveNavigationLink( {
|
721
|
+
url: 'https://wordpress.org',
|
722
|
+
label: 'WP',
|
723
|
+
type: 'url',
|
724
|
+
} );
|
725
|
+
}
|
726
|
+
|
727
|
+
async function resetNavBlockToInitialState() {
|
728
|
+
const selectMenuDropdown = await page.waitForSelector(
|
729
|
+
'[aria-label="Select Menu"]'
|
730
|
+
);
|
731
|
+
await selectMenuDropdown.click();
|
732
|
+
const newMenuButton = await page.waitForXPath(
|
733
|
+
'//span[text()="Create new menu"]'
|
734
|
+
);
|
735
|
+
newMenuButton.click();
|
736
|
+
}
|
737
|
+
|
738
|
+
it( 'does not retain uncontrolled inner blocks when creating a new entity', async () => {
|
739
|
+
await createNewPost();
|
740
|
+
await clickOnMoreMenuItem( 'Code editor' );
|
741
|
+
const codeEditorInput = await page.waitForSelector(
|
742
|
+
'.editor-post-text-editor'
|
743
|
+
);
|
744
|
+
await codeEditorInput.click();
|
745
|
+
const markup =
|
746
|
+
'<!-- wp:navigation --><!-- wp:page-list /--><!-- /wp:navigation -->';
|
747
|
+
await page.keyboard.type( markup );
|
748
|
+
await clickButton( 'Exit code editor' );
|
749
|
+
const navBlock = await page.waitForSelector(
|
750
|
+
'nav[aria-label="Block: Navigation"]'
|
751
|
+
);
|
752
|
+
|
753
|
+
// Select the block to convert to a wp_navigation and publish.
|
754
|
+
// The select menu button shows up when saving is complete.
|
755
|
+
await navBlock.click();
|
756
|
+
await page.waitForSelector( 'button[aria-label="Select Menu"]' );
|
757
|
+
|
758
|
+
// Reset the nav block to create a new entity.
|
759
|
+
await resetNavBlockToInitialState();
|
760
|
+
const startEmptyButton = await page.waitForXPath(
|
761
|
+
START_EMPTY_XPATH
|
762
|
+
);
|
763
|
+
await startEmptyButton.click();
|
764
|
+
await populateNavWithOneItem();
|
765
|
+
|
766
|
+
// Confirm that only the last menu entity was updated.
|
767
|
+
const publishPanelButton2 = await page.waitForSelector(
|
768
|
+
'.editor-post-publish-button__button:not([aria-disabled="true"])'
|
769
|
+
);
|
770
|
+
await publishPanelButton2.click();
|
771
|
+
|
772
|
+
await page.waitForXPath( NAV_ENTITY_SELECTOR );
|
773
|
+
expect( await page.$x( NAV_ENTITY_SELECTOR ) ).toHaveLength( 1 );
|
774
|
+
} );
|
775
|
+
|
776
|
+
it( 'only update a single entity currently linked with the block', async () => {
|
777
|
+
await createNewPost();
|
778
|
+
await insertBlock( 'Navigation' );
|
779
|
+
|
780
|
+
const startEmptyButton = await page.waitForXPath(
|
781
|
+
START_EMPTY_XPATH
|
782
|
+
);
|
783
|
+
await startEmptyButton.click();
|
784
|
+
await populateNavWithOneItem();
|
785
|
+
|
786
|
+
// Confirm that the menu entity was updated.
|
787
|
+
const publishPanelButton = await page.waitForSelector(
|
788
|
+
'.editor-post-publish-panel__toggle:not([aria-disabled="true"])'
|
789
|
+
);
|
790
|
+
await publishPanelButton.click();
|
791
|
+
|
792
|
+
await page.waitForXPath( NAV_ENTITY_SELECTOR );
|
793
|
+
expect( await page.$x( NAV_ENTITY_SELECTOR ) ).toHaveLength( 1 );
|
794
|
+
|
795
|
+
// Publish the post
|
796
|
+
const entitySaveButton = await page.waitForSelector(
|
797
|
+
'.editor-entities-saved-states__save-button'
|
798
|
+
);
|
799
|
+
await entitySaveButton.click();
|
800
|
+
const publishButton = await page.waitForSelector(
|
801
|
+
'.editor-post-publish-button:not([aria-disabled="true"])'
|
802
|
+
);
|
803
|
+
await publishButton.click();
|
804
|
+
|
805
|
+
// A success notice should show up.
|
806
|
+
await page.waitForSelector( '.components-snackbar' );
|
807
|
+
|
808
|
+
// Now try inserting another Link block via the quick inserter.
|
809
|
+
await page.click( 'nav[aria-label="Block: Navigation"]' );
|
810
|
+
|
811
|
+
await resetNavBlockToInitialState();
|
812
|
+
const startEmptyButton2 = await page.waitForXPath(
|
813
|
+
START_EMPTY_XPATH
|
814
|
+
);
|
815
|
+
await startEmptyButton2.click();
|
816
|
+
await populateNavWithOneItem();
|
817
|
+
|
818
|
+
// Confirm that only the last menu entity was updated.
|
819
|
+
const publishPanelButton2 = await page.waitForSelector(
|
820
|
+
'.editor-post-publish-button__button:not([aria-disabled="true"])'
|
821
|
+
);
|
822
|
+
await publishPanelButton2.click();
|
823
|
+
|
824
|
+
await page.waitForXPath( NAV_ENTITY_SELECTOR );
|
825
|
+
expect( await page.$x( NAV_ENTITY_SELECTOR ) ).toHaveLength( 1 );
|
826
|
+
} );
|
827
|
+
} );
|
828
|
+
|
678
829
|
// The following tests are unstable, roughly around when https://github.com/WordPress/wordpress-develop/pull/1412
|
679
830
|
// landed. The block manually tests well, so let's skip to unblock other PRs and immediately follow up. cc @vcanales
|
680
831
|
it.skip( 'loads frontend code only if the block is present', async () => {
|
@@ -785,91 +936,51 @@ describe.skip( 'Navigation', () => {
|
|
785
936
|
expect( isScriptLoaded ).toBe( true );
|
786
937
|
} );
|
787
938
|
|
788
|
-
describe( '
|
789
|
-
async
|
790
|
-
|
791
|
-
await page.waitForSelector(
|
792
|
-
'.wp-block-navigation .block-list-appender'
|
793
|
-
);
|
794
|
-
await page.click( '.wp-block-navigation .block-list-appender' );
|
795
|
-
// Add a link to the Link block.
|
796
|
-
await updateActiveNavigationLink( {
|
797
|
-
url: 'https://wordpress.org',
|
798
|
-
label: 'WP',
|
799
|
-
type: 'url',
|
800
|
-
} );
|
801
|
-
}
|
802
|
-
|
803
|
-
async function resetNavBlockToInitialState() {
|
804
|
-
await page.waitForSelector( '[aria-label="Select Menu"]' );
|
805
|
-
await page.click( '[aria-label="Select Menu"]' );
|
806
|
-
|
807
|
-
await page.waitForXPath( '//span[text()="Create new menu"]' );
|
808
|
-
const newMenuButton = await page.$x(
|
809
|
-
'//span[text()="Create new menu"]'
|
810
|
-
);
|
811
|
-
newMenuButton[ 0 ].click();
|
812
|
-
}
|
813
|
-
|
814
|
-
it( 'only update a single entity currently linked with the block', async () => {
|
815
|
-
// Mock the response from the Pages endpoint. This is done so that the pages returned are always
|
816
|
-
// consistent and to test the feature more rigorously than the single default sample page.
|
817
|
-
await mockPagesResponse( [
|
818
|
-
{
|
819
|
-
title: 'Home',
|
820
|
-
slug: 'home',
|
821
|
-
},
|
822
|
-
{
|
823
|
-
title: 'About',
|
824
|
-
slug: 'about',
|
825
|
-
},
|
826
|
-
{
|
827
|
-
title: 'Contact Us',
|
828
|
-
slug: 'contact',
|
829
|
-
},
|
830
|
-
] );
|
831
|
-
|
832
|
-
// Add the navigation block.
|
939
|
+
describe( 'Permission based restrictions', () => {
|
940
|
+
it( 'shows a warning if user does not have permission to edit or update navigation menus', async () => {
|
941
|
+
await createNewPost();
|
833
942
|
await insertBlock( 'Navigation' );
|
834
943
|
|
835
|
-
|
836
|
-
|
837
|
-
await populateNavWithOneItem();
|
838
|
-
|
839
|
-
// Let's confirm that the menu entity was updated.
|
840
|
-
await page.waitForSelector(
|
841
|
-
'.editor-post-publish-panel__toggle:not([aria-disabled="true"])'
|
944
|
+
const startEmptyButton = await page.waitForXPath(
|
945
|
+
START_EMPTY_XPATH
|
842
946
|
);
|
843
|
-
await page.click( '.editor-post-publish-panel__toggle' );
|
844
947
|
|
845
|
-
|
846
|
-
|
847
|
-
await page.waitForXPath( NAV_ENTITY_SELECTOR );
|
848
|
-
expect( await page.$x( NAV_ENTITY_SELECTOR ) ).toHaveLength( 1 );
|
948
|
+
// This creates an empty Navigation post type entity.
|
949
|
+
await startEmptyButton.click();
|
849
950
|
|
850
|
-
//
|
851
|
-
|
852
|
-
await
|
853
|
-
await page.click( '.editor-post-publish-button' );
|
951
|
+
// Publishing the Post ensures the Navigation entity is saved.
|
952
|
+
// The Post itself is irrelevant.
|
953
|
+
// await publishPost();
|
854
954
|
|
855
|
-
//
|
856
|
-
|
955
|
+
// Switch to a Contributor role user - they should not have
|
956
|
+
// permission to update Navigations.
|
957
|
+
// await loginUser( username, contribUserPassword );
|
857
958
|
|
858
|
-
|
859
|
-
await page.focus( '.wp-block-navigation' );
|
959
|
+
await createNewPost();
|
860
960
|
|
861
|
-
await
|
862
|
-
await createEmptyNavBlock();
|
863
|
-
await populateNavWithOneItem();
|
961
|
+
await insertBlock( 'Navigation' );
|
864
962
|
|
865
|
-
//
|
866
|
-
|
867
|
-
|
963
|
+
// Select the Navigation post created by the Admin early
|
964
|
+
// in the test.
|
965
|
+
const navigationPostCreatedByAdminName = 'Navigation';
|
966
|
+
const dropdown = await page.waitForXPath( SELECT_MENU_XPATH );
|
967
|
+
await dropdown.click();
|
968
|
+
const theOption = await page.waitForXPath(
|
969
|
+
`//*[contains(@class, 'components-menu-item__item')][ text()="${ navigationPostCreatedByAdminName }" ]`
|
868
970
|
);
|
869
|
-
await
|
971
|
+
await theOption.click();
|
870
972
|
|
871
|
-
|
872
|
-
|
973
|
+
// Make sure the snackbar error shows up
|
974
|
+
await page.waitForXPath(
|
975
|
+
`//*[contains(@class, 'components-snackbar__content')][ text()="You do not have permission to edit this Menu. Any changes made will not be saved." ]`
|
976
|
+
);
|
977
|
+
|
978
|
+
// Expect a console 403 for request to Navigation Areas for lower permisison users.
|
979
|
+
// This is because reading requires the `edit_theme_options` capability
|
980
|
+
// which the Contributor level user does not have.
|
981
|
+
// See: https://github.com/WordPress/gutenberg/blob/4cedaf0c4abb0aeac4bfd4289d63e9889efe9733/lib/class-wp-rest-block-navigation-areas-controller.php#L81-L91.
|
982
|
+
// Todo: removed once Nav Areas are removed from the Gutenberg Plugin.
|
983
|
+
expect( console ).toHaveErrored();
|
873
984
|
} );
|
874
985
|
} );
|
875
986
|
} );
|
@@ -57,11 +57,5 @@ describe( 'iframed inline styles', () => {
|
|
57
57
|
expect( await getComputedStyle( canvas(), 'border-width' ) ).toBe(
|
58
58
|
'2px'
|
59
59
|
);
|
60
|
-
|
61
|
-
expect( console ).toHaveWarned(
|
62
|
-
`Stylesheet iframed-inline-styles-compat-style-css was not properly added.
|
63
|
-
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).
|
64
|
-
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles). <link rel="stylesheet" id="iframed-inline-styles-compat-style-css" href="http://localhost:8889/wp-content/plugins/gutenberg-test-plugins/iframed-inline-styles/compat-style.css?ver=1626189899" media="all">`
|
65
|
-
);
|
66
60
|
} );
|
67
61
|
} );
|
@@ -63,9 +63,5 @@ describe( 'iframed multiple block stylesheets', () => {
|
|
63
63
|
expect( await getComputedStyle( canvas(), 'background-color' ) ).toBe(
|
64
64
|
'rgb(0, 0, 0)'
|
65
65
|
);
|
66
|
-
|
67
|
-
// Skip warnings related to block-styles enqueing and the use of add_editor_style.
|
68
|
-
// The issue is tracked on https://github.com/WordPress/gutenberg/issues/33212.
|
69
|
-
expect( console ).toHaveWarned();
|
70
66
|
} );
|
71
67
|
} );
|
@@ -25,7 +25,7 @@ describe( 'Multi-entity save flow', () => {
|
|
25
25
|
const activatedTemplatePartSelector = `${ templatePartSelector }.block-editor-block-list__layout`;
|
26
26
|
const savePanelSelector = '.entities-saved-states__panel';
|
27
27
|
const closePanelButtonSelector =
|
28
|
-
'.editor-post-publish-panel__header-cancel-button button';
|
28
|
+
'.editor-post-publish-panel__header-cancel-button button:not(:disabled)';
|
29
29
|
const createNewButtonSelector =
|
30
30
|
'//button[contains(text(), "New template part")]';
|
31
31
|
|
@@ -84,8 +84,8 @@ describe( 'Multi-entity save flow', () => {
|
|
84
84
|
expect( multiSaveButton ).toBeNull();
|
85
85
|
};
|
86
86
|
|
87
|
-
|
88
|
-
|
87
|
+
// Template parts can't be used in posts, so this test needs to be rebuilt using perhaps reusable blocks.
|
88
|
+
it.skip( 'Save flow should work as expected.', async () => {
|
89
89
|
// Edit the page some.
|
90
90
|
await page.click( '.editor-post-title' );
|
91
91
|
await page.keyboard.type( 'Test Post...' );
|
@@ -145,7 +145,10 @@ describe( 'Multi-entity save flow', () => {
|
|
145
145
|
await assertExistance( savePanelSelector, false );
|
146
146
|
|
147
147
|
// Close publish panel.
|
148
|
-
await page.
|
148
|
+
const closePanelButton = await page.waitForSelector(
|
149
|
+
closePanelButtonSelector
|
150
|
+
);
|
151
|
+
await closePanelButton.click();
|
149
152
|
|
150
153
|
// Verify saving is disabled.
|
151
154
|
const draftSaved = await page.waitForSelector( draftSavedSelector );
|
@@ -154,13 +157,22 @@ describe( 'Multi-entity save flow', () => {
|
|
154
157
|
await assertExistance( saveA11ySelector, false );
|
155
158
|
|
156
159
|
await publishPost();
|
160
|
+
// Wait for the success notice specifically for the published post.
|
161
|
+
// `publishPost()` has a similar check but it only checks for the
|
162
|
+
// existence of any snackbars. In this case, there's another "Site updated"
|
163
|
+
// notice which will be sufficient for that and thus creating a false-positive.
|
164
|
+
await page.waitForXPath(
|
165
|
+
'//*[@id="a11y-speak-polite"][contains(text(), "Post published")]'
|
166
|
+
);
|
157
167
|
|
158
168
|
// Update the post.
|
159
169
|
await page.click( '.editor-post-title' );
|
160
170
|
await page.keyboard.type( '...more title!' );
|
161
171
|
|
162
172
|
// Verify update button is enabled.
|
163
|
-
const enabledSaveButton = await page
|
173
|
+
const enabledSaveButton = await page.waitForSelector(
|
174
|
+
enabledSavePostSelector
|
175
|
+
);
|
164
176
|
expect( enabledSaveButton ).not.toBeNull();
|
165
177
|
// Verify multi-entity saving not enabled.
|
166
178
|
await assertMultiSaveDisabled();
|
@@ -280,7 +280,8 @@ describe( 'Template Part', () => {
|
|
280
280
|
const confirmTitleButtonSelector =
|
281
281
|
'.wp-block-template-part__placeholder-create-new__title-form .components-button.is-primary';
|
282
282
|
|
283
|
-
|
283
|
+
// Template parts can't be used in posts, so this test needs to be rebuilt for the template editor.
|
284
|
+
it.skip( 'Should insert new template part on creation', async () => {
|
284
285
|
await createNewPost();
|
285
286
|
await disablePrePublishChecks();
|
286
287
|
// Create new template part.
|
@@ -18,10 +18,6 @@ import {
|
|
18
18
|
// eslint-disable-next-line no-restricted-imports
|
19
19
|
import { find, findAll } from 'puppeteer-testing-library';
|
20
20
|
|
21
|
-
const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
|
22
|
-
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).
|
23
|
-
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`;
|
24
|
-
|
25
21
|
describe( 'Widgets Customizer', () => {
|
26
22
|
beforeEach( async () => {
|
27
23
|
await deleteAllWidgets();
|
@@ -162,8 +158,6 @@ describe( 'Widgets Customizer', () => {
|
|
162
158
|
name: 'My Search',
|
163
159
|
selector: '.widget-content *',
|
164
160
|
} ).toBeFound( findOptions );
|
165
|
-
|
166
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
167
161
|
} );
|
168
162
|
|
169
163
|
it( 'should open the inspector panel', async () => {
|
@@ -249,8 +243,6 @@ describe( 'Widgets Customizer', () => {
|
|
249
243
|
} ).toBeFound();
|
250
244
|
|
251
245
|
await expect( inspectorHeading ).not.toBeVisible();
|
252
|
-
|
253
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
254
246
|
} );
|
255
247
|
|
256
248
|
it( 'should handle the inserter outer section', async () => {
|
@@ -358,8 +350,6 @@ describe( 'Widgets Customizer', () => {
|
|
358
350
|
name: 'Add a block',
|
359
351
|
level: 2,
|
360
352
|
} ).not.toBeFound();
|
361
|
-
|
362
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
363
353
|
} );
|
364
354
|
|
365
355
|
it( 'should move focus to the block', async () => {
|
@@ -455,8 +445,6 @@ describe( 'Widgets Customizer', () => {
|
|
455
445
|
text: 'First Heading',
|
456
446
|
} );
|
457
447
|
await expect( headingBlock ).toHaveFocus();
|
458
|
-
|
459
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
460
448
|
} );
|
461
449
|
|
462
450
|
it( 'should clear block selection', async () => {
|
@@ -519,8 +507,6 @@ describe( 'Widgets Customizer', () => {
|
|
519
507
|
role: 'toolbar',
|
520
508
|
name: 'Block tools',
|
521
509
|
} ).not.toBeFound();
|
522
|
-
|
523
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
524
510
|
} );
|
525
511
|
|
526
512
|
it( 'should handle legacy widgets', async () => {
|
@@ -699,8 +685,6 @@ describe( 'Widgets Customizer', () => {
|
|
699
685
|
selector: '*[aria-live="polite"][aria-relevant="additions text"]',
|
700
686
|
} ).toBeFound();
|
701
687
|
await expect( paragraphBlock ).toBeVisible();
|
702
|
-
|
703
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
704
688
|
} );
|
705
689
|
|
706
690
|
it( 'should move (inner) blocks to another sidebar', async () => {
|
@@ -760,8 +744,6 @@ describe( 'Widgets Customizer', () => {
|
|
760
744
|
await expect( movedParagraphBlockQuery ).toBeFound();
|
761
745
|
const movedParagraphBlock = await find( movedParagraphBlockQuery );
|
762
746
|
await expect( movedParagraphBlock ).toHaveFocus();
|
763
|
-
|
764
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
765
747
|
} );
|
766
748
|
|
767
749
|
it( 'should not render Block Settings sections', async () => {
|
@@ -851,8 +833,6 @@ describe( 'Widgets Customizer', () => {
|
|
851
833
|
name: 'Customizing ▸ Widgets ▸ Footer #1 Block Settings',
|
852
834
|
level: 3,
|
853
835
|
} );
|
854
|
-
|
855
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
856
836
|
} );
|
857
837
|
} );
|
858
838
|
|
@@ -16,6 +16,7 @@ import {
|
|
16
16
|
openGlobalBlockInserter,
|
17
17
|
searchForBlock,
|
18
18
|
closeGlobalBlockInserter,
|
19
|
+
setBrowserViewport,
|
19
20
|
} from '@wordpress/e2e-test-utils';
|
20
21
|
|
21
22
|
/**
|
@@ -25,10 +26,6 @@ import {
|
|
25
26
|
import { find, findAll } from 'puppeteer-testing-library';
|
26
27
|
import { groupBy, mapValues } from 'lodash';
|
27
28
|
|
28
|
-
const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
|
29
|
-
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).
|
30
|
-
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`;
|
31
|
-
|
32
29
|
describe( 'Widgets screen', () => {
|
33
30
|
beforeEach( async () => {
|
34
31
|
await visitWidgetsScreen();
|
@@ -232,8 +229,6 @@ describe( 'Widgets screen', () => {
|
|
232
229
|
</div></div>",
|
233
230
|
}
|
234
231
|
` );
|
235
|
-
|
236
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
237
232
|
} );
|
238
233
|
|
239
234
|
it.skip( 'Should insert content using the inline inserter', async () => {
|
@@ -601,8 +596,6 @@ describe( 'Widgets screen', () => {
|
|
601
596
|
initialSerializedWidgetAreas[ 'sidebar-1' ],
|
602
597
|
].join( '\n' )
|
603
598
|
);
|
604
|
-
|
605
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
606
599
|
} );
|
607
600
|
|
608
601
|
it.skip( 'Should display legacy widgets', async () => {
|
@@ -777,8 +770,6 @@ describe( 'Widgets screen', () => {
|
|
777
770
|
</div></div>",
|
778
771
|
}
|
779
772
|
` );
|
780
|
-
|
781
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
782
773
|
} );
|
783
774
|
|
784
775
|
it( 'Allows widget deletion to be undone', async () => {
|
@@ -838,8 +829,6 @@ describe( 'Widgets screen', () => {
|
|
838
829
|
</div></div>",
|
839
830
|
}
|
840
831
|
` );
|
841
|
-
|
842
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
843
832
|
} );
|
844
833
|
|
845
834
|
it( 'can toggle sidebar list view', async () => {
|
@@ -854,6 +843,41 @@ describe( 'Widgets screen', () => {
|
|
854
843
|
expect( listItems.length >= widgetAreas.length ).toEqual( true );
|
855
844
|
await closeListView();
|
856
845
|
} );
|
846
|
+
|
847
|
+
// Check for regressions of https://github.com/WordPress/gutenberg/issues/38002.
|
848
|
+
it( 'allows blocks to be added on mobile viewports', async () => {
|
849
|
+
await setBrowserViewport( 'small' );
|
850
|
+
const [ firstWidgetArea ] = await findAll( {
|
851
|
+
role: 'document',
|
852
|
+
name: 'Block: Widget Area',
|
853
|
+
} );
|
854
|
+
|
855
|
+
const addParagraphBlock = await getBlockInGlobalInserter( 'Paragraph' );
|
856
|
+
await addParagraphBlock.click();
|
857
|
+
|
858
|
+
const addedParagraphBlockInFirstWidgetArea = await find(
|
859
|
+
{
|
860
|
+
name: /^Empty block/,
|
861
|
+
selector: '[data-block][data-type="core/paragraph"]',
|
862
|
+
},
|
863
|
+
{
|
864
|
+
root: firstWidgetArea,
|
865
|
+
}
|
866
|
+
);
|
867
|
+
await addedParagraphBlockInFirstWidgetArea.focus();
|
868
|
+
await page.keyboard.type( 'First Paragraph' );
|
869
|
+
const updatedParagraphBlockInFirstWidgetArea = await find(
|
870
|
+
{
|
871
|
+
name: 'Paragraph block',
|
872
|
+
value: 'First Paragraph',
|
873
|
+
},
|
874
|
+
{
|
875
|
+
root: firstWidgetArea,
|
876
|
+
}
|
877
|
+
);
|
878
|
+
|
879
|
+
expect( updatedParagraphBlockInFirstWidgetArea ).toBeTruthy();
|
880
|
+
} );
|
857
881
|
} );
|
858
882
|
|
859
883
|
/**
|