@wordpress/e2e-tests 7.4.0 → 7.6.0
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/CHANGELOG.md +4 -0
- package/config/setup-test-framework.js +9 -0
- package/package.json +7 -7
- package/plugins/block-context.php +1 -1
- package/plugins/iframed-block/block.json +1 -1
- package/plugins/iframed-block.php +2 -2
- package/plugins/iframed-enqueue-block-assets.php +1 -1
- package/plugins/iframed-inline-styles/block.json +1 -1
- package/plugins/iframed-inline-styles/editor.js +1 -1
- package/plugins/iframed-inline-styles.php +3 -3
- package/plugins/iframed-masonry-block/block.json +1 -1
- package/plugins/iframed-masonry-block/editor.js +1 -1
- package/plugins/iframed-masonry-block.php +2 -2
- package/plugins/iframed-multiple-stylesheets/block.json +1 -1
- package/plugins/iframed-multiple-stylesheets/editor.js +1 -1
- package/plugins/iframed-multiple-stylesheets.php +2 -2
- package/plugins/inner-blocks-prioritized-inserter-blocks/index.js +82 -0
- package/plugins/inner-blocks-prioritized-inserter-blocks.php +28 -0
- package/plugins/marquee-function-widget.php +2 -2
- package/specs/editor/blocks/post-title.test.js +5 -4
- package/specs/editor/blocks/site-title.test.js +3 -2
- package/specs/editor/plugins/annotations.test.js +17 -9
- package/specs/editor/plugins/block-variations.test.js +6 -5
- package/specs/editor/plugins/child-blocks.test.js +2 -1
- package/specs/editor/plugins/cpt-locking.test.js +15 -12
- package/specs/editor/plugins/iframed-inline-styles.test.js +7 -4
- package/specs/editor/plugins/iframed-masonry-block.test.js +1 -1
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +1 -1
- package/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +10 -8
- package/specs/editor/plugins/inner-blocks-prioritized-inserter-blocks.test.js +132 -0
- package/specs/editor/various/__snapshots__/links.test.js.snap +0 -24
- package/specs/editor/various/adding-inline-tokens.test.js +0 -1
- package/specs/editor/various/autosave.test.js +2 -1
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +3 -2
- package/specs/editor/various/block-grouping.test.js +5 -4
- package/specs/editor/various/block-hierarchy-navigation.test.js +12 -9
- package/specs/editor/various/change-detection.test.js +20 -19
- package/specs/editor/various/editor-modes.test.js +7 -6
- package/specs/editor/various/embedding.test.js +21 -15
- package/specs/editor/various/inserting-blocks.test.js +19 -14
- package/specs/editor/various/invalid-block.test.js +4 -6
- package/specs/editor/various/keyboard-navigable-blocks.test.js +16 -17
- package/specs/editor/various/links.test.js +22 -154
- package/specs/editor/various/navigable-toolbar.test.js +14 -14
- package/specs/editor/various/nux.test.js +6 -2
- package/specs/editor/various/publish-button.test.js +3 -2
- package/specs/editor/various/publish-panel.test.js +4 -3
- package/specs/editor/various/publishing.test.js +9 -5
- package/specs/editor/various/reusable-blocks.test.js +22 -18
- package/specs/editor/various/rich-text.test.js +7 -6
- package/specs/editor/various/sidebar-permalink.test.js +4 -3
- package/specs/editor/various/taxonomies.test.js +4 -3
- package/specs/editor/various/typewriter.test.js +68 -50
- package/specs/performance/site-editor.test.js +2 -1
- package/specs/site-editor/settings-sidebar.test.js +2 -2
- package/specs/editor/blocks/cover.test.js +0 -177
@@ -1,177 +0,0 @@
|
|
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
|
-
|
9
|
-
/**
|
10
|
-
* WordPress dependencies
|
11
|
-
*/
|
12
|
-
import {
|
13
|
-
insertBlock,
|
14
|
-
createNewPost,
|
15
|
-
openDocumentSettingsSidebar,
|
16
|
-
switchBlockInspectorTab,
|
17
|
-
transformBlockTo,
|
18
|
-
} from '@wordpress/e2e-test-utils';
|
19
|
-
|
20
|
-
async function upload( selector ) {
|
21
|
-
const inputElement = await page.waitForSelector(
|
22
|
-
`${ selector } input[type="file"]`
|
23
|
-
);
|
24
|
-
const testImagePath = path.join(
|
25
|
-
__dirname,
|
26
|
-
'..',
|
27
|
-
'..',
|
28
|
-
'..',
|
29
|
-
'assets',
|
30
|
-
'10x10_e2e_test_image_z9T8jK.png'
|
31
|
-
);
|
32
|
-
const filename = uuid();
|
33
|
-
const tmpFileName = path.join( os.tmpdir(), filename + '.png' );
|
34
|
-
fs.copyFileSync( testImagePath, tmpFileName );
|
35
|
-
await inputElement.uploadFile( tmpFileName );
|
36
|
-
await page.waitForSelector( `${ selector } img[src$="${ filename }.png"]` );
|
37
|
-
return filename;
|
38
|
-
}
|
39
|
-
|
40
|
-
describe( 'Cover', () => {
|
41
|
-
beforeEach( async () => {
|
42
|
-
await createNewPost();
|
43
|
-
} );
|
44
|
-
|
45
|
-
it( 'can set background image using image upload on block placeholder', async () => {
|
46
|
-
await insertBlock( 'Cover' );
|
47
|
-
// Create the block using uploaded image.
|
48
|
-
const sourceImageFilename = await upload( '.wp-block-cover' );
|
49
|
-
// Get the block's background image URL.
|
50
|
-
const blockImage = await page.waitForSelector( '.wp-block-cover img' );
|
51
|
-
const blockImageUrl = await blockImage.evaluate( ( el ) => el.src );
|
52
|
-
|
53
|
-
expect( blockImageUrl ).toContain( sourceImageFilename );
|
54
|
-
} );
|
55
|
-
|
56
|
-
it( 'dims background image down by 50% by default', async () => {
|
57
|
-
await insertBlock( 'Cover' );
|
58
|
-
// Create the block using uploaded image.
|
59
|
-
await upload( '.wp-block-cover' );
|
60
|
-
// Get the block's background dim color and its opacity.
|
61
|
-
const backgroundDim = await page.waitForSelector(
|
62
|
-
'.wp-block-cover .has-background-dim'
|
63
|
-
);
|
64
|
-
const [ backgroundDimColor, backgroundDimOpacity ] =
|
65
|
-
await page.evaluate( ( el ) => {
|
66
|
-
const computedStyle = window.getComputedStyle( el );
|
67
|
-
return [ computedStyle.backgroundColor, computedStyle.opacity ];
|
68
|
-
}, backgroundDim );
|
69
|
-
|
70
|
-
expect( backgroundDimColor ).toBe( 'rgb(0, 0, 0)' );
|
71
|
-
expect( backgroundDimOpacity ).toBe( '0.5' );
|
72
|
-
} );
|
73
|
-
|
74
|
-
it( 'can be resized using drag & drop', async () => {
|
75
|
-
await insertBlock( 'Cover' );
|
76
|
-
// Close the inserter.
|
77
|
-
await page.click( '.edit-post-header-toolbar__inserter-toggle' );
|
78
|
-
// Open the sidebar.
|
79
|
-
await openDocumentSettingsSidebar();
|
80
|
-
// Choose the first solid color as the background of the cover.
|
81
|
-
await page.click(
|
82
|
-
'.components-circular-option-picker__option-wrapper:first-child button'
|
83
|
-
);
|
84
|
-
|
85
|
-
// Select the cover block. By default the child paragraph gets selected.
|
86
|
-
await page.click(
|
87
|
-
'.edit-post-header-toolbar__document-overview-toggle'
|
88
|
-
);
|
89
|
-
await page.click(
|
90
|
-
'.block-editor-list-view-block__contents-container a'
|
91
|
-
);
|
92
|
-
|
93
|
-
switchBlockInspectorTab( 'Styles' );
|
94
|
-
const heightInputHandle = await page.waitForSelector(
|
95
|
-
'input[id*="block-cover-height-input"]'
|
96
|
-
);
|
97
|
-
|
98
|
-
// Verify the height of the cover is not defined.
|
99
|
-
expect(
|
100
|
-
await page.evaluate( ( { value } ) => value, heightInputHandle )
|
101
|
-
).toBe( '' );
|
102
|
-
|
103
|
-
const resizeButton = await page.$(
|
104
|
-
'.components-resizable-box__handle-bottom'
|
105
|
-
);
|
106
|
-
const boundingBoxResizeButton = await resizeButton.boundingBox();
|
107
|
-
const coordinatesResizeButton = {
|
108
|
-
x: boundingBoxResizeButton.x + boundingBoxResizeButton.width / 2,
|
109
|
-
y: boundingBoxResizeButton.y + boundingBoxResizeButton.height / 2,
|
110
|
-
};
|
111
|
-
|
112
|
-
// Move the mouse to the position of the resize button.
|
113
|
-
await page.mouse.move(
|
114
|
-
coordinatesResizeButton.x,
|
115
|
-
coordinatesResizeButton.y
|
116
|
-
);
|
117
|
-
|
118
|
-
// Trigger a mousedown event against the resize button.
|
119
|
-
// Using page.mouse.down does not works because it triggers a global event,
|
120
|
-
// not an event for that element.
|
121
|
-
page.evaluate( ( { x, y } ) => {
|
122
|
-
const element = document.querySelector(
|
123
|
-
'.components-resizable-box__handle-bottom'
|
124
|
-
);
|
125
|
-
event = document.createEvent( 'CustomEvent' );
|
126
|
-
event.initCustomEvent( 'mousedown', true, true, null );
|
127
|
-
event.clientX = x;
|
128
|
-
event.clientY = y;
|
129
|
-
element.dispatchEvent( event );
|
130
|
-
}, coordinatesResizeButton );
|
131
|
-
|
132
|
-
// Move the mouse to resize the cover.
|
133
|
-
await page.mouse.move(
|
134
|
-
coordinatesResizeButton.x,
|
135
|
-
coordinatesResizeButton.y + 100,
|
136
|
-
{ steps: 10 }
|
137
|
-
);
|
138
|
-
|
139
|
-
// Release the mouse.
|
140
|
-
await page.mouse.up();
|
141
|
-
|
142
|
-
// Verify the height of the cover has changed.
|
143
|
-
expect(
|
144
|
-
await page.evaluate(
|
145
|
-
( { value } ) => Number.parseInt( value ),
|
146
|
-
heightInputHandle
|
147
|
-
)
|
148
|
-
).toBeGreaterThan( 100 );
|
149
|
-
} );
|
150
|
-
|
151
|
-
it( 'dims the background image down by 50% when transformed from the Image block', async () => {
|
152
|
-
await insertBlock( 'Image' );
|
153
|
-
// Upload image and transform to the Cover block.
|
154
|
-
const filename = await upload( '.wp-block-image' );
|
155
|
-
await page.waitForSelector(
|
156
|
-
`.wp-block-image img[src$="${ filename }.png"]`
|
157
|
-
);
|
158
|
-
|
159
|
-
// Focus the block wrapper before trying to convert to make sure figcaption toolbar is not obscuring
|
160
|
-
// the block toolbar.
|
161
|
-
await page.focus( '.wp-block-image' );
|
162
|
-
await transformBlockTo( 'Cover' );
|
163
|
-
|
164
|
-
// Get the block's background dim color and its opacity.
|
165
|
-
const backgroundDim = await page.waitForSelector(
|
166
|
-
'.wp-block-cover .has-background-dim'
|
167
|
-
);
|
168
|
-
const [ backgroundDimColor, backgroundDimOpacity ] =
|
169
|
-
await page.evaluate( ( el ) => {
|
170
|
-
const computedStyle = window.getComputedStyle( el );
|
171
|
-
return [ computedStyle.backgroundColor, computedStyle.opacity ];
|
172
|
-
}, backgroundDim );
|
173
|
-
|
174
|
-
expect( backgroundDimColor ).toBe( 'rgb(0, 0, 0)' );
|
175
|
-
expect( backgroundDimOpacity ).toBe( '0.5' );
|
176
|
-
} );
|
177
|
-
} );
|