@wordpress/e2e-tests 5.4.0 → 5.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/package.json +7 -7
- package/specs/editor/blocks/cover.test.js +4 -2
- package/specs/editor/blocks/navigation.test.js +1 -1
- package/specs/editor/blocks/site-title.test.js +11 -7
- package/specs/editor/various/block-hierarchy-navigation.test.js +11 -4
- package/specs/editor/various/font-size-picker.test.js +54 -46
- package/specs/editor/various/inserting-blocks.test.js +8 -0
- package/specs/editor/various/keyboard-navigable-blocks.test.js +4 -1
- package/specs/editor/various/multi-block-selection.test.js +5 -0
- package/specs/site-editor/multi-entity-saving.test.js +20 -20
- package/specs/editor/blocks/columns.test.js +0 -31
- package/specs/editor/blocks/gallery.test.js +0 -156
- package/specs/editor/plugins/__snapshots__/templates.test.js.snap +0 -69
- package/specs/editor/plugins/templates.test.js +0 -126
- package/specs/editor/various/__snapshots__/compatibility-classic-editor.test.js.snap +0 -7
- package/specs/editor/various/__snapshots__/splitting-merging.test.js.snap +0 -101
- package/specs/editor/various/compatibility-classic-editor.test.js +0 -38
- package/specs/editor/various/fullscreen-mode.test.js +0 -31
- package/specs/editor/various/new-post-default-content.test.js +0 -52
- package/specs/editor/various/splitting-merging.test.js +0 -303
- package/specs/site-editor/iframe-rendering-mode.test.js +0 -31
- package/specs/site-editor/site-editor-inserter.test.js +0 -33
@@ -1,69 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`templates Using a CPT with a predefined template Should add a custom post types with a predefined template 1`] = `
|
4
|
-
"<!-- wp:image -->
|
5
|
-
<figure class=\\"wp-block-image\\"><img alt=\\"\\"/></figure>
|
6
|
-
<!-- /wp:image -->
|
7
|
-
|
8
|
-
<!-- wp:paragraph {\\"placeholder\\":\\"Add a book description\\"} -->
|
9
|
-
<p></p>
|
10
|
-
<!-- /wp:paragraph -->
|
11
|
-
|
12
|
-
<!-- wp:quote -->
|
13
|
-
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
14
|
-
<p></p>
|
15
|
-
<!-- /wp:paragraph --></blockquote>
|
16
|
-
<!-- /wp:quote -->
|
17
|
-
|
18
|
-
<!-- wp:columns -->
|
19
|
-
<div class=\\"wp-block-columns\\"><!-- wp:column -->
|
20
|
-
<div class=\\"wp-block-column\\"><!-- wp:image -->
|
21
|
-
<figure class=\\"wp-block-image\\"><img alt=\\"\\"/></figure>
|
22
|
-
<!-- /wp:image --></div>
|
23
|
-
<!-- /wp:column -->
|
24
|
-
|
25
|
-
<!-- wp:column -->
|
26
|
-
<div class=\\"wp-block-column\\"><!-- wp:paragraph {\\"placeholder\\":\\"Add a inner paragraph\\"} -->
|
27
|
-
<p></p>
|
28
|
-
<!-- /wp:paragraph --></div>
|
29
|
-
<!-- /wp:column --></div>
|
30
|
-
<!-- /wp:columns -->"
|
31
|
-
`;
|
32
|
-
|
33
|
-
exports[`templates Using a CPT with a predefined template Should respect user edits to not re-apply template after save (full delete) 1`] = `""`;
|
34
|
-
|
35
|
-
exports[`templates Using a CPT with a predefined template Should respect user edits to not re-apply template after save (single block removal) 1`] = `
|
36
|
-
"<!-- wp:paragraph {\\"placeholder\\":\\"Add a book description\\"} -->
|
37
|
-
<p></p>
|
38
|
-
<!-- /wp:paragraph -->
|
39
|
-
|
40
|
-
<!-- wp:quote -->
|
41
|
-
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
42
|
-
<p></p>
|
43
|
-
<!-- /wp:paragraph --></blockquote>
|
44
|
-
<!-- /wp:quote -->
|
45
|
-
|
46
|
-
<!-- wp:columns -->
|
47
|
-
<div class=\\"wp-block-columns\\"><!-- wp:column -->
|
48
|
-
<div class=\\"wp-block-column\\"><!-- wp:image -->
|
49
|
-
<figure class=\\"wp-block-image\\"><img alt=\\"\\"/></figure>
|
50
|
-
<!-- /wp:image --></div>
|
51
|
-
<!-- /wp:column -->
|
52
|
-
|
53
|
-
<!-- wp:column -->
|
54
|
-
<div class=\\"wp-block-column\\"><!-- wp:paragraph {\\"placeholder\\":\\"Add a inner paragraph\\"} -->
|
55
|
-
<p></p>
|
56
|
-
<!-- /wp:paragraph --></div>
|
57
|
-
<!-- /wp:column --></div>
|
58
|
-
<!-- /wp:columns -->"
|
59
|
-
`;
|
60
|
-
|
61
|
-
exports[`templates With default post format assigned should not populate edited post with default block for format 1`] = `""`;
|
62
|
-
|
63
|
-
exports[`templates With default post format assigned should not populate new page with default block for format 1`] = `""`;
|
64
|
-
|
65
|
-
exports[`templates With default post format assigned should populate new post with default block for format 1`] = `
|
66
|
-
"<!-- wp:image -->
|
67
|
-
<figure class=\\"wp-block-image\\"><img alt=\\"\\"/></figure>
|
68
|
-
<!-- /wp:image -->"
|
69
|
-
`;
|
@@ -1,126 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
getEditedPostContent,
|
9
|
-
pressKeyWithModifier,
|
10
|
-
saveDraft,
|
11
|
-
switchUserToAdmin,
|
12
|
-
switchUserToTest,
|
13
|
-
visitAdminPage,
|
14
|
-
} from '@wordpress/e2e-test-utils';
|
15
|
-
|
16
|
-
describe( 'templates', () => {
|
17
|
-
describe( 'Using a CPT with a predefined template', () => {
|
18
|
-
beforeAll( async () => {
|
19
|
-
await activatePlugin( 'gutenberg-test-plugin-templates' );
|
20
|
-
} );
|
21
|
-
|
22
|
-
beforeEach( async () => {
|
23
|
-
await createNewPost( { postType: 'book' } );
|
24
|
-
} );
|
25
|
-
|
26
|
-
afterAll( async () => {
|
27
|
-
await deactivatePlugin( 'gutenberg-test-plugin-templates' );
|
28
|
-
} );
|
29
|
-
|
30
|
-
it( 'Should add a custom post types with a predefined template', async () => {
|
31
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
32
|
-
} );
|
33
|
-
|
34
|
-
it( 'Should respect user edits to not re-apply template after save (single block removal)', async () => {
|
35
|
-
// Remove a block from the template to verify that it's not
|
36
|
-
// re-added after saving and reloading the editor.
|
37
|
-
await page.click( '.editor-post-title__input' );
|
38
|
-
await page.keyboard.press( 'ArrowDown' );
|
39
|
-
await page.keyboard.press( 'Backspace' );
|
40
|
-
await saveDraft();
|
41
|
-
await page.reload();
|
42
|
-
await page.waitForSelector( '.edit-post-layout' );
|
43
|
-
|
44
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
45
|
-
} );
|
46
|
-
|
47
|
-
it( 'Should respect user edits to not re-apply template after save (full delete)', async () => {
|
48
|
-
// Remove all blocks from the template to verify that they're not
|
49
|
-
// re-added after saving and reloading the editor.
|
50
|
-
await page.type( '.editor-post-title__input', 'My Empty Book' );
|
51
|
-
await page.keyboard.press( 'ArrowDown' );
|
52
|
-
await pressKeyWithModifier( 'primary', 'A' );
|
53
|
-
await page.keyboard.press( 'Backspace' );
|
54
|
-
await saveDraft();
|
55
|
-
await page.reload();
|
56
|
-
await page.waitForSelector( '.edit-post-layout' );
|
57
|
-
|
58
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
59
|
-
} );
|
60
|
-
} );
|
61
|
-
|
62
|
-
describe( 'With default post format assigned', () => {
|
63
|
-
const STANDARD_FORMAT_VALUE = '0';
|
64
|
-
|
65
|
-
async function setPostFormat( format ) {
|
66
|
-
// To set the post format, we need to be the admin user.
|
67
|
-
await switchUserToAdmin();
|
68
|
-
await visitAdminPage( 'options-writing.php' );
|
69
|
-
await page.select( '#default_post_format', format );
|
70
|
-
await Promise.all( [
|
71
|
-
page.waitForNavigation(),
|
72
|
-
page.click( '#submit' ),
|
73
|
-
] );
|
74
|
-
await switchUserToTest();
|
75
|
-
}
|
76
|
-
|
77
|
-
beforeAll( async () => {
|
78
|
-
await activatePlugin(
|
79
|
-
'gutenberg-test-plugin-post-formats-support'
|
80
|
-
);
|
81
|
-
await setPostFormat( 'image' );
|
82
|
-
} );
|
83
|
-
afterAll( async () => {
|
84
|
-
await setPostFormat( STANDARD_FORMAT_VALUE );
|
85
|
-
await deactivatePlugin(
|
86
|
-
'gutenberg-test-plugin-post-formats-support'
|
87
|
-
);
|
88
|
-
} );
|
89
|
-
|
90
|
-
it( 'should populate new post with default block for format', async () => {
|
91
|
-
await createNewPost();
|
92
|
-
|
93
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
94
|
-
} );
|
95
|
-
|
96
|
-
it( 'should not populate edited post with default block for format', async () => {
|
97
|
-
await createNewPost();
|
98
|
-
|
99
|
-
// Remove the default block template to verify that it's not
|
100
|
-
// re-added after saving and reloading the editor.
|
101
|
-
await page.type( '.editor-post-title__input', 'My Image Format' );
|
102
|
-
await page.click( '.wp-block-image' );
|
103
|
-
await page.keyboard.press( 'Backspace' );
|
104
|
-
await saveDraft();
|
105
|
-
await page.reload();
|
106
|
-
await page.waitForSelector( '.edit-post-layout' );
|
107
|
-
|
108
|
-
// Wait a bit more for getEditedPostContent to be correct.
|
109
|
-
await page.waitForSelector(
|
110
|
-
'.block-editor-default-block-appender__content'
|
111
|
-
);
|
112
|
-
|
113
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
114
|
-
} );
|
115
|
-
|
116
|
-
it( 'should not populate new page with default block for format', async () => {
|
117
|
-
// This test always needs to run as the admin user, because other roles can't create pages.
|
118
|
-
// It can't be skipped, because then it failed because of not testing the snapshot.
|
119
|
-
await switchUserToAdmin();
|
120
|
-
await createNewPost( { postType: 'page' } );
|
121
|
-
|
122
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
123
|
-
await switchUserToTest();
|
124
|
-
} );
|
125
|
-
} );
|
126
|
-
} );
|
@@ -1,101 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`splitting and merging blocks should delete an empty first line 1`] = `
|
4
|
-
"<!-- wp:paragraph -->
|
5
|
-
<p>First</p>
|
6
|
-
<!-- /wp:paragraph -->
|
7
|
-
|
8
|
-
<!-- wp:paragraph -->
|
9
|
-
<p>Still Second</p>
|
10
|
-
<!-- /wp:paragraph -->"
|
11
|
-
`;
|
12
|
-
|
13
|
-
exports[`splitting and merging blocks should forward delete from an empty paragraph 1`] = `
|
14
|
-
"<!-- wp:paragraph -->
|
15
|
-
<p>Second</p>
|
16
|
-
<!-- /wp:paragraph -->"
|
17
|
-
`;
|
18
|
-
|
19
|
-
exports[`splitting and merging blocks should gracefully handle if placing caret in empty container 1`] = `
|
20
|
-
"<!-- wp:paragraph -->
|
21
|
-
<p><strong>Foo</strong></p>
|
22
|
-
<!-- /wp:paragraph -->
|
23
|
-
|
24
|
-
<!-- wp:paragraph -->
|
25
|
-
<p></p>
|
26
|
-
<!-- /wp:paragraph -->"
|
27
|
-
`;
|
28
|
-
|
29
|
-
exports[`splitting and merging blocks should merge into inline boundary position 1`] = `
|
30
|
-
"<!-- wp:paragraph -->
|
31
|
-
<p>Bar</p>
|
32
|
-
<!-- /wp:paragraph -->"
|
33
|
-
`;
|
34
|
-
|
35
|
-
exports[`splitting and merging blocks should not merge paragraphs if the selection is not collapsed 1`] = `
|
36
|
-
"<!-- wp:paragraph -->
|
37
|
-
<p>Foo</p>
|
38
|
-
<!-- /wp:paragraph -->
|
39
|
-
|
40
|
-
<!-- wp:paragraph -->
|
41
|
-
<p></p>
|
42
|
-
<!-- /wp:paragraph -->"
|
43
|
-
`;
|
44
|
-
|
45
|
-
exports[`splitting and merging blocks should not split with line break in front 1`] = `
|
46
|
-
"<!-- wp:paragraph -->
|
47
|
-
<p>1</p>
|
48
|
-
<!-- /wp:paragraph -->
|
49
|
-
|
50
|
-
<!-- wp:paragraph -->
|
51
|
-
<p>2</p>
|
52
|
-
<!-- /wp:paragraph -->"
|
53
|
-
`;
|
54
|
-
|
55
|
-
exports[`splitting and merging blocks should remove at most one paragraph in forward direction 1`] = `
|
56
|
-
"<!-- wp:paragraph -->
|
57
|
-
<p>First</p>
|
58
|
-
<!-- /wp:paragraph -->
|
59
|
-
|
60
|
-
<!-- wp:paragraph -->
|
61
|
-
<p></p>
|
62
|
-
<!-- /wp:paragraph -->
|
63
|
-
|
64
|
-
<!-- wp:paragraph -->
|
65
|
-
<p>Second</p>
|
66
|
-
<!-- /wp:paragraph -->"
|
67
|
-
`;
|
68
|
-
|
69
|
-
exports[`splitting and merging blocks should remove empty paragraph block on backspace 1`] = `""`;
|
70
|
-
|
71
|
-
exports[`splitting and merging blocks should split and merge paragraph blocks using Enter and Backspace 1`] = `
|
72
|
-
"<!-- wp:paragraph -->
|
73
|
-
<p>First</p>
|
74
|
-
<!-- /wp:paragraph -->
|
75
|
-
|
76
|
-
<!-- wp:paragraph -->
|
77
|
-
<p>Second</p>
|
78
|
-
<!-- /wp:paragraph -->"
|
79
|
-
`;
|
80
|
-
|
81
|
-
exports[`splitting and merging blocks should split and merge paragraph blocks using Enter and Backspace 2`] = `
|
82
|
-
"<!-- wp:paragraph -->
|
83
|
-
<p>FirstBetweenSecond</p>
|
84
|
-
<!-- /wp:paragraph -->"
|
85
|
-
`;
|
86
|
-
|
87
|
-
exports[`splitting and merging blocks should split and merge paragraph blocks using Enter and Backspace 3`] = `
|
88
|
-
"<!-- wp:paragraph -->
|
89
|
-
<p><strong>First</strong></p>
|
90
|
-
<!-- /wp:paragraph -->
|
91
|
-
|
92
|
-
<!-- wp:paragraph -->
|
93
|
-
<p>BeforeSecond:Second</p>
|
94
|
-
<!-- /wp:paragraph -->"
|
95
|
-
`;
|
96
|
-
|
97
|
-
exports[`splitting and merging blocks should undo split in one go 1`] = `
|
98
|
-
"<!-- wp:paragraph -->
|
99
|
-
<p>12</p>
|
100
|
-
<!-- /wp:paragraph -->"
|
101
|
-
`;
|
@@ -1,38 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
createNewPost,
|
6
|
-
insertBlock,
|
7
|
-
publishPost,
|
8
|
-
} from '@wordpress/e2e-test-utils';
|
9
|
-
|
10
|
-
describe( 'Compatibility with classic editor', () => {
|
11
|
-
beforeEach( async () => {
|
12
|
-
await createNewPost();
|
13
|
-
} );
|
14
|
-
|
15
|
-
it( 'Should not apply autop when rendering blocks', async () => {
|
16
|
-
await insertBlock( 'Custom HTML' );
|
17
|
-
await page.keyboard.type( '<a>' );
|
18
|
-
await page.keyboard.press( 'Enter' );
|
19
|
-
await page.keyboard.type( 'Random Link' );
|
20
|
-
await page.keyboard.press( 'Enter' );
|
21
|
-
await page.keyboard.type( '</a>' );
|
22
|
-
await publishPost();
|
23
|
-
|
24
|
-
// View the post.
|
25
|
-
const viewPostLinks = await page.$x(
|
26
|
-
"//a[contains(text(), 'View Post')]"
|
27
|
-
);
|
28
|
-
await viewPostLinks[ 0 ].click();
|
29
|
-
await page.waitForNavigation();
|
30
|
-
|
31
|
-
// Check the content doesn't contain <p> tags.
|
32
|
-
await page.waitForSelector( '.entry-content' );
|
33
|
-
const content = await page.$eval( '.entry-content', ( element ) =>
|
34
|
-
element.innerHTML.trim()
|
35
|
-
);
|
36
|
-
expect( content ).toMatchSnapshot();
|
37
|
-
} );
|
38
|
-
} );
|
@@ -1,31 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
createNewPost,
|
6
|
-
clickOnMoreMenuItem,
|
7
|
-
toggleMoreMenu,
|
8
|
-
} from '@wordpress/e2e-test-utils';
|
9
|
-
|
10
|
-
describe( 'Fullscreen Mode', () => {
|
11
|
-
beforeAll( async () => {
|
12
|
-
await createNewPost();
|
13
|
-
} );
|
14
|
-
|
15
|
-
it( 'should open the fullscreen mode from the more menu', async () => {
|
16
|
-
await clickOnMoreMenuItem( 'Fullscreen mode' );
|
17
|
-
await toggleMoreMenu( 'close' );
|
18
|
-
|
19
|
-
const isFullscreenEnabled = await page.$eval( 'body', ( body ) => {
|
20
|
-
return body.classList.contains( 'is-fullscreen-mode' );
|
21
|
-
} );
|
22
|
-
|
23
|
-
expect( isFullscreenEnabled ).toBe( true );
|
24
|
-
|
25
|
-
const fullscreenCloseButton = await page.$(
|
26
|
-
'.edit-post-fullscreen-mode-close'
|
27
|
-
);
|
28
|
-
|
29
|
-
expect( fullscreenCloseButton ).not.toBeNull();
|
30
|
-
} );
|
31
|
-
} );
|
@@ -1,52 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
findSidebarPanelToggleButtonWithTitle,
|
9
|
-
getEditedPostContent,
|
10
|
-
openDocumentSettingsSidebar,
|
11
|
-
} from '@wordpress/e2e-test-utils';
|
12
|
-
|
13
|
-
describe( 'new editor filtered state', () => {
|
14
|
-
beforeAll( async () => {
|
15
|
-
await activatePlugin( 'gutenberg-test-plugin-default-post-content' );
|
16
|
-
} );
|
17
|
-
|
18
|
-
beforeEach( async () => {
|
19
|
-
await createNewPost();
|
20
|
-
} );
|
21
|
-
|
22
|
-
afterAll( async () => {
|
23
|
-
await deactivatePlugin( 'gutenberg-test-plugin-default-post-content' );
|
24
|
-
} );
|
25
|
-
|
26
|
-
it( 'should respect default content', async () => {
|
27
|
-
// Get the values that should have their defaults changed.
|
28
|
-
const title = await page.$eval(
|
29
|
-
'.editor-post-title__input',
|
30
|
-
( element ) => element.innerHTML
|
31
|
-
);
|
32
|
-
const content = await getEditedPostContent();
|
33
|
-
|
34
|
-
// open the sidebar, we want to see the excerpt.
|
35
|
-
await openDocumentSettingsSidebar();
|
36
|
-
const excerptButton = await findSidebarPanelToggleButtonWithTitle(
|
37
|
-
'Excerpt'
|
38
|
-
);
|
39
|
-
if ( excerptButton ) {
|
40
|
-
await excerptButton.click( 'button' );
|
41
|
-
}
|
42
|
-
const excerpt = await page.$eval(
|
43
|
-
'.editor-post-excerpt textarea',
|
44
|
-
( element ) => element.innerHTML
|
45
|
-
);
|
46
|
-
|
47
|
-
// Assert they match what the plugin set.
|
48
|
-
expect( title ).toBe( 'My default title' );
|
49
|
-
expect( content ).toBe( 'My default content' );
|
50
|
-
expect( excerpt ).toBe( 'My default excerpt' );
|
51
|
-
} );
|
52
|
-
} );
|