@wordpress/e2e-tests 2.5.10 → 2.5.14
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/cover.test.js +3 -0
- package/specs/editor/blocks/image.test.js +3 -2
- package/specs/editor/blocks/navigation.test.js +186 -75
- package/specs/editor/various/block-grouping.test.js +46 -0
- package/specs/editor/various/format-library/__snapshots__/text-color.test.js.snap +13 -0
- package/specs/editor/various/format-library/text-color.test.js +46 -0
- package/specs/site-editor/document-settings.test.js +5 -5
- package/specs/site-editor/multi-entity-saving.test.js +17 -5
- package/specs/site-editor/settings-sidebar.test.js +2 -3
- package/specs/site-editor/template-part.test.js +2 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "2.5.
|
3
|
+
"version": "2.5.14",
|
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,7 +23,7 @@
|
|
23
23
|
"node": ">=12"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^5.4.
|
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
29
|
"@wordpress/scripts": "^19.2.2",
|
@@ -43,5 +43,5 @@
|
|
43
43
|
"publishConfig": {
|
44
44
|
"access": "public"
|
45
45
|
},
|
46
|
-
"gitHead": "
|
46
|
+
"gitHead": "f70f4664ac641bd107481c5c67ee6f5556a0a381"
|
47
47
|
}
|
@@ -197,6 +197,9 @@ describe( 'Cover', () => {
|
|
197
197
|
await insertBlock( 'Image' );
|
198
198
|
// Upload image and transform to the Cover block
|
199
199
|
await upload( '.wp-block-image' );
|
200
|
+
// Click the block wrapper before trying to convert to make sure figcaption toolbar is not obscuring
|
201
|
+
// the block toolbar.
|
202
|
+
await page.click( '.wp-block-image' );
|
200
203
|
await transformBlockTo( 'Cover' );
|
201
204
|
|
202
205
|
// Get the block's background dim color and its opacity
|
@@ -103,8 +103,9 @@ describe( 'Image', () => {
|
|
103
103
|
`<!-- wp:image {"id":\\d+,"sizeSlug":"full","linkDestination":"none"} -->\\s*<figure class="wp-block-image size-full"><img src="[^"]+\\/${ filename2 }\\.png" alt="" class="wp-image-\\d+"/></figure>\\s*<!-- \\/wp:image -->`
|
104
104
|
);
|
105
105
|
expect( await getEditedPostContent() ).toMatch( regex3 );
|
106
|
-
|
107
|
-
|
106
|
+
// For some reason just clicking the block wrapper causes figcaption to get focus
|
107
|
+
// in puppeteer but not in live browser, so clicking on the image wrapper div here instead.
|
108
|
+
await page.click( '.wp-block-image > div' );
|
108
109
|
await page.keyboard.press( 'Backspace' );
|
109
110
|
|
110
111
|
expect( await getEditedPostContent() ).toBe( '' );
|
@@ -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
|
} );
|
@@ -110,6 +110,52 @@ describe( 'Block Grouping', () => {
|
|
110
110
|
);
|
111
111
|
expect( ungroupButtons ).toHaveLength( 0 );
|
112
112
|
} );
|
113
|
+
it( 'should group and ungroup a controlled block properly', async () => {
|
114
|
+
const getParagraphText = async () => {
|
115
|
+
const paragraphInReusableSelector =
|
116
|
+
'.block-editor-block-list__block[data-type="core/block"] p';
|
117
|
+
await page.waitForSelector( paragraphInReusableSelector );
|
118
|
+
return page.$eval(
|
119
|
+
paragraphInReusableSelector,
|
120
|
+
( element ) => element.innerText
|
121
|
+
);
|
122
|
+
};
|
123
|
+
|
124
|
+
const paragraphText = 'hi';
|
125
|
+
const reusableBlockNameInputSelector =
|
126
|
+
'.reusable-blocks-menu-items__convert-modal .components-text-control__input';
|
127
|
+
await insertBlock( 'Paragraph' );
|
128
|
+
await page.keyboard.type( paragraphText );
|
129
|
+
|
130
|
+
await clickBlockToolbarButton( 'Options' );
|
131
|
+
await clickMenuItem( 'Add to Reusable blocks' );
|
132
|
+
const nameInput = await page.waitForSelector(
|
133
|
+
reusableBlockNameInputSelector
|
134
|
+
);
|
135
|
+
await nameInput.click();
|
136
|
+
await page.keyboard.type( 'Block' );
|
137
|
+
await page.keyboard.press( 'Enter' );
|
138
|
+
|
139
|
+
// Wait for creation to finish
|
140
|
+
await page.waitForXPath(
|
141
|
+
'//*[contains(@class, "components-snackbar")]/*[text()="Reusable block created."]'
|
142
|
+
);
|
143
|
+
// Group
|
144
|
+
await clickBlockToolbarButton( 'Options' );
|
145
|
+
await clickMenuItem( 'Group' );
|
146
|
+
|
147
|
+
let group = await page.$$( '[data-type="core/group"]' );
|
148
|
+
expect( group ).toHaveLength( 1 );
|
149
|
+
// Make sure the paragraph in reusable block exists.
|
150
|
+
expect( await getParagraphText() ).toMatch( paragraphText );
|
151
|
+
|
152
|
+
await clickBlockToolbarButton( 'Options' );
|
153
|
+
await clickMenuItem( 'Ungroup' );
|
154
|
+
group = await page.$$( '[data-type="core/group"]' );
|
155
|
+
expect( group ).toHaveLength( 0 );
|
156
|
+
// Make sure the paragraph in reusable block exists.
|
157
|
+
expect( await getParagraphText() ).toEqual( paragraphText );
|
158
|
+
} );
|
113
159
|
} );
|
114
160
|
|
115
161
|
describe( 'Grouping Block availability', () => {
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`RichText should remove highlighting element 1`] = `
|
4
|
+
"<!-- wp:paragraph -->
|
5
|
+
<p><mark style=\\"background-color:rgba(0, 0, 0, 0)\\" class=\\"has-inline-color has-cyan-bluish-gray-color\\">1</mark></p>
|
6
|
+
<!-- /wp:paragraph -->"
|
7
|
+
`;
|
8
|
+
|
9
|
+
exports[`RichText should remove highlighting element 2`] = `
|
10
|
+
"<!-- wp:paragraph -->
|
11
|
+
<p>1</p>
|
12
|
+
<!-- /wp:paragraph -->"
|
13
|
+
`;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* WordPress dependencies
|
3
|
+
*/
|
4
|
+
import {
|
5
|
+
createNewPost,
|
6
|
+
getEditedPostContent,
|
7
|
+
clickBlockAppender,
|
8
|
+
pressKeyWithModifier,
|
9
|
+
clickBlockToolbarButton,
|
10
|
+
} from '@wordpress/e2e-test-utils';
|
11
|
+
|
12
|
+
describe( 'RichText', () => {
|
13
|
+
beforeEach( async () => {
|
14
|
+
await createNewPost();
|
15
|
+
} );
|
16
|
+
|
17
|
+
it( 'should remove highlighting element', async () => {
|
18
|
+
await clickBlockAppender();
|
19
|
+
|
20
|
+
// Add text and select to color.
|
21
|
+
await page.keyboard.type( '1' );
|
22
|
+
await pressKeyWithModifier( 'primary', 'a' );
|
23
|
+
await clickBlockToolbarButton( 'More' );
|
24
|
+
|
25
|
+
const button = await page.waitForXPath(
|
26
|
+
`//button[text()='Highlight']`
|
27
|
+
);
|
28
|
+
// Clicks may fail if the button is out of view. Assure it is before click.
|
29
|
+
await button.evaluate( ( element ) => element.scrollIntoView() );
|
30
|
+
await button.click();
|
31
|
+
|
32
|
+
// Use a color name with multiple words to ensure that it becomes
|
33
|
+
// active. Previously we had a broken regular expression.
|
34
|
+
const option = await page.waitForSelector(
|
35
|
+
'[aria-label="Color: Cyan bluish gray"]'
|
36
|
+
);
|
37
|
+
|
38
|
+
await option.click();
|
39
|
+
|
40
|
+
expect( await getEditedPostContent() ).toMatchSnapshot();
|
41
|
+
|
42
|
+
await option.click();
|
43
|
+
|
44
|
+
expect( await getEditedPostContent() ).toMatchSnapshot();
|
45
|
+
} );
|
46
|
+
} );
|
@@ -13,7 +13,7 @@ async function getDocumentSettingsTitle() {
|
|
13
13
|
'.edit-site-document-actions__title'
|
14
14
|
);
|
15
15
|
|
16
|
-
return titleElement.evaluate( ( el ) => el.
|
16
|
+
return titleElement.evaluate( ( el ) => el.textContent );
|
17
17
|
}
|
18
18
|
|
19
19
|
async function getDocumentSettingsSecondaryTitle() {
|
@@ -21,7 +21,7 @@ async function getDocumentSettingsSecondaryTitle() {
|
|
21
21
|
'.edit-site-document-actions__secondary-item'
|
22
22
|
);
|
23
23
|
|
24
|
-
return secondaryTitleElement.evaluate( ( el ) => el.
|
24
|
+
return secondaryTitleElement.evaluate( ( el ) => el.textContent );
|
25
25
|
}
|
26
26
|
|
27
27
|
describe( 'Document Settings', () => {
|
@@ -50,7 +50,7 @@ describe( 'Document Settings', () => {
|
|
50
50
|
// Evaluate the document settings title
|
51
51
|
const actual = await getDocumentSettingsTitle();
|
52
52
|
|
53
|
-
expect( actual ).toEqual( 'Index' );
|
53
|
+
expect( actual ).toEqual( 'Editing template: Index' );
|
54
54
|
} );
|
55
55
|
|
56
56
|
describe( 'and a template part is clicked in the template', () => {
|
@@ -70,7 +70,7 @@ describe( 'Document Settings', () => {
|
|
70
70
|
// Evaluate the document settings secondary title
|
71
71
|
const actual = await getDocumentSettingsSecondaryTitle();
|
72
72
|
|
73
|
-
expect( actual ).toEqual( '
|
73
|
+
expect( actual ).toEqual( 'Editing template part: header' );
|
74
74
|
} );
|
75
75
|
} );
|
76
76
|
} );
|
@@ -86,7 +86,7 @@ describe( 'Document Settings', () => {
|
|
86
86
|
// Evaluate the document settings title
|
87
87
|
const actual = await getDocumentSettingsTitle();
|
88
88
|
|
89
|
-
expect( actual ).toEqual( 'header' );
|
89
|
+
expect( actual ).toEqual( 'Editing template part: header' );
|
90
90
|
} );
|
91
91
|
} );
|
92
92
|
} );
|
@@ -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();
|
@@ -77,12 +77,11 @@ describe( 'Settings sidebar', () => {
|
|
77
77
|
|
78
78
|
expect( templateCardBeforeNavigation ).toMatchObject( {
|
79
79
|
title: 'Index',
|
80
|
-
description:
|
81
|
-
'The default template used when no other template is available. This is a required template in WordPress.',
|
80
|
+
description: 'Displays posts.',
|
82
81
|
} );
|
83
82
|
expect( templateCardAfterNavigation ).toMatchObject( {
|
84
83
|
title: '404',
|
85
|
-
description: '
|
84
|
+
description: 'Displays when no content is found.',
|
86
85
|
} );
|
87
86
|
} );
|
88
87
|
} );
|
@@ -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.
|