@wordpress/e2e-tests 7.17.0 → 7.18.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 +2 -0
- package/package.json +8 -7
- package/plugins/block-icons/index.js +1 -1
- package/plugins/dataviews.php +25 -0
- package/plugins/interactive-blocks/directive-bind/render.php +3 -1
- package/plugins/interactive-blocks/directive-bind/view.js +32 -29
- package/plugins/interactive-blocks/directive-body/render.php +3 -1
- package/plugins/interactive-blocks/directive-body/view.js +11 -9
- package/plugins/interactive-blocks/directive-class/render.php +3 -1
- package/plugins/interactive-blocks/directive-class/view.js +20 -18
- package/plugins/interactive-blocks/directive-context/render.php +6 -4
- package/plugins/interactive-blocks/directive-context/view.js +49 -40
- package/plugins/interactive-blocks/directive-init/render.php +8 -6
- package/plugins/interactive-blocks/directive-init/view.js +59 -60
- package/plugins/interactive-blocks/directive-key/render.php +5 -1
- package/plugins/interactive-blocks/directive-key/view.js +18 -14
- package/plugins/interactive-blocks/directive-on/render.php +3 -1
- package/plugins/interactive-blocks/directive-on/view.js +27 -24
- package/plugins/interactive-blocks/directive-priorities/render.php +7 -2
- package/plugins/interactive-blocks/directive-priorities/view.js +107 -111
- package/plugins/interactive-blocks/directive-slots/render.php +3 -1
- package/plugins/interactive-blocks/directive-slots/view.js +17 -15
- package/plugins/interactive-blocks/directive-style/render.php +2 -1
- package/plugins/interactive-blocks/directive-style/view.js +21 -19
- package/plugins/interactive-blocks/directive-text/render.php +3 -1
- package/plugins/interactive-blocks/directive-text/view.js +16 -14
- package/plugins/interactive-blocks/{store-afterload → directive-watch}/block.json +3 -3
- package/plugins/interactive-blocks/{directive-effect → directive-watch}/render.php +8 -6
- package/plugins/interactive-blocks/directive-watch/view.js +53 -0
- package/plugins/interactive-blocks/negation-operator/render.php +4 -2
- package/plugins/interactive-blocks/negation-operator/view.js +15 -19
- package/plugins/interactive-blocks/router-navigate/render.php +11 -8
- package/plugins/interactive-blocks/router-navigate/view.js +27 -34
- package/plugins/interactive-blocks/router-regions/render.php +13 -3
- package/plugins/interactive-blocks/router-regions/view.js +37 -35
- package/plugins/interactive-blocks/store-tag/render.php +7 -4
- package/plugins/interactive-blocks/store-tag/view.js +19 -19
- package/plugins/interactive-blocks/tovdom/render.php +3 -1
- package/plugins/interactive-blocks/tovdom/view.js +5 -4
- package/plugins/interactive-blocks/tovdom-islands/render.php +11 -6
- package/plugins/interactive-blocks/tovdom-islands/view.js +24 -23
- package/plugins/interactive-blocks.php +2 -2
- package/specs/editor/various/datepicker.test.js +8 -8
- package/specs/editor/various/pattern-blocks.test.js +4 -4
- package/specs/editor/various/scheduling.test.js +1 -1
- package/plugins/interactive-blocks/directive-effect/block.json +0 -14
- package/plugins/interactive-blocks/directive-effect/view.js +0 -59
- package/plugins/interactive-blocks/store-afterload/render.php +0 -41
- package/plugins/interactive-blocks/store-afterload/view.js +0 -60
- package/specs/editor/plugins/__snapshots__/align-hook.test.js.snap +0 -43
- package/specs/editor/plugins/__snapshots__/block-directory-add.test.js.snap +0 -3
- package/specs/editor/plugins/align-hook.test.js +0 -234
- package/specs/editor/plugins/block-directory-add.test.js +0 -205
- package/specs/editor/plugins/block-icons.test.js +0 -170
- package/specs/editor/plugins/custom-taxonomies.test.js +0 -61
- package/specs/editor/various/is-typing.test.js +0 -101
- package/specs/editor/various/sidebar-permalink.test.js +0 -53
@@ -1,170 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
insertBlock,
|
9
|
-
pressKeyWithModifier,
|
10
|
-
searchForBlock,
|
11
|
-
openDocumentSettingsSidebar,
|
12
|
-
} from '@wordpress/e2e-test-utils';
|
13
|
-
|
14
|
-
const INSERTER_BUTTON_SELECTOR =
|
15
|
-
'.block-editor-inserter__main-area .block-editor-block-types-list__item';
|
16
|
-
const INSERTER_ICON_WRAPPER_SELECTOR = `${ INSERTER_BUTTON_SELECTOR } .block-editor-block-types-list__item-icon`;
|
17
|
-
const INSERTER_ICON_SELECTOR = `${ INSERTER_BUTTON_SELECTOR } .block-editor-block-icon`;
|
18
|
-
const INSPECTOR_ICON_SELECTOR = '.edit-post-sidebar .block-editor-block-icon';
|
19
|
-
|
20
|
-
async function getInnerHTML( selector ) {
|
21
|
-
return await page.$eval( selector, ( element ) => element.innerHTML );
|
22
|
-
}
|
23
|
-
|
24
|
-
async function getBackgroundColor( selector ) {
|
25
|
-
return await page.$eval( selector, ( element ) => {
|
26
|
-
return window.getComputedStyle( element ).backgroundColor;
|
27
|
-
} );
|
28
|
-
}
|
29
|
-
|
30
|
-
async function getColor( selector ) {
|
31
|
-
return await page.$eval( selector, ( element ) => {
|
32
|
-
return window.getComputedStyle( element ).color;
|
33
|
-
} );
|
34
|
-
}
|
35
|
-
|
36
|
-
async function getFirstInserterIcon() {
|
37
|
-
return await getInnerHTML( INSERTER_ICON_SELECTOR );
|
38
|
-
}
|
39
|
-
|
40
|
-
async function selectFirstBlock() {
|
41
|
-
await pressKeyWithModifier( 'access', 'o' );
|
42
|
-
const navButtons = await page.$$(
|
43
|
-
'.block-editor-list-view-block-select-button'
|
44
|
-
);
|
45
|
-
await navButtons[ 0 ].click();
|
46
|
-
}
|
47
|
-
|
48
|
-
describe( 'Correctly Renders Block Icons on Inserter and Inspector', () => {
|
49
|
-
const dashIconRegex = /<span.*?class=".*?dashicons-cart.*?">.*?<\/span>/;
|
50
|
-
const circleString =
|
51
|
-
'<circle cx="10" cy="10" r="10" fill="red" stroke="blue" stroke-width="10"></circle>';
|
52
|
-
const svgIcon = new RegExp(
|
53
|
-
`<svg.*?viewBox="0 0 20 20".*?>${ circleString }</svg>`
|
54
|
-
);
|
55
|
-
|
56
|
-
const validateSvgIcon = ( iconHtml ) => {
|
57
|
-
expect( iconHtml ).toMatch( svgIcon );
|
58
|
-
};
|
59
|
-
|
60
|
-
const validateDashIcon = ( iconHtml ) => {
|
61
|
-
expect( iconHtml ).toMatch( dashIconRegex );
|
62
|
-
};
|
63
|
-
|
64
|
-
beforeAll( async () => {
|
65
|
-
await activatePlugin( 'gutenberg-test-block-icons' );
|
66
|
-
} );
|
67
|
-
|
68
|
-
beforeEach( async () => {
|
69
|
-
await createNewPost();
|
70
|
-
} );
|
71
|
-
|
72
|
-
afterAll( async () => {
|
73
|
-
await deactivatePlugin( 'gutenberg-test-block-icons' );
|
74
|
-
} );
|
75
|
-
|
76
|
-
function testIconsOfBlock( blockName, blockTitle, validateIcon ) {
|
77
|
-
it( 'Renders correctly the icon in the inserter', async () => {
|
78
|
-
await searchForBlock( blockTitle );
|
79
|
-
validateIcon( await getFirstInserterIcon() );
|
80
|
-
} );
|
81
|
-
|
82
|
-
it( 'Can insert the block', async () => {
|
83
|
-
await insertBlock( blockTitle );
|
84
|
-
expect(
|
85
|
-
await getInnerHTML(
|
86
|
-
`[data-type="${ blockName }"] [data-type="core/paragraph"]`
|
87
|
-
)
|
88
|
-
).toEqual( blockTitle );
|
89
|
-
} );
|
90
|
-
|
91
|
-
it( 'Renders correctly the icon on the inspector', async () => {
|
92
|
-
await insertBlock( blockTitle );
|
93
|
-
await openDocumentSettingsSidebar();
|
94
|
-
await selectFirstBlock();
|
95
|
-
validateIcon( await getInnerHTML( INSPECTOR_ICON_SELECTOR ) );
|
96
|
-
} );
|
97
|
-
}
|
98
|
-
|
99
|
-
describe( 'Block with svg icon', () => {
|
100
|
-
const blockName = 'test/test-single-svg-icon';
|
101
|
-
const blockTitle = 'TestSimpleSvgIcon';
|
102
|
-
testIconsOfBlock( blockName, blockTitle, validateSvgIcon );
|
103
|
-
} );
|
104
|
-
|
105
|
-
describe( 'Block with dash icon', () => {
|
106
|
-
const blockName = 'test/test-dash-icon';
|
107
|
-
const blockTitle = 'TestDashIcon';
|
108
|
-
testIconsOfBlock( blockName, blockTitle, validateDashIcon );
|
109
|
-
} );
|
110
|
-
|
111
|
-
describe( 'Block with function icon', () => {
|
112
|
-
const blockName = 'test/test-function-icon';
|
113
|
-
const blockTitle = 'TestFunctionIcon';
|
114
|
-
testIconsOfBlock( blockName, blockTitle, validateSvgIcon );
|
115
|
-
} );
|
116
|
-
|
117
|
-
describe( 'Block with dash icon and background and foreground colors', () => {
|
118
|
-
const blockTitle = 'TestDashIconColors';
|
119
|
-
it( 'Renders the icon in the inserter with the correct colors', async () => {
|
120
|
-
await searchForBlock( blockTitle );
|
121
|
-
validateDashIcon( await getFirstInserterIcon() );
|
122
|
-
expect(
|
123
|
-
await getBackgroundColor( INSERTER_ICON_WRAPPER_SELECTOR )
|
124
|
-
).toEqual( 'rgb(1, 0, 0)' );
|
125
|
-
expect( await getColor( INSERTER_ICON_WRAPPER_SELECTOR ) ).toEqual(
|
126
|
-
'rgb(254, 0, 0)'
|
127
|
-
);
|
128
|
-
} );
|
129
|
-
|
130
|
-
it( 'Renders the icon in the inspector with the correct colors', async () => {
|
131
|
-
await insertBlock( blockTitle );
|
132
|
-
await openDocumentSettingsSidebar();
|
133
|
-
await selectFirstBlock();
|
134
|
-
validateDashIcon( await getInnerHTML( INSPECTOR_ICON_SELECTOR ) );
|
135
|
-
expect(
|
136
|
-
await getBackgroundColor( INSPECTOR_ICON_SELECTOR )
|
137
|
-
).toEqual( 'rgb(1, 0, 0)' );
|
138
|
-
expect( await getColor( INSPECTOR_ICON_SELECTOR ) ).toEqual(
|
139
|
-
'rgb(254, 0, 0)'
|
140
|
-
);
|
141
|
-
} );
|
142
|
-
} );
|
143
|
-
|
144
|
-
describe( 'Block with svg icon and background color', () => {
|
145
|
-
const blockTitle = 'TestSvgIconBackground';
|
146
|
-
it( 'Renders the icon in the inserter with the correct background color and an automatically compute readable foreground color', async () => {
|
147
|
-
await searchForBlock( blockTitle );
|
148
|
-
validateSvgIcon( await getFirstInserterIcon() );
|
149
|
-
expect(
|
150
|
-
await getBackgroundColor( INSERTER_ICON_WRAPPER_SELECTOR )
|
151
|
-
).toEqual( 'rgb(1, 0, 0)' );
|
152
|
-
expect( await getColor( INSERTER_ICON_WRAPPER_SELECTOR ) ).toEqual(
|
153
|
-
'rgb(248, 249, 249)'
|
154
|
-
);
|
155
|
-
} );
|
156
|
-
|
157
|
-
it( 'Renders correctly the icon on the inspector', async () => {
|
158
|
-
await insertBlock( blockTitle );
|
159
|
-
await openDocumentSettingsSidebar();
|
160
|
-
await selectFirstBlock();
|
161
|
-
validateSvgIcon( await getInnerHTML( INSPECTOR_ICON_SELECTOR ) );
|
162
|
-
expect(
|
163
|
-
await getBackgroundColor( INSPECTOR_ICON_SELECTOR )
|
164
|
-
).toEqual( 'rgb(1, 0, 0)' );
|
165
|
-
expect( await getColor( INSPECTOR_ICON_SELECTOR ) ).toEqual(
|
166
|
-
'rgb(248, 249, 249)'
|
167
|
-
);
|
168
|
-
} );
|
169
|
-
} );
|
170
|
-
} );
|
@@ -1,61 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
findSidebarPanelWithTitle,
|
9
|
-
openDocumentSettingsSidebar,
|
10
|
-
} from '@wordpress/e2e-test-utils';
|
11
|
-
|
12
|
-
describe( 'Custom Taxonomies labels are used', () => {
|
13
|
-
beforeAll( async () => {
|
14
|
-
await activatePlugin( 'gutenberg-test-custom-taxonomies' );
|
15
|
-
} );
|
16
|
-
|
17
|
-
beforeEach( async () => {
|
18
|
-
await createNewPost();
|
19
|
-
} );
|
20
|
-
|
21
|
-
afterAll( async () => {
|
22
|
-
await deactivatePlugin( 'gutenberg-test-custom-taxonomies' );
|
23
|
-
} );
|
24
|
-
|
25
|
-
it( 'Ensures the custom taxonomy labels are respected', async () => {
|
26
|
-
// Open the Setting sidebar.
|
27
|
-
await openDocumentSettingsSidebar();
|
28
|
-
|
29
|
-
const openButton = await findSidebarPanelWithTitle( 'Model' );
|
30
|
-
expect( openButton ).not.toBeFalsy();
|
31
|
-
|
32
|
-
// Get the classes from the panel.
|
33
|
-
const buttonClassName = await (
|
34
|
-
await openButton.getProperty( 'className' )
|
35
|
-
).jsonValue();
|
36
|
-
|
37
|
-
// Open the panel if needed.
|
38
|
-
if ( -1 === buttonClassName.indexOf( 'is-opened' ) ) {
|
39
|
-
await openButton.click();
|
40
|
-
}
|
41
|
-
|
42
|
-
// Check the add new button.
|
43
|
-
const labelNew = await page.$x(
|
44
|
-
"//label[@class='components-form-token-field__label' and contains(text(), 'Add New Model')]"
|
45
|
-
);
|
46
|
-
expect( labelNew ).not.toBeFalsy();
|
47
|
-
|
48
|
-
// Fill with one entry.
|
49
|
-
await page.type(
|
50
|
-
'input.components-form-token-field__input',
|
51
|
-
'Model 1'
|
52
|
-
);
|
53
|
-
await page.keyboard.press( 'Enter' );
|
54
|
-
|
55
|
-
// Check the "Remove Model"
|
56
|
-
const value = await page.$x(
|
57
|
-
"//div[@class='components-form-token-field__input-container']//span//button[@aria-label='Remove Model']"
|
58
|
-
);
|
59
|
-
expect( value ).not.toBeFalsy();
|
60
|
-
} );
|
61
|
-
} );
|
@@ -1,101 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
clickBlockAppender,
|
6
|
-
createNewPost,
|
7
|
-
showBlockToolbar,
|
8
|
-
} from '@wordpress/e2e-test-utils';
|
9
|
-
|
10
|
-
describe( 'isTyping', () => {
|
11
|
-
beforeEach( async () => {
|
12
|
-
await createNewPost();
|
13
|
-
} );
|
14
|
-
|
15
|
-
it( 'should hide the toolbar when typing', async () => {
|
16
|
-
const blockToolbarSelector = '.block-editor-block-toolbar';
|
17
|
-
|
18
|
-
await clickBlockAppender();
|
19
|
-
|
20
|
-
// Type in a paragraph.
|
21
|
-
await page.keyboard.type( 'Type' );
|
22
|
-
|
23
|
-
// Toolbar is hidden
|
24
|
-
let blockToolbar = await page.$( blockToolbarSelector );
|
25
|
-
expect( blockToolbar ).toBe( null );
|
26
|
-
|
27
|
-
// Moving the mouse shows the toolbar.
|
28
|
-
await showBlockToolbar();
|
29
|
-
|
30
|
-
// Toolbar is visible.
|
31
|
-
blockToolbar = await page.$( blockToolbarSelector );
|
32
|
-
expect( blockToolbar ).not.toBe( null );
|
33
|
-
|
34
|
-
// Typing again hides the toolbar
|
35
|
-
await page.keyboard.type( ' and continue' );
|
36
|
-
|
37
|
-
// Toolbar is hidden again
|
38
|
-
blockToolbar = await page.$( blockToolbarSelector );
|
39
|
-
expect( blockToolbar ).toBe( null );
|
40
|
-
} );
|
41
|
-
|
42
|
-
it( 'should not close the dropdown when typing in it', async () => {
|
43
|
-
// Adds a Dropdown with an input to all blocks.
|
44
|
-
await page.evaluate( () => {
|
45
|
-
const { Dropdown, ToolbarButton, Fill } = wp.components;
|
46
|
-
const { createElement: el, Fragment } = wp.element;
|
47
|
-
function AddDropdown( BlockListBlock ) {
|
48
|
-
return ( props ) => {
|
49
|
-
return el(
|
50
|
-
Fragment,
|
51
|
-
{},
|
52
|
-
el(
|
53
|
-
Fill,
|
54
|
-
{ name: 'BlockControls' },
|
55
|
-
el( Dropdown, {
|
56
|
-
renderToggle: ( { onToggle } ) =>
|
57
|
-
el(
|
58
|
-
ToolbarButton,
|
59
|
-
{
|
60
|
-
onClick: onToggle,
|
61
|
-
className: 'dropdown-open',
|
62
|
-
},
|
63
|
-
'Open Dropdown'
|
64
|
-
),
|
65
|
-
renderContent: () =>
|
66
|
-
el( 'input', {
|
67
|
-
className: 'dropdown-input',
|
68
|
-
} ),
|
69
|
-
} )
|
70
|
-
),
|
71
|
-
el( BlockListBlock, props )
|
72
|
-
);
|
73
|
-
};
|
74
|
-
}
|
75
|
-
|
76
|
-
wp.hooks.addFilter(
|
77
|
-
'editor.BlockListBlock',
|
78
|
-
'e2e-test/add-dropdown',
|
79
|
-
AddDropdown
|
80
|
-
);
|
81
|
-
} );
|
82
|
-
|
83
|
-
await clickBlockAppender();
|
84
|
-
|
85
|
-
// Type in a paragraph.
|
86
|
-
await page.keyboard.type( 'Type' );
|
87
|
-
|
88
|
-
// Show Toolbar.
|
89
|
-
await showBlockToolbar();
|
90
|
-
|
91
|
-
// Open the dropdown.
|
92
|
-
await page.click( '.dropdown-open' );
|
93
|
-
|
94
|
-
// Type inside the dropdown's input
|
95
|
-
await page.type( '.dropdown-input', 'Random' );
|
96
|
-
|
97
|
-
// The input should still be visible.
|
98
|
-
const input = await page.$( '.dropdown-input' );
|
99
|
-
expect( input ).not.toBe( null );
|
100
|
-
} );
|
101
|
-
} );
|
@@ -1,53 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
publishPost,
|
9
|
-
canvas,
|
10
|
-
} from '@wordpress/e2e-test-utils';
|
11
|
-
|
12
|
-
const urlButtonSelector = '*[aria-label^="Change URL"]';
|
13
|
-
|
14
|
-
// This tests are not together with the remaining sidebar tests,
|
15
|
-
// because we need to publish/save a post, to correctly test the permalink row.
|
16
|
-
// The sidebar test suit enforces that focus is never lost, but during save operations
|
17
|
-
// the focus is lost and a new element is focused once the save is completed.
|
18
|
-
describe( 'Sidebar Permalink', () => {
|
19
|
-
beforeAll( async () => {
|
20
|
-
await activatePlugin( 'gutenberg-test-custom-post-types' );
|
21
|
-
} );
|
22
|
-
|
23
|
-
afterAll( async () => {
|
24
|
-
await deactivatePlugin( 'gutenberg-test-custom-post-types' );
|
25
|
-
} );
|
26
|
-
|
27
|
-
it( 'should not render URL when post is publicly queryable but not public', async () => {
|
28
|
-
await createNewPost( { postType: 'public_q_not_public' } );
|
29
|
-
await page.keyboard.type( 'aaaaa' );
|
30
|
-
await publishPost();
|
31
|
-
// Start editing again.
|
32
|
-
await canvas().type( '.editor-post-title__input', ' (Updated)' );
|
33
|
-
expect( await page.$( urlButtonSelector ) ).toBeNull();
|
34
|
-
} );
|
35
|
-
|
36
|
-
it( 'should not render URL when post is public but not publicly queryable', async () => {
|
37
|
-
await createNewPost( { postType: 'not_public_q_public' } );
|
38
|
-
await page.keyboard.type( 'aaaaa' );
|
39
|
-
await publishPost();
|
40
|
-
// Start editing again.
|
41
|
-
await canvas().type( '.editor-post-title__input', ' (Updated)' );
|
42
|
-
expect( await page.$( urlButtonSelector ) ).toBeNull();
|
43
|
-
} );
|
44
|
-
|
45
|
-
it( 'should render URL when post is public and publicly queryable', async () => {
|
46
|
-
await createNewPost( { postType: 'public_q_public' } );
|
47
|
-
await page.keyboard.type( 'aaaaa' );
|
48
|
-
await publishPost();
|
49
|
-
// Start editing again.
|
50
|
-
await canvas( 0 ).type( '.editor-post-title__input', ' (Updated)' );
|
51
|
-
expect( await page.$( urlButtonSelector ) ).not.toBeNull();
|
52
|
-
} );
|
53
|
-
} );
|