@wordpress/e2e-tests 7.16.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 +4 -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 +4 -4
- 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/__snapshots__/container-blocks.test.js.snap +0 -58
- package/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +0 -147
- package/specs/editor/plugins/__snapshots__/inner-blocks-render-appender.test.js.snap +0 -25
- package/specs/editor/plugins/__snapshots__/meta-attribute-block.test.js.snap +0 -9
- package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +0 -7
- package/specs/editor/plugins/align-hook.test.js +0 -234
- package/specs/editor/plugins/annotations.test.js +0 -189
- 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/child-blocks.test.js +0 -66
- package/specs/editor/plugins/container-blocks.test.js +0 -130
- package/specs/editor/plugins/cpt-locking.test.js +0 -251
- package/specs/editor/plugins/custom-taxonomies.test.js +0 -61
- package/specs/editor/plugins/inner-blocks-prioritized-inserter-blocks.test.js +0 -132
- package/specs/editor/plugins/inner-blocks-render-appender.test.js +0 -126
- package/specs/editor/plugins/meta-attribute-block.test.js +0 -100
- package/specs/editor/plugins/meta-boxes.test.js +0 -137
- package/specs/editor/plugins/plugins-api.test.js +0 -189
- package/specs/editor/various/is-typing.test.js +0 -101
- package/specs/editor/various/publish-button.test.js +0 -46
- package/specs/editor/various/sidebar-permalink.test.js +0 -53
@@ -1,100 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
getEditedPostContent,
|
9
|
-
insertBlock,
|
10
|
-
saveDraft,
|
11
|
-
pressKeyTimes,
|
12
|
-
} from '@wordpress/e2e-test-utils';
|
13
|
-
|
14
|
-
describe( 'Block with a meta attribute', () => {
|
15
|
-
beforeAll( async () => {
|
16
|
-
await activatePlugin( 'gutenberg-test-meta-attribute-block' );
|
17
|
-
} );
|
18
|
-
|
19
|
-
beforeEach( async () => {
|
20
|
-
await createNewPost();
|
21
|
-
} );
|
22
|
-
|
23
|
-
afterAll( async () => {
|
24
|
-
await deactivatePlugin( 'gutenberg-test-meta-attribute-block' );
|
25
|
-
} );
|
26
|
-
|
27
|
-
describe.each( [ [ 'Early Registration' ], [ 'Late Registration' ] ] )(
|
28
|
-
'%s',
|
29
|
-
( variant ) => {
|
30
|
-
it( 'Should persist the meta attribute properly', async () => {
|
31
|
-
await insertBlock( `Test Meta Attribute Block (${ variant })` );
|
32
|
-
await page.keyboard.type( 'Value' );
|
33
|
-
|
34
|
-
// Regression Test: Previously the caret would wrongly reset to the end
|
35
|
-
// of any input for meta-sourced attributes, due to syncing behavior of
|
36
|
-
// meta attribute updates.
|
37
|
-
//
|
38
|
-
// See: https://github.com/WordPress/gutenberg/issues/15739
|
39
|
-
await pressKeyTimes( 'ArrowLeft', 5 );
|
40
|
-
await page.keyboard.type( 'Meta ' );
|
41
|
-
|
42
|
-
await saveDraft();
|
43
|
-
await page.reload();
|
44
|
-
await page.waitForSelector( '.edit-post-layout' );
|
45
|
-
|
46
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
47
|
-
const persistedValue = await page.evaluate(
|
48
|
-
() => document.querySelector( '.my-meta-input' ).value
|
49
|
-
);
|
50
|
-
expect( persistedValue ).toBe( 'Meta Value' );
|
51
|
-
} );
|
52
|
-
|
53
|
-
it( 'Should use the same value in all the blocks', async () => {
|
54
|
-
await insertBlock( `Test Meta Attribute Block (${ variant })` );
|
55
|
-
await insertBlock( `Test Meta Attribute Block (${ variant })` );
|
56
|
-
await insertBlock( `Test Meta Attribute Block (${ variant })` );
|
57
|
-
await page.keyboard.type( 'Meta Value' );
|
58
|
-
|
59
|
-
const inputs = await page.$$( '.my-meta-input' );
|
60
|
-
await Promise.all(
|
61
|
-
inputs.map( async ( input ) => {
|
62
|
-
// Clicking the input selects the block,
|
63
|
-
// and selecting the block enables the sync data mode
|
64
|
-
// as otherwise the asynchronous re-rendering of unselected blocks
|
65
|
-
// may cause the input to have not yet been updated for the other blocks.
|
66
|
-
await input.click();
|
67
|
-
const inputValue = await input.getProperty( 'value' );
|
68
|
-
expect( await inputValue.jsonValue() ).toBe(
|
69
|
-
'Meta Value'
|
70
|
-
);
|
71
|
-
} )
|
72
|
-
);
|
73
|
-
} );
|
74
|
-
|
75
|
-
it( 'Should persist the meta attribute properly in a different post type', async () => {
|
76
|
-
await createNewPost( { postType: 'page' } );
|
77
|
-
await insertBlock( `Test Meta Attribute Block (${ variant })` );
|
78
|
-
await page.keyboard.type( 'Value' );
|
79
|
-
|
80
|
-
// Regression Test: Previously the caret would wrongly reset to the end
|
81
|
-
// of any input for meta-sourced attributes, due to syncing behavior of
|
82
|
-
// meta attribute updates.
|
83
|
-
//
|
84
|
-
// See: https://github.com/WordPress/gutenberg/issues/15739
|
85
|
-
await pressKeyTimes( 'ArrowLeft', 5 );
|
86
|
-
await page.keyboard.type( 'Meta ' );
|
87
|
-
|
88
|
-
await saveDraft();
|
89
|
-
await page.reload();
|
90
|
-
await page.waitForSelector( '.edit-post-layout' );
|
91
|
-
|
92
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
93
|
-
const persistedValue = await page.evaluate(
|
94
|
-
() => document.querySelector( '.my-meta-input' ).value
|
95
|
-
);
|
96
|
-
expect( persistedValue ).toBe( 'Meta Value' );
|
97
|
-
} );
|
98
|
-
}
|
99
|
-
);
|
100
|
-
} );
|
@@ -1,137 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
findSidebarPanelToggleButtonWithTitle,
|
9
|
-
insertBlock,
|
10
|
-
openDocumentSettingsSidebar,
|
11
|
-
publishPost,
|
12
|
-
saveDraft,
|
13
|
-
} from '@wordpress/e2e-test-utils';
|
14
|
-
|
15
|
-
describe( 'Meta boxes', () => {
|
16
|
-
beforeAll( async () => {
|
17
|
-
await activatePlugin( 'gutenberg-test-plugin-meta-box' );
|
18
|
-
} );
|
19
|
-
|
20
|
-
beforeEach( async () => {
|
21
|
-
await createNewPost();
|
22
|
-
} );
|
23
|
-
|
24
|
-
afterAll( async () => {
|
25
|
-
await deactivatePlugin( 'gutenberg-test-plugin-meta-box' );
|
26
|
-
} );
|
27
|
-
|
28
|
-
it( 'Should save the post', async () => {
|
29
|
-
// Save should not be an option for new empty post.
|
30
|
-
expect( await page.$( '.editor-post-save-draft' ) ).toBe( null );
|
31
|
-
|
32
|
-
// Add title to enable valid non-empty post save.
|
33
|
-
await page.type( '.editor-post-title__input', 'Hello Meta' );
|
34
|
-
expect( await page.$( '.editor-post-save-draft' ) ).not.toBe( null );
|
35
|
-
|
36
|
-
await saveDraft();
|
37
|
-
|
38
|
-
// After saving, affirm that the button returns to Save Draft.
|
39
|
-
await page.waitForSelector( '.editor-post-save-draft' );
|
40
|
-
} );
|
41
|
-
|
42
|
-
it( 'Should render dynamic blocks when the meta box uses the excerpt for front end rendering', async () => {
|
43
|
-
// Publish a post so there's something for the latest posts dynamic block to render.
|
44
|
-
await page.type( '.editor-post-title__input', 'A published post' );
|
45
|
-
await insertBlock( 'Paragraph' );
|
46
|
-
await page.keyboard.type( 'Hello there!' );
|
47
|
-
await publishPost();
|
48
|
-
|
49
|
-
// Publish a post with the latest posts dynamic block.
|
50
|
-
await createNewPost();
|
51
|
-
await page.type( '.editor-post-title__input', 'Dynamic block test' );
|
52
|
-
await insertBlock( 'Latest Posts' );
|
53
|
-
await publishPost();
|
54
|
-
|
55
|
-
// View the post.
|
56
|
-
const viewPostLinks = await page.$x(
|
57
|
-
"//a[contains(text(), 'View Post')]"
|
58
|
-
);
|
59
|
-
await viewPostLinks[ 0 ].click();
|
60
|
-
await page.waitForNavigation();
|
61
|
-
|
62
|
-
// Check the dynamic block appears.
|
63
|
-
const latestPostsBlock = await page.waitForSelector(
|
64
|
-
'.wp-block-latest-posts'
|
65
|
-
);
|
66
|
-
|
67
|
-
expect(
|
68
|
-
await latestPostsBlock.evaluate( ( block ) => block.textContent )
|
69
|
-
).toContain( 'A published post' );
|
70
|
-
|
71
|
-
expect(
|
72
|
-
await latestPostsBlock.evaluate( ( block ) => block.textContent )
|
73
|
-
).toContain( 'Dynamic block test' );
|
74
|
-
} );
|
75
|
-
|
76
|
-
it( 'Should render the excerpt in meta based on post content if no explicit excerpt exists', async () => {
|
77
|
-
await insertBlock( 'Paragraph' );
|
78
|
-
await page.keyboard.type( 'Excerpt from content.' );
|
79
|
-
await page.type( '.editor-post-title__input', 'A published post' );
|
80
|
-
await publishPost();
|
81
|
-
|
82
|
-
// View the post.
|
83
|
-
const viewPostLinks = await page.$x(
|
84
|
-
"//a[contains(text(), 'View Post')]"
|
85
|
-
);
|
86
|
-
await viewPostLinks[ 0 ].click();
|
87
|
-
await page.waitForNavigation();
|
88
|
-
|
89
|
-
// Retrieve the excerpt used as meta.
|
90
|
-
const metaExcerpt = await page.evaluate( () => {
|
91
|
-
return document
|
92
|
-
.querySelector( 'meta[property="gutenberg:hello"]' )
|
93
|
-
.getAttribute( 'content' );
|
94
|
-
} );
|
95
|
-
|
96
|
-
expect( metaExcerpt ).toEqual( 'Excerpt from content.' );
|
97
|
-
} );
|
98
|
-
|
99
|
-
it( 'Should render the explicitly set excerpt in meta instead of the content based one', async () => {
|
100
|
-
await insertBlock( 'Paragraph' );
|
101
|
-
await page.keyboard.type( 'Excerpt from content.' );
|
102
|
-
await page.type( '.editor-post-title__input', 'A published post' );
|
103
|
-
|
104
|
-
// Open the excerpt panel.
|
105
|
-
await openDocumentSettingsSidebar();
|
106
|
-
const excerptButton =
|
107
|
-
await findSidebarPanelToggleButtonWithTitle( 'Excerpt' );
|
108
|
-
if ( excerptButton ) {
|
109
|
-
await excerptButton.click( 'button' );
|
110
|
-
}
|
111
|
-
|
112
|
-
await page.waitForSelector( '.editor-post-excerpt textarea' );
|
113
|
-
|
114
|
-
await page.type(
|
115
|
-
'.editor-post-excerpt textarea',
|
116
|
-
'Explicitly set excerpt.'
|
117
|
-
);
|
118
|
-
|
119
|
-
await publishPost();
|
120
|
-
|
121
|
-
// View the post.
|
122
|
-
const viewPostLinks = await page.$x(
|
123
|
-
"//a[contains(text(), 'View Post')]"
|
124
|
-
);
|
125
|
-
await viewPostLinks[ 0 ].click();
|
126
|
-
await page.waitForNavigation();
|
127
|
-
|
128
|
-
// Retrieve the excerpt used as meta.
|
129
|
-
const metaExcerpt = await page.evaluate( () => {
|
130
|
-
return document
|
131
|
-
.querySelector( 'meta[property="gutenberg:hello"]' )
|
132
|
-
.getAttribute( 'content' );
|
133
|
-
} );
|
134
|
-
|
135
|
-
expect( metaExcerpt ).toEqual( 'Explicitly set excerpt.' );
|
136
|
-
} );
|
137
|
-
} );
|
@@ -1,189 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
clickBlockAppender,
|
7
|
-
clickOnMoreMenuItem,
|
8
|
-
createNewPost,
|
9
|
-
deactivatePlugin,
|
10
|
-
openDocumentSettingsSidebar,
|
11
|
-
openPublishPanel,
|
12
|
-
publishPost,
|
13
|
-
setBrowserViewport,
|
14
|
-
} from '@wordpress/e2e-test-utils';
|
15
|
-
|
16
|
-
describe( 'Using Plugins API', () => {
|
17
|
-
beforeAll( async () => {
|
18
|
-
await activatePlugin( 'gutenberg-test-plugin-plugins-api' );
|
19
|
-
} );
|
20
|
-
|
21
|
-
afterAll( async () => {
|
22
|
-
await deactivatePlugin( 'gutenberg-test-plugin-plugins-api' );
|
23
|
-
} );
|
24
|
-
|
25
|
-
beforeEach( async () => {
|
26
|
-
await createNewPost();
|
27
|
-
} );
|
28
|
-
|
29
|
-
describe( 'Post Status Info', () => {
|
30
|
-
it( 'Should render post status info inside Document Setting sidebar', async () => {
|
31
|
-
await openDocumentSettingsSidebar();
|
32
|
-
|
33
|
-
const pluginPostStatusInfoText = await page.$eval(
|
34
|
-
'.edit-post-post-status .my-post-status-info-plugin',
|
35
|
-
( el ) => el.innerText
|
36
|
-
);
|
37
|
-
expect( pluginPostStatusInfoText ).toBe( 'My post status info' );
|
38
|
-
} );
|
39
|
-
} );
|
40
|
-
|
41
|
-
describe( 'Publish Panel', () => {
|
42
|
-
beforeEach( async () => {
|
43
|
-
// Type something first to activate Publish button.
|
44
|
-
await clickBlockAppender();
|
45
|
-
await page.keyboard.type( 'First paragraph' );
|
46
|
-
} );
|
47
|
-
|
48
|
-
it( 'Should render publish panel inside Pre-publish sidebar', async () => {
|
49
|
-
await openPublishPanel();
|
50
|
-
|
51
|
-
const pluginPublishPanelText = await page.$eval(
|
52
|
-
'.editor-post-publish-panel .my-publish-panel-plugin__pre',
|
53
|
-
( el ) => el.innerText
|
54
|
-
);
|
55
|
-
expect( pluginPublishPanelText ).toMatch( 'My pre publish panel' );
|
56
|
-
} );
|
57
|
-
|
58
|
-
it( 'Should render publish panel inside Post-publish sidebar', async () => {
|
59
|
-
await publishPost();
|
60
|
-
const pluginPublishPanel = await page.waitForSelector(
|
61
|
-
'.editor-post-publish-panel .my-publish-panel-plugin__post'
|
62
|
-
);
|
63
|
-
const pluginPublishPanelText = await pluginPublishPanel.evaluate(
|
64
|
-
( node ) => node.innerText
|
65
|
-
);
|
66
|
-
expect( pluginPublishPanelText ).toMatch( 'My post publish panel' );
|
67
|
-
} );
|
68
|
-
} );
|
69
|
-
|
70
|
-
describe( 'Sidebar', () => {
|
71
|
-
const SIDEBAR_PINNED_ITEM_BUTTON =
|
72
|
-
'.interface-pinned-items button[aria-label="Plugin title"]';
|
73
|
-
const SIDEBAR_PANEL_SELECTOR = '.sidebar-title-plugin-panel';
|
74
|
-
it( 'Should open plugins sidebar using More Menu item and render content', async () => {
|
75
|
-
await clickOnMoreMenuItem( 'Plugin more menu title' );
|
76
|
-
|
77
|
-
const pluginSidebarContent = await page.$eval(
|
78
|
-
'.edit-post-sidebar',
|
79
|
-
( el ) => el.innerHTML
|
80
|
-
);
|
81
|
-
expect( pluginSidebarContent ).toMatchSnapshot();
|
82
|
-
} );
|
83
|
-
|
84
|
-
it( 'Should be pinned by default and can be opened and closed using pinned items', async () => {
|
85
|
-
const sidebarPinnedItem = await page.$(
|
86
|
-
SIDEBAR_PINNED_ITEM_BUTTON
|
87
|
-
);
|
88
|
-
expect( sidebarPinnedItem ).not.toBeNull();
|
89
|
-
await sidebarPinnedItem.click();
|
90
|
-
expect( await page.$( SIDEBAR_PANEL_SELECTOR ) ).not.toBeNull();
|
91
|
-
await sidebarPinnedItem.click();
|
92
|
-
expect( await page.$( SIDEBAR_PANEL_SELECTOR ) ).toBeNull();
|
93
|
-
} );
|
94
|
-
|
95
|
-
it( 'Can be pinned and unpinned', async () => {
|
96
|
-
await ( await page.$( SIDEBAR_PINNED_ITEM_BUTTON ) ).click();
|
97
|
-
const unpinButton = await page.$(
|
98
|
-
'button[aria-label="Unpin from toolbar"]'
|
99
|
-
);
|
100
|
-
await unpinButton.click();
|
101
|
-
expect( await page.$( SIDEBAR_PINNED_ITEM_BUTTON ) ).toBeNull();
|
102
|
-
await page.click(
|
103
|
-
'.interface-complementary-area-header button[aria-label="Close plugin"]'
|
104
|
-
);
|
105
|
-
await page.reload();
|
106
|
-
await page.waitForSelector( '.edit-post-layout' );
|
107
|
-
expect( await page.$( SIDEBAR_PINNED_ITEM_BUTTON ) ).toBeNull();
|
108
|
-
await clickOnMoreMenuItem( 'Plugin more menu title' );
|
109
|
-
await page.click( 'button[aria-label="Pin to toolbar"]' );
|
110
|
-
expect( await page.$( SIDEBAR_PINNED_ITEM_BUTTON ) ).not.toBeNull();
|
111
|
-
await page.reload();
|
112
|
-
await page.waitForSelector( '.edit-post-layout' );
|
113
|
-
expect( await page.$( SIDEBAR_PINNED_ITEM_BUTTON ) ).not.toBeNull();
|
114
|
-
} );
|
115
|
-
|
116
|
-
it( 'Should close plugins sidebar using More Menu item', async () => {
|
117
|
-
await clickOnMoreMenuItem( 'Plugin more menu title' );
|
118
|
-
|
119
|
-
const pluginSidebarOpened = await page.$( '.edit-post-sidebar' );
|
120
|
-
expect( pluginSidebarOpened ).not.toBeNull();
|
121
|
-
|
122
|
-
await clickOnMoreMenuItem( 'Plugin more menu title' );
|
123
|
-
|
124
|
-
const pluginSidebarClosed = await page.$( '.edit-post-sidebar' );
|
125
|
-
expect( pluginSidebarClosed ).toBeNull();
|
126
|
-
} );
|
127
|
-
|
128
|
-
describe( 'Medium screen', () => {
|
129
|
-
beforeAll( async () => {
|
130
|
-
await setBrowserViewport( 'medium' );
|
131
|
-
} );
|
132
|
-
|
133
|
-
afterAll( async () => {
|
134
|
-
await setBrowserViewport( 'large' );
|
135
|
-
} );
|
136
|
-
|
137
|
-
it( 'Should open plugins sidebar using More Menu item and render content', async () => {
|
138
|
-
await clickOnMoreMenuItem( 'Plugin more menu title' );
|
139
|
-
|
140
|
-
const pluginSidebarContent = await page.$eval(
|
141
|
-
'.edit-post-sidebar',
|
142
|
-
( el ) => el.innerHTML
|
143
|
-
);
|
144
|
-
expect( pluginSidebarContent ).toMatchSnapshot();
|
145
|
-
} );
|
146
|
-
} );
|
147
|
-
} );
|
148
|
-
|
149
|
-
describe( 'Document Setting Custom Panel', () => {
|
150
|
-
it( 'Should render a custom panel inside Document Setting sidebar', async () => {
|
151
|
-
await openDocumentSettingsSidebar();
|
152
|
-
const pluginDocumentSettingsText = await page.$eval(
|
153
|
-
'.edit-post-sidebar .my-document-setting-plugin',
|
154
|
-
( el ) => el.innerText
|
155
|
-
);
|
156
|
-
expect( pluginDocumentSettingsText ).toMatchSnapshot();
|
157
|
-
} );
|
158
|
-
} );
|
159
|
-
|
160
|
-
describe( 'Error Boundary', () => {
|
161
|
-
beforeAll( async () => {
|
162
|
-
await activatePlugin(
|
163
|
-
'gutenberg-test-plugin-plugins-error-boundary'
|
164
|
-
);
|
165
|
-
} );
|
166
|
-
|
167
|
-
afterAll( async () => {
|
168
|
-
await deactivatePlugin(
|
169
|
-
'gutenberg-test-plugin-plugins-error-boundary'
|
170
|
-
);
|
171
|
-
} );
|
172
|
-
|
173
|
-
it( 'Should create notice using plugin error boundary callback', async () => {
|
174
|
-
const noticeContent = await page.waitForSelector(
|
175
|
-
'.is-error .components-notice__content'
|
176
|
-
);
|
177
|
-
expect(
|
178
|
-
await page.evaluate(
|
179
|
-
( _noticeContent ) => _noticeContent.firstChild.nodeValue,
|
180
|
-
noticeContent
|
181
|
-
)
|
182
|
-
).toEqual(
|
183
|
-
'The "my-error-plugin" plugin has encountered an error and cannot be rendered.'
|
184
|
-
);
|
185
|
-
|
186
|
-
expect( console ).toHaveErrored();
|
187
|
-
} );
|
188
|
-
} );
|
189
|
-
} );
|
@@ -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,46 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
arePrePublishChecksEnabled,
|
6
|
-
disablePrePublishChecks,
|
7
|
-
enablePrePublishChecks,
|
8
|
-
createNewPost,
|
9
|
-
canvas,
|
10
|
-
} from '@wordpress/e2e-test-utils';
|
11
|
-
|
12
|
-
describe( 'PostPublishButton', () => {
|
13
|
-
let werePrePublishChecksEnabled;
|
14
|
-
beforeEach( async () => {
|
15
|
-
await createNewPost();
|
16
|
-
werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
|
17
|
-
if ( werePrePublishChecksEnabled ) {
|
18
|
-
await disablePrePublishChecks();
|
19
|
-
}
|
20
|
-
} );
|
21
|
-
|
22
|
-
afterEach( async () => {
|
23
|
-
if ( werePrePublishChecksEnabled ) {
|
24
|
-
await enablePrePublishChecks();
|
25
|
-
}
|
26
|
-
} );
|
27
|
-
|
28
|
-
it( 'should be disabled when post is not saveable', async () => {
|
29
|
-
const publishButton = await page.$(
|
30
|
-
'.editor-post-publish-button[aria-disabled="true"]'
|
31
|
-
);
|
32
|
-
expect( publishButton ).not.toBeNull();
|
33
|
-
} );
|
34
|
-
|
35
|
-
it( 'should be disabled when post is being saved', async () => {
|
36
|
-
await canvas().type( '.editor-post-title__input', 'E2E Test Post' ); // Make it saveable.
|
37
|
-
expect(
|
38
|
-
await page.$( '.editor-post-publish-button[aria-disabled="true"]' )
|
39
|
-
).toBeNull();
|
40
|
-
|
41
|
-
await page.click( '.editor-post-save-draft' );
|
42
|
-
expect(
|
43
|
-
await page.$( '.editor-post-publish-button[aria-disabled="true"]' )
|
44
|
-
).not.toBeNull();
|
45
|
-
} );
|
46
|
-
} );
|
@@ -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
|
-
} );
|