@wordpress/e2e-tests 2.5.6 → 2.5.7
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/experimental-features.js +27 -0
- package/package.json +3 -3
- package/specs/editor/blocks/cover.test.js +127 -0
- package/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +2 -0
- package/specs/experiments/document-settings.test.js +1 -0
- package/specs/experiments/multi-entity-editing.test.js +2 -0
- package/specs/experiments/multi-entity-saving.test.js +1 -0
- package/specs/experiments/settings-sidebar.test.js +1 -0
- package/specs/experiments/site-editor-export.test.js +1 -0
- package/specs/experiments/site-editor-inserter.test.js +1 -0
- package/specs/experiments/template-part.test.js +2 -1
- package/specs/experiments/template-revert.test.js +6 -1
- package/specs/performance/site-editor.test.js +1 -0
package/experimental-features.js
CHANGED
@@ -157,4 +157,31 @@ export const siteEditor = {
|
|
157
157
|
return '';
|
158
158
|
} );
|
159
159
|
},
|
160
|
+
|
161
|
+
async disableWelcomeGuide() {
|
162
|
+
const isWelcomeGuideActive = await page.evaluate( () =>
|
163
|
+
wp.data.select( 'core/edit-site' ).isFeatureActive( 'welcomeGuide' )
|
164
|
+
);
|
165
|
+
const isWelcomeGuideStyesActive = await page.evaluate( () =>
|
166
|
+
wp.data
|
167
|
+
.select( 'core/edit-site' )
|
168
|
+
.isFeatureActive( 'welcomeGuideStyles' )
|
169
|
+
);
|
170
|
+
|
171
|
+
if ( isWelcomeGuideActive ) {
|
172
|
+
await page.evaluate( () =>
|
173
|
+
wp.data
|
174
|
+
.dispatch( 'core/edit-site' )
|
175
|
+
.toggleFeature( 'welcomeGuide' )
|
176
|
+
);
|
177
|
+
}
|
178
|
+
|
179
|
+
if ( isWelcomeGuideStyesActive ) {
|
180
|
+
await page.evaluate( () =>
|
181
|
+
wp.data
|
182
|
+
.dispatch( 'core/edit-site' )
|
183
|
+
.toggleFeature( 'welcomeGuideStyles' )
|
184
|
+
);
|
185
|
+
}
|
186
|
+
},
|
160
187
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "2.5.
|
3
|
+
"version": "2.5.7",
|
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.8",
|
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": "ca22e8852fcc91889510e417bdaa180ad60f8dac"
|
47
47
|
}
|
@@ -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
|
} );
|
@@ -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.
|
@@ -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(
|
@@ -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' );
|
@@ -19,7 +19,7 @@ import {
|
|
19
19
|
import { siteEditor } from '../../experimental-features';
|
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() {
|
@@ -16,7 +16,11 @@ import { addQueryArgs } from '@wordpress/url';
|
|
16
16
|
*/
|
17
17
|
import { siteEditor } from '../../experimental-features';
|
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 () => {
|