@wordpress/e2e-tests 2.5.6 → 2.5.10
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/jest.config.js +1 -0
- package/package.json +4 -4
- package/specs/{experiments → editor}/blocks/__snapshots__/navigation.test.js.snap +0 -0
- package/specs/editor/blocks/cover.test.js +127 -0
- package/specs/editor/blocks/image.test.js +14 -10
- package/specs/{experiments → editor}/blocks/navigation.test.js +88 -0
- package/specs/{experiments → editor}/fixtures/menu-items-response-fixture.json +0 -0
- package/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +2 -0
- package/specs/{experiments → editor/various}/__snapshots__/post-editor-template-mode.test.js.snap +0 -0
- package/specs/{misc/settings.test.js → editor/various/core-settings.test.js} +0 -0
- package/specs/{experiments → editor/various}/post-editor-template-mode.test.js +0 -0
- package/specs/editor/various/writing-flow.test.js +21 -1
- package/specs/experiments/experimental-features.js +39 -0
- package/specs/experiments/navigation-editor.test.js +1 -1
- package/specs/performance/site-editor.test.js +2 -1
- package/specs/{experiments → site-editor}/document-settings.test.js +2 -1
- package/specs/{experiments → site-editor}/multi-entity-editing.test.js +3 -1
- package/specs/{experiments → site-editor}/multi-entity-saving.test.js +2 -1
- package/specs/{experiments → site-editor}/settings-sidebar.test.js +2 -1
- package/specs/{experiments → site-editor}/site-editor-export.test.js +2 -1
- package/specs/{experiments → site-editor}/site-editor-inserter.test.js +2 -1
- package/specs/{experiments → site-editor}/template-part.test.js +3 -2
- package/specs/{experiments → site-editor}/template-revert.test.js +7 -2
- package/{experimental-features.js → specs/site-editor/utils.js} +27 -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.
|
3
|
+
"version": "2.5.10",
|
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,10 +23,10 @@
|
|
23
23
|
"node": ">=12"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^5.4.
|
26
|
+
"@wordpress/e2e-test-utils": "^5.4.9",
|
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.2",
|
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": "34b76b2f9397215e5afb8443f5b3073c83913102"
|
47
47
|
}
|
File without changes
|
@@ -1,3 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* External dependencies
|
3
|
+
*/
|
4
|
+
import path from 'path';
|
5
|
+
import fs from 'fs';
|
6
|
+
import os from 'os';
|
7
|
+
import { v4 as uuid } from 'uuid';
|
8
|
+
|
1
9
|
/**
|
2
10
|
* WordPress dependencies
|
3
11
|
*/
|
@@ -5,13 +13,110 @@ import {
|
|
5
13
|
insertBlock,
|
6
14
|
createNewPost,
|
7
15
|
openDocumentSettingsSidebar,
|
16
|
+
transformBlockTo,
|
8
17
|
} from '@wordpress/e2e-test-utils';
|
9
18
|
|
19
|
+
async function upload( selector ) {
|
20
|
+
const inputElement = await page.waitForSelector(
|
21
|
+
`${ selector } input[type="file"]`
|
22
|
+
);
|
23
|
+
const testImagePath = path.join(
|
24
|
+
__dirname,
|
25
|
+
'..',
|
26
|
+
'..',
|
27
|
+
'..',
|
28
|
+
'assets',
|
29
|
+
'10x10_e2e_test_image_z9T8jK.png'
|
30
|
+
);
|
31
|
+
const filename = uuid();
|
32
|
+
const tmpFileName = path.join( os.tmpdir(), filename + '.png' );
|
33
|
+
fs.copyFileSync( testImagePath, tmpFileName );
|
34
|
+
await inputElement.uploadFile( tmpFileName );
|
35
|
+
await page.waitForSelector( `${ selector } img[src$="${ filename }.png"]` );
|
36
|
+
return filename;
|
37
|
+
}
|
38
|
+
|
10
39
|
describe( 'Cover', () => {
|
11
40
|
beforeEach( async () => {
|
12
41
|
await createNewPost();
|
13
42
|
} );
|
14
43
|
|
44
|
+
it( 'can set overlay color using color picker on block placeholder', async () => {
|
45
|
+
await insertBlock( 'Cover' );
|
46
|
+
// Get the first color option from the block placeholder's color picker
|
47
|
+
const colorPickerButton = await page.waitForSelector(
|
48
|
+
'.wp-block-cover__placeholder-background-options .components-circular-option-picker__option-wrapper:first-child button'
|
49
|
+
);
|
50
|
+
// Get the RGB value of the picked color
|
51
|
+
const pickedColor = await colorPickerButton.evaluate(
|
52
|
+
( node ) => node.style.backgroundColor
|
53
|
+
);
|
54
|
+
// Create the block by clicking selected color button
|
55
|
+
await colorPickerButton.click();
|
56
|
+
// Get the block's background dim element
|
57
|
+
const backgroundDim = await page.waitForSelector(
|
58
|
+
'.wp-block-cover .has-background-dim'
|
59
|
+
);
|
60
|
+
// Get the RGB value of the background dim
|
61
|
+
const dimColor = await backgroundDim.evaluate(
|
62
|
+
( node ) => node.style.backgroundColor
|
63
|
+
);
|
64
|
+
|
65
|
+
expect( pickedColor ).toEqual( dimColor );
|
66
|
+
} );
|
67
|
+
|
68
|
+
it( 'can set background image using image upload on block placeholder', async () => {
|
69
|
+
await insertBlock( 'Cover' );
|
70
|
+
// Create the block using uploaded image
|
71
|
+
const sourceImageFilename = await upload( '.wp-block-cover' );
|
72
|
+
// Get the block's background image URL
|
73
|
+
const blockImage = await page.waitForSelector( '.wp-block-cover img' );
|
74
|
+
const blockImageUrl = await blockImage.evaluate( ( el ) => el.src );
|
75
|
+
|
76
|
+
expect( blockImageUrl ).toContain( sourceImageFilename );
|
77
|
+
} );
|
78
|
+
|
79
|
+
it( 'dims background image down by 50% by default', async () => {
|
80
|
+
await insertBlock( 'Cover' );
|
81
|
+
// Create the block using uploaded image
|
82
|
+
await upload( '.wp-block-cover' );
|
83
|
+
// Get the block's background dim color and its opacity
|
84
|
+
const backgroundDim = await page.waitForSelector(
|
85
|
+
'.wp-block-cover .has-background-dim'
|
86
|
+
);
|
87
|
+
const [
|
88
|
+
backgroundDimColor,
|
89
|
+
backgroundDimOpacity,
|
90
|
+
] = await page.evaluate( ( el ) => {
|
91
|
+
const computedStyle = window.getComputedStyle( el );
|
92
|
+
return [ computedStyle.backgroundColor, computedStyle.opacity ];
|
93
|
+
}, backgroundDim );
|
94
|
+
|
95
|
+
expect( backgroundDimColor ).toBe( 'rgb(0, 0, 0)' );
|
96
|
+
expect( backgroundDimOpacity ).toBe( '0.5' );
|
97
|
+
} );
|
98
|
+
|
99
|
+
it( 'can have the title edited', async () => {
|
100
|
+
await insertBlock( 'Cover' );
|
101
|
+
// Click first color option from the block placeholder's color picker
|
102
|
+
const colorPickerButton = await page.waitForSelector(
|
103
|
+
'.wp-block-cover__placeholder-background-options .components-circular-option-picker__option-wrapper:first-child button'
|
104
|
+
);
|
105
|
+
await colorPickerButton.click();
|
106
|
+
// Click the title placeholder to put the cursor inside
|
107
|
+
const coverTitle = await page.waitForSelector(
|
108
|
+
'.wp-block-cover .wp-block-paragraph'
|
109
|
+
);
|
110
|
+
await coverTitle.click();
|
111
|
+
// Type the title
|
112
|
+
await page.keyboard.type( 'foo' );
|
113
|
+
const coverTitleText = await coverTitle.evaluate(
|
114
|
+
( el ) => el.innerText
|
115
|
+
);
|
116
|
+
|
117
|
+
expect( coverTitleText ).toEqual( 'foo' );
|
118
|
+
} );
|
119
|
+
|
15
120
|
it( 'can be resized using drag & drop', async () => {
|
16
121
|
await insertBlock( 'Cover' );
|
17
122
|
// Close the inserter
|
@@ -87,4 +192,26 @@ describe( 'Cover', () => {
|
|
87
192
|
)
|
88
193
|
).toBeGreaterThan( 100 );
|
89
194
|
} );
|
195
|
+
|
196
|
+
it( 'dims the background image down by 50% when transformed from the Image block', async () => {
|
197
|
+
await insertBlock( 'Image' );
|
198
|
+
// Upload image and transform to the Cover block
|
199
|
+
await upload( '.wp-block-image' );
|
200
|
+
await transformBlockTo( 'Cover' );
|
201
|
+
|
202
|
+
// Get the block's background dim color and its opacity
|
203
|
+
const backgroundDim = await page.waitForSelector(
|
204
|
+
'.wp-block-cover .has-background-dim'
|
205
|
+
);
|
206
|
+
const [
|
207
|
+
backgroundDimColor,
|
208
|
+
backgroundDimOpacity,
|
209
|
+
] = await page.evaluate( ( el ) => {
|
210
|
+
const computedStyle = window.getComputedStyle( el );
|
211
|
+
return [ computedStyle.backgroundColor, computedStyle.opacity ];
|
212
|
+
}, backgroundDim );
|
213
|
+
|
214
|
+
expect( backgroundDimColor ).toBe( 'rgb(0, 0, 0)' );
|
215
|
+
expect( backgroundDimOpacity ).toBe( '0.5' );
|
216
|
+
} );
|
90
217
|
} );
|
@@ -74,7 +74,7 @@ describe( 'Image', () => {
|
|
74
74
|
expect( await getEditedPostContent() ).toMatch( regex );
|
75
75
|
} );
|
76
76
|
|
77
|
-
it
|
77
|
+
it( 'should replace, reset size, and keep selection', async () => {
|
78
78
|
await insertBlock( 'Image' );
|
79
79
|
const filename1 = await upload( '.wp-block-image input[type="file"]' );
|
80
80
|
await waitForImage( filename1 );
|
@@ -104,7 +104,7 @@ describe( 'Image', () => {
|
|
104
104
|
);
|
105
105
|
expect( await getEditedPostContent() ).toMatch( regex3 );
|
106
106
|
|
107
|
-
await page.click( '.wp-block-image
|
107
|
+
await page.click( '.wp-block-image' );
|
108
108
|
await page.keyboard.press( 'Backspace' );
|
109
109
|
|
110
110
|
expect( await getEditedPostContent() ).toBe( '' );
|
@@ -314,9 +314,13 @@ describe( 'Image', () => {
|
|
314
314
|
|
315
315
|
// Upload an initial image.
|
316
316
|
const filename = await upload( '.wp-block-image input[type="file"]' );
|
317
|
-
|
317
|
+
await waitForImage( filename );
|
318
318
|
// Resize the Uploaded Image.
|
319
319
|
await openDocumentSettingsSidebar();
|
320
|
+
await page.waitForSelector(
|
321
|
+
'[aria-label="Image size presets"] button:first-child',
|
322
|
+
{ visible: true }
|
323
|
+
);
|
320
324
|
await page.click(
|
321
325
|
'[aria-label="Image size presets"] button:first-child'
|
322
326
|
);
|
@@ -337,15 +341,15 @@ describe( 'Image', () => {
|
|
337
341
|
await editButton.click();
|
338
342
|
|
339
343
|
await page.waitForSelector( '.block-editor-url-input__input' );
|
340
|
-
await page.evaluate(
|
341
|
-
() =>
|
342
|
-
( document.querySelector(
|
343
|
-
'.block-editor-url-input__input'
|
344
|
-
).value = '' )
|
345
|
-
);
|
346
344
|
|
345
|
+
// Clear the input field. Delay added to account for typing delays.
|
346
|
+
const inputField = await page.$( '.block-editor-url-input__input' );
|
347
|
+
await inputField.click( { clickCount: 3, delay: 100 } );
|
348
|
+
await page.keyboard.press( 'Backspace', { delay: 100 } );
|
349
|
+
|
350
|
+
// Replace the url. Delay added to account for typing delays.
|
347
351
|
await page.focus( '.block-editor-url-input__input' );
|
348
|
-
await page.keyboard.type( imageUrl );
|
352
|
+
await page.keyboard.type( imageUrl, { delay: 100 } );
|
349
353
|
await page.click( '.block-editor-link-control__search-submit' );
|
350
354
|
|
351
355
|
const regexAfter = new RegExp(
|
@@ -784,4 +784,92 @@ describe.skip( 'Navigation', () => {
|
|
784
784
|
|
785
785
|
expect( isScriptLoaded ).toBe( true );
|
786
786
|
} );
|
787
|
+
|
788
|
+
describe( 'Creating and restarting', () => {
|
789
|
+
async function populateNavWithOneItem() {
|
790
|
+
// Add a Link block first.
|
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.
|
833
|
+
await insertBlock( 'Navigation' );
|
834
|
+
|
835
|
+
// Create an empty nav block.
|
836
|
+
await createEmptyNavBlock();
|
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"])'
|
842
|
+
);
|
843
|
+
await page.click( '.editor-post-publish-panel__toggle' );
|
844
|
+
|
845
|
+
const NAV_ENTITY_SELECTOR =
|
846
|
+
'//div[@class="entities-saved-states__panel"]//label//strong[contains(text(), "Navigation")]';
|
847
|
+
await page.waitForXPath( NAV_ENTITY_SELECTOR );
|
848
|
+
expect( await page.$x( NAV_ENTITY_SELECTOR ) ).toHaveLength( 1 );
|
849
|
+
|
850
|
+
// Publish the post
|
851
|
+
await page.click( '.editor-entities-saved-states__save-button' );
|
852
|
+
await page.waitForSelector( '.editor-post-publish-button' );
|
853
|
+
await page.click( '.editor-post-publish-button' );
|
854
|
+
|
855
|
+
// A success notice should show up
|
856
|
+
await page.waitForSelector( '.components-snackbar' );
|
857
|
+
|
858
|
+
// Now try inserting another Link block via the quick inserter.
|
859
|
+
await page.focus( '.wp-block-navigation' );
|
860
|
+
|
861
|
+
await resetNavBlockToInitialState();
|
862
|
+
await createEmptyNavBlock();
|
863
|
+
await populateNavWithOneItem();
|
864
|
+
|
865
|
+
// Let's confirm that only the last menu entity was updated.
|
866
|
+
await page.waitForSelector(
|
867
|
+
'.editor-post-publish-button__button:not([aria-disabled="true"])'
|
868
|
+
);
|
869
|
+
await page.click( '.editor-post-publish-button__button' );
|
870
|
+
|
871
|
+
await page.waitForXPath( NAV_ENTITY_SELECTOR );
|
872
|
+
expect( await page.$x( NAV_ENTITY_SELECTOR ) ).toHaveLength( 1 );
|
873
|
+
} );
|
874
|
+
} );
|
787
875
|
} );
|
File without changes
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
insertBlock,
|
10
10
|
openGlobalBlockInserter,
|
11
11
|
closeGlobalBlockInserter,
|
12
|
+
clickBlockToolbarButton,
|
12
13
|
} from '@wordpress/e2e-test-utils';
|
13
14
|
|
14
15
|
describe( 'Allowed Blocks Setting on InnerBlocks', () => {
|
@@ -75,6 +76,7 @@ describe( 'Allowed Blocks Setting on InnerBlocks', () => {
|
|
75
76
|
await insertBlock( 'Image' );
|
76
77
|
await closeGlobalBlockInserter();
|
77
78
|
await page.waitForSelector( '.product[data-number-of-children="2"]' );
|
79
|
+
await clickBlockToolbarButton( 'Select Allowed Blocks Dynamic' );
|
78
80
|
// This focus shouldn't be neessary but there's a bug in trunk right now
|
79
81
|
// Where if you open the inserter, don't do anything and click the "appender" on the canvas
|
80
82
|
// the appender is not opened right away.
|
package/specs/{experiments → editor/various}/__snapshots__/post-editor-template-mode.test.js.snap
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -13,7 +13,7 @@ import {
|
|
13
13
|
|
14
14
|
const getActiveBlockName = async () =>
|
15
15
|
page.evaluate(
|
16
|
-
() => wp.data.select( 'core/block-editor' ).getSelectedBlock()
|
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 '
|
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 '
|
22
|
+
import { siteEditor } from '../site-editor/utils';
|
23
23
|
import {
|
24
24
|
readFile,
|
25
25
|
deleteFile,
|
@@ -84,6 +84,7 @@ describe( 'Site Editor Performance', () => {
|
|
84
84
|
);
|
85
85
|
|
86
86
|
await siteEditor.visit( { postId: id, postType: 'page' } );
|
87
|
+
await siteEditor.disableWelcomeGuide();
|
87
88
|
|
88
89
|
let i = 3;
|
89
90
|
|
@@ -6,7 +6,7 @@ import { trashAllPosts, activateTheme } from '@wordpress/e2e-test-utils';
|
|
6
6
|
/**
|
7
7
|
* Internal dependencies
|
8
8
|
*/
|
9
|
-
import { siteEditor } from '
|
9
|
+
import { siteEditor } from './utils';
|
10
10
|
|
11
11
|
async function getDocumentSettingsTitle() {
|
12
12
|
const titleElement = await page.waitForSelector(
|
@@ -36,6 +36,7 @@ describe( 'Document Settings', () => {
|
|
36
36
|
|
37
37
|
beforeEach( async () => {
|
38
38
|
await siteEditor.visit();
|
39
|
+
await siteEditor.disableWelcomeGuide();
|
39
40
|
} );
|
40
41
|
|
41
42
|
describe( 'when a template is selected from the navigation sidebar', () => {
|
@@ -16,7 +16,7 @@ import {
|
|
16
16
|
/**
|
17
17
|
* Internal dependencies
|
18
18
|
*/
|
19
|
-
import { navigationPanel, siteEditor } from '
|
19
|
+
import { navigationPanel, siteEditor } from './utils';
|
20
20
|
|
21
21
|
const clickTemplateItem = async ( menus, itemName ) => {
|
22
22
|
await navigationPanel.open();
|
@@ -145,6 +145,7 @@ describe( 'Multi-entity editor states', () => {
|
|
145
145
|
|
146
146
|
it( 'should not display any dirty entities when loading the site editor', async () => {
|
147
147
|
await siteEditor.visit();
|
148
|
+
await siteEditor.disableWelcomeGuide();
|
148
149
|
expect( await openEntitySavePanel() ).toBe( false );
|
149
150
|
} );
|
150
151
|
|
@@ -204,6 +205,7 @@ describe( 'Multi-entity editor states', () => {
|
|
204
205
|
);
|
205
206
|
await saveAllEntities();
|
206
207
|
await siteEditor.visit();
|
208
|
+
await siteEditor.disableWelcomeGuide();
|
207
209
|
|
208
210
|
// Wait for site editor to load.
|
209
211
|
await canvas().waitForSelector(
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
/**
|
15
15
|
* Internal dependencies
|
16
16
|
*/
|
17
|
-
import { siteEditor } from '
|
17
|
+
import { siteEditor } from './utils';
|
18
18
|
|
19
19
|
describe( 'Multi-entity save flow', () => {
|
20
20
|
// Selectors - usable between Post/Site editors.
|
@@ -244,6 +244,7 @@ describe( 'Multi-entity save flow', () => {
|
|
244
244
|
postId: 'tt1-blocks//index',
|
245
245
|
postType: 'wp_template',
|
246
246
|
} );
|
247
|
+
await siteEditor.disableWelcomeGuide();
|
247
248
|
|
248
249
|
// Select the header template part via list view.
|
249
250
|
await page.click( '.edit-site-header-toolbar__list-view-toggle' );
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
/**
|
13
13
|
* Internal dependencies
|
14
14
|
*/
|
15
|
-
import { siteEditor } from '
|
15
|
+
import { siteEditor } from './utils';
|
16
16
|
|
17
17
|
async function toggleSidebar() {
|
18
18
|
await page.click(
|
@@ -53,6 +53,7 @@ describe( 'Settings sidebar', () => {
|
|
53
53
|
} );
|
54
54
|
beforeEach( async () => {
|
55
55
|
await siteEditor.visit();
|
56
|
+
await siteEditor.disableWelcomeGuide();
|
56
57
|
} );
|
57
58
|
|
58
59
|
describe( 'Template tab', () => {
|
@@ -13,7 +13,7 @@ import { trashAllPosts, activateTheme } from '@wordpress/e2e-test-utils';
|
|
13
13
|
/**
|
14
14
|
* Internal dependencies
|
15
15
|
*/
|
16
|
-
import { siteEditor } from '
|
16
|
+
import { siteEditor } from './utils';
|
17
17
|
|
18
18
|
async function waitForFileExists( filePath, timeout = 10000 ) {
|
19
19
|
const start = Date.now();
|
@@ -41,6 +41,7 @@ describe( 'Site Editor Templates Export', () => {
|
|
41
41
|
|
42
42
|
beforeEach( async () => {
|
43
43
|
await siteEditor.visit();
|
44
|
+
await siteEditor.disableWelcomeGuide();
|
44
45
|
} );
|
45
46
|
|
46
47
|
it( 'clicking export should download edit-site-export.zip file', async () => {
|
@@ -6,7 +6,7 @@ import { trashAllPosts, activateTheme } from '@wordpress/e2e-test-utils';
|
|
6
6
|
/**
|
7
7
|
* Internal dependencies
|
8
8
|
*/
|
9
|
-
import { siteEditor } from '
|
9
|
+
import { siteEditor } from './utils';
|
10
10
|
|
11
11
|
describe( 'Site Editor Inserter', () => {
|
12
12
|
beforeAll( async () => {
|
@@ -19,6 +19,7 @@ describe( 'Site Editor Inserter', () => {
|
|
19
19
|
} );
|
20
20
|
beforeEach( async () => {
|
21
21
|
await siteEditor.visit();
|
22
|
+
await siteEditor.disableWelcomeGuide();
|
22
23
|
} );
|
23
24
|
|
24
25
|
it( 'inserter toggle button should toggle global inserter', async () => {
|
@@ -16,10 +16,10 @@ import {
|
|
16
16
|
/**
|
17
17
|
* Internal dependencies
|
18
18
|
*/
|
19
|
-
import { siteEditor } from '
|
19
|
+
import { siteEditor } from './utils';
|
20
20
|
|
21
21
|
const templatePartNameInput =
|
22
|
-
'.edit-site-template-part-
|
22
|
+
'.edit-site-create-template-part-modal .components-text-control__input';
|
23
23
|
|
24
24
|
describe( 'Template Part', () => {
|
25
25
|
beforeAll( async () => {
|
@@ -36,6 +36,7 @@ describe( 'Template Part', () => {
|
|
36
36
|
describe( 'Template part block', () => {
|
37
37
|
beforeEach( async () => {
|
38
38
|
await siteEditor.visit();
|
39
|
+
await siteEditor.disableWelcomeGuide();
|
39
40
|
} );
|
40
41
|
|
41
42
|
async function navigateToHeader() {
|
@@ -14,9 +14,13 @@ import { addQueryArgs } from '@wordpress/url';
|
|
14
14
|
/**
|
15
15
|
* Internal dependencies
|
16
16
|
*/
|
17
|
-
import { siteEditor } from '
|
17
|
+
import { siteEditor } from './utils';
|
18
18
|
|
19
|
-
const {
|
19
|
+
const {
|
20
|
+
visit: visitSiteEditor,
|
21
|
+
getEditedPostContent,
|
22
|
+
disableWelcomeGuide,
|
23
|
+
} = siteEditor;
|
20
24
|
|
21
25
|
const assertSaveButtonIsDisabled = () =>
|
22
26
|
page.waitForSelector(
|
@@ -97,6 +101,7 @@ describe( 'Template Revert', () => {
|
|
97
101
|
beforeEach( async () => {
|
98
102
|
await trashAllPosts( 'wp_template' );
|
99
103
|
await visitSiteEditor();
|
104
|
+
await disableWelcomeGuide();
|
100
105
|
} );
|
101
106
|
|
102
107
|
it( 'should delete the template after saving the reverted template', async () => {
|
@@ -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.$(
|
@@ -157,4 +123,31 @@ export const siteEditor = {
|
|
157
123
|
return '';
|
158
124
|
} );
|
159
125
|
},
|
126
|
+
|
127
|
+
async disableWelcomeGuide() {
|
128
|
+
const isWelcomeGuideActive = await page.evaluate( () =>
|
129
|
+
wp.data.select( 'core/edit-site' ).isFeatureActive( 'welcomeGuide' )
|
130
|
+
);
|
131
|
+
const isWelcomeGuideStyesActive = await page.evaluate( () =>
|
132
|
+
wp.data
|
133
|
+
.select( 'core/edit-site' )
|
134
|
+
.isFeatureActive( 'welcomeGuideStyles' )
|
135
|
+
);
|
136
|
+
|
137
|
+
if ( isWelcomeGuideActive ) {
|
138
|
+
await page.evaluate( () =>
|
139
|
+
wp.data
|
140
|
+
.dispatch( 'core/edit-site' )
|
141
|
+
.toggleFeature( 'welcomeGuide' )
|
142
|
+
);
|
143
|
+
}
|
144
|
+
|
145
|
+
if ( isWelcomeGuideStyesActive ) {
|
146
|
+
await page.evaluate( () =>
|
147
|
+
wp.data
|
148
|
+
.dispatch( 'core/edit-site' )
|
149
|
+
.toggleFeature( 'welcomeGuideStyles' )
|
150
|
+
);
|
151
|
+
}
|
152
|
+
},
|
160
153
|
};
|