@wordpress/e2e-tests 4.5.0 → 4.8.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/package.json +7 -7
- package/plugins/cpt-locking.php +28 -4
- package/specs/editor/blocks/__snapshots__/quote.test.js.snap +37 -131
- package/specs/editor/blocks/gallery.test.js +1 -1
- package/specs/editor/blocks/navigation.test.js +11 -50
- package/specs/editor/blocks/quote.test.js +9 -104
- package/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +24 -8
- package/specs/editor/plugins/__snapshots__/inner-blocks-render-appender.test.js.snap +6 -2
- package/specs/editor/plugins/__snapshots__/templates.test.js.snap +6 -2
- package/specs/editor/plugins/block-variations.test.js +2 -0
- package/specs/editor/plugins/cpt-locking.test.js +3 -3
- package/specs/editor/plugins/iframed-block.test.js +3 -2
- package/specs/editor/plugins/iframed-masonry-block.test.js +3 -2
- package/specs/editor/plugins/inner-blocks-render-appender.test.js +3 -0
- package/specs/editor/plugins/meta-boxes.test.js +1 -1
- package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +0 -16
- package/specs/editor/various/__snapshots__/writing-flow.test.js.snap +3 -3
- package/specs/editor/various/block-switcher.test.js +1 -3
- package/specs/editor/various/compatibility-classic-editor.test.js +1 -1
- package/specs/editor/various/datepicker.test.js +9 -11
- package/specs/editor/various/links.test.js +3 -3
- package/specs/editor/various/multi-block-selection.test.js +2 -29
- package/specs/editor/various/post-visibility.test.js +4 -4
- package/specs/editor/various/reusable-blocks.test.js +2 -0
- package/specs/editor/various/scheduling.test.js +2 -2
- package/specs/editor/various/{sidebar-permalink-panel.test.js → sidebar-permalink.test.js} +9 -19
- package/specs/editor/various/sidebar.test.js +4 -6
- package/specs/editor/various/typewriter.test.js +2 -2
- package/specs/editor/various/writing-flow.test.js +74 -1
- package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +0 -33
- package/specs/editor/blocks/__snapshots__/list.test.js.snap +0 -337
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +0 -13
- package/specs/editor/blocks/__snapshots__/table.test.js.snap +0 -61
- package/specs/editor/blocks/buttons.test.js +0 -95
- package/specs/editor/blocks/comments.test.js +0 -131
- package/specs/editor/blocks/list.test.js +0 -542
- package/specs/editor/blocks/spacer.test.js +0 -48
- package/specs/editor/blocks/table.test.js +0 -295
- package/specs/editor/plugins/__snapshots__/format-api.test.js.snap +0 -7
- package/specs/editor/plugins/__snapshots__/hooks-api.test.js.snap +0 -3
- package/specs/editor/plugins/format-api.test.js +0 -36
- package/specs/editor/plugins/hooks-api.test.js +0 -44
- package/specs/editor/various/__snapshots__/rtl.test.js.snap +0 -63
- package/specs/editor/various/block-mover.test.js +0 -42
- package/specs/editor/various/preview.test.js +0 -425
- package/specs/editor/various/rtl.test.js +0 -129
- package/specs/site-editor/style-variations.test.js +0 -213
- package/themes/style-variations/block-templates/index.html +0 -11
- package/themes/style-variations/index.php +0 -0
- package/themes/style-variations/style.css +0 -15
- package/themes/style-variations/styles/pink.json +0 -33
- package/themes/style-variations/styles/yellow.json +0 -12
- package/themes/style-variations/theme.json +0 -8
@@ -3,7 +3,9 @@
|
|
3
3
|
exports[`RenderAppender prop of InnerBlocks Users can customize the appender and can still insert blocks using exposed components 1`] = `
|
4
4
|
"<!-- wp:test/inner-blocks-render-appender -->
|
5
5
|
<div style=\\"outline:1px solid gray;padding:5px\\" class=\\"wp-block-test-inner-blocks-render-appender\\"><!-- wp:quote -->
|
6
|
-
<blockquote class=\\"wp-block-quote\\"
|
6
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
7
|
+
<p></p>
|
8
|
+
<!-- /wp:paragraph --></blockquote>
|
7
9
|
<!-- /wp:quote --></div>
|
8
10
|
<!-- /wp:test/inner-blocks-render-appender -->"
|
9
11
|
`;
|
@@ -11,7 +13,9 @@ exports[`RenderAppender prop of InnerBlocks Users can customize the appender and
|
|
11
13
|
exports[`RenderAppender prop of InnerBlocks Users can dynamically customize the appender 1`] = `
|
12
14
|
"<!-- wp:test/inner-blocks-render-appender-dynamic -->
|
13
15
|
<div style=\\"outline:1px solid gray;padding:5px\\" class=\\"wp-block-test-inner-blocks-render-appender-dynamic\\"><!-- wp:quote -->
|
14
|
-
<blockquote class=\\"wp-block-quote\\"
|
16
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
17
|
+
<p></p>
|
18
|
+
<!-- /wp:paragraph --></blockquote>
|
15
19
|
<!-- /wp:quote -->
|
16
20
|
|
17
21
|
<!-- wp:video -->
|
@@ -10,7 +10,9 @@ exports[`templates Using a CPT with a predefined template Should add a custom po
|
|
10
10
|
<!-- /wp:paragraph -->
|
11
11
|
|
12
12
|
<!-- wp:quote -->
|
13
|
-
<blockquote class=\\"wp-block-quote\\"
|
13
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
14
|
+
<p></p>
|
15
|
+
<!-- /wp:paragraph --></blockquote>
|
14
16
|
<!-- /wp:quote -->
|
15
17
|
|
16
18
|
<!-- wp:columns -->
|
@@ -36,7 +38,9 @@ exports[`templates Using a CPT with a predefined template Should respect user ed
|
|
36
38
|
<!-- /wp:paragraph -->
|
37
39
|
|
38
40
|
<!-- wp:quote -->
|
39
|
-
<blockquote class=\\"wp-block-quote\\"
|
41
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
42
|
+
<p></p>
|
43
|
+
<!-- /wp:paragraph --></blockquote>
|
40
44
|
<!-- /wp:quote -->
|
41
45
|
|
42
46
|
<!-- wp:columns -->
|
@@ -148,6 +148,8 @@ describe( 'Block variations', () => {
|
|
148
148
|
|
149
149
|
it( 'should show block information when no matching variation is found', async () => {
|
150
150
|
await insertBlock( 'Large Quote' );
|
151
|
+
// Select the quote block.
|
152
|
+
await page.keyboard.press( 'ArrowDown' );
|
151
153
|
const breadcrumb = await getActiveBreadcrumb();
|
152
154
|
expect( breadcrumb ).toEqual( 'Quote' );
|
153
155
|
const navigationItem = await getFirstNavigationItem();
|
@@ -49,12 +49,12 @@ describe( 'cpt locking', () => {
|
|
49
49
|
|
50
50
|
const shouldAllowBlocksToBeMoved = async () => {
|
51
51
|
await page.click(
|
52
|
-
'.block-editor-rich-text__editable[data-type="core/paragraph"]'
|
52
|
+
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]'
|
53
53
|
);
|
54
54
|
expect( await page.$( 'button[aria-label="Move up"]' ) ).not.toBeNull();
|
55
55
|
await page.click( 'button[aria-label="Move up"]' );
|
56
56
|
await page.type(
|
57
|
-
'.block-editor-rich-text__editable[data-type="core/paragraph"]',
|
57
|
+
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]',
|
58
58
|
'p1'
|
59
59
|
);
|
60
60
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
@@ -193,7 +193,7 @@ describe( 'cpt locking', () => {
|
|
193
193
|
|
194
194
|
it( 'should allow blocks to be removed', async () => {
|
195
195
|
await page.type(
|
196
|
-
'.block-editor-rich-text__editable[data-type="core/paragraph"]',
|
196
|
+
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]',
|
197
197
|
'p1'
|
198
198
|
);
|
199
199
|
await clickBlockToolbarButton( 'Options' );
|
@@ -36,8 +36,9 @@ describe( 'changing image size', () => {
|
|
36
36
|
|
37
37
|
await openDocumentSettingsSidebar();
|
38
38
|
await clickButton( 'Page' );
|
39
|
-
await
|
40
|
-
await
|
39
|
+
await page.click( 'button[aria-label^="Select template"]' );
|
40
|
+
await page.waitForSelector( 'button[aria-label="Add template"]' );
|
41
|
+
await page.click( 'button[aria-label="Add template"]' );
|
41
42
|
await page.keyboard.press( 'Tab' );
|
42
43
|
await page.keyboard.press( 'Tab' );
|
43
44
|
await page.keyboard.type( 'Iframed Test' );
|
@@ -44,8 +44,9 @@ describe( 'iframed masonry block', () => {
|
|
44
44
|
|
45
45
|
await openDocumentSettingsSidebar();
|
46
46
|
await clickButton( 'Page' );
|
47
|
-
await
|
48
|
-
await
|
47
|
+
await page.click( 'button[aria-label^="Select template"]' );
|
48
|
+
await page.waitForSelector( 'button[aria-label="Add template"]' );
|
49
|
+
await page.click( 'button[aria-label="Add template"]' );
|
49
50
|
await page.keyboard.press( 'Tab' );
|
50
51
|
await page.keyboard.press( 'Tab' );
|
51
52
|
await page.keyboard.type( 'Iframed Test' );
|
@@ -98,6 +98,9 @@ describe( 'RenderAppender prop of InnerBlocks', () => {
|
|
98
98
|
// Insert a quote block.
|
99
99
|
await quoteButton.click();
|
100
100
|
|
101
|
+
// Select the quote block.
|
102
|
+
await page.keyboard.press( 'ArrowDown' );
|
103
|
+
|
101
104
|
// Verify if the custom block appender text changed as expected.
|
102
105
|
await page.waitForXPath(
|
103
106
|
`//*[contains(@class, "${ DYNAMIC_APPENDER_SELECTOR }")]/span[contains(@class, "single-blocks-appender")][contains(text(), "Single Blocks Appender")]`
|
@@ -59,7 +59,7 @@ describe( 'Meta boxes', () => {
|
|
59
59
|
await viewPostLinks[ 0 ].click();
|
60
60
|
await page.waitForNavigation();
|
61
61
|
|
62
|
-
// Check the
|
62
|
+
// Check the dynamic block appears.
|
63
63
|
const latestPostsBlock = await page.waitForSelector(
|
64
64
|
'.wp-block-latest-posts'
|
65
65
|
);
|
@@ -146,22 +146,6 @@ exports[`Multi-block selection should handle Enter across blocks 2`] = `
|
|
146
146
|
<!-- /wp:heading -->"
|
147
147
|
`;
|
148
148
|
|
149
|
-
exports[`Multi-block selection should merge into quote with correct selection 1`] = `
|
150
|
-
"<!-- wp:quote -->
|
151
|
-
<blockquote class=\\"wp-block-quote\\"><p>1[</p></blockquote>
|
152
|
-
<!-- /wp:quote -->
|
153
|
-
|
154
|
-
<!-- wp:paragraph -->
|
155
|
-
<p>]2</p>
|
156
|
-
<!-- /wp:paragraph -->"
|
157
|
-
`;
|
158
|
-
|
159
|
-
exports[`Multi-block selection should merge into quote with correct selection 2`] = `
|
160
|
-
"<!-- wp:quote -->
|
161
|
-
<blockquote class=\\"wp-block-quote\\"><p>1</p><p>&2</p></blockquote>
|
162
|
-
<!-- /wp:quote -->"
|
163
|
-
`;
|
164
|
-
|
165
149
|
exports[`Multi-block selection should multi-select from within the list block 1`] = `
|
166
150
|
"<!-- wp:paragraph -->
|
167
151
|
<p>1</p>
|
@@ -207,9 +207,9 @@ exports[`Writing Flow should navigate empty paragraphs 1`] = `
|
|
207
207
|
`;
|
208
208
|
|
209
209
|
exports[`Writing Flow should not create extra line breaks in multiline value 1`] = `
|
210
|
-
"<!-- wp:
|
211
|
-
<
|
212
|
-
<!-- /wp:
|
210
|
+
"<!-- wp:list -->
|
211
|
+
<ul><li></li></ul>
|
212
|
+
<!-- /wp:list -->"
|
213
213
|
`;
|
214
214
|
|
215
215
|
exports[`Writing Flow should not delete surrounding space when deleting a selected word 1`] = `
|
@@ -28,9 +28,8 @@ describe( 'Block Switcher', () => {
|
|
28
28
|
expect.arrayContaining( [
|
29
29
|
'Group',
|
30
30
|
'Paragraph',
|
31
|
-
'Quote',
|
32
31
|
'Heading',
|
33
|
-
'
|
32
|
+
'Quote',
|
34
33
|
'Columns',
|
35
34
|
'Table of Contents',
|
36
35
|
] )
|
@@ -56,7 +55,6 @@ describe( 'Block Switcher', () => {
|
|
56
55
|
expect.arrayContaining( [
|
57
56
|
'Group',
|
58
57
|
'Paragraph',
|
59
|
-
'Pullquote',
|
60
58
|
'Heading',
|
61
59
|
'Table of Contents',
|
62
60
|
] )
|
@@ -28,7 +28,7 @@ describe( 'Compatibility with classic editor', () => {
|
|
28
28
|
await viewPostLinks[ 0 ].click();
|
29
29
|
await page.waitForNavigation();
|
30
30
|
|
31
|
-
// Check the
|
31
|
+
// Check the content doesn't contain <p> tags.
|
32
32
|
await page.waitForSelector( '.entry-content' );
|
33
33
|
const content = await page.$eval( '.entry-content', ( element ) =>
|
34
34
|
element.innerHTML.trim()
|
@@ -45,17 +45,13 @@ function trimLeadingZero( str ) {
|
|
45
45
|
return str[ 0 ] === '0' ? str.slice( 1 ) : str;
|
46
46
|
}
|
47
47
|
|
48
|
-
function formatDatePickerValues(
|
49
|
-
year,
|
50
|
-
|
51
|
-
|
52
|
-
hours,
|
53
|
-
minutes,
|
54
|
-
amOrPm,
|
55
|
-
} ) {
|
48
|
+
function formatDatePickerValues(
|
49
|
+
{ year, monthLabel, day, hours, minutes, amOrPm },
|
50
|
+
timezone
|
51
|
+
) {
|
56
52
|
const dayTrimmed = trimLeadingZero( day );
|
57
53
|
const hoursTrimmed = trimLeadingZero( hours );
|
58
|
-
return `${ monthLabel } ${ dayTrimmed }, ${ year } ${ hoursTrimmed }:${ minutes }
|
54
|
+
return `${ monthLabel } ${ dayTrimmed }, ${ year } ${ hoursTrimmed }:${ minutes }\xa0${ amOrPm } ${ timezone }`;
|
59
55
|
}
|
60
56
|
|
61
57
|
async function getPublishingDate() {
|
@@ -70,11 +66,13 @@ describe.each( [ [ 'UTC-10' ], [ 'UTC' ], [ 'UTC+10' ] ] )(
|
|
70
66
|
( timezone ) => {
|
71
67
|
let oldTimezone;
|
72
68
|
beforeEach( async () => {
|
69
|
+
await page.emulateTimezone( 'America/New_York' ); // Set browser to a timezone that's different to `timezone`.
|
73
70
|
oldTimezone = await changeSiteTimezone( timezone );
|
74
71
|
await createNewPost();
|
75
72
|
} );
|
76
73
|
afterEach( async () => {
|
77
74
|
await changeSiteTimezone( oldTimezone );
|
75
|
+
await page.emulateTimezone( null );
|
78
76
|
} );
|
79
77
|
|
80
78
|
it( 'should show the publishing date as "Immediately" if the date is not altered', async () => {
|
@@ -98,7 +96,7 @@ describe.each( [ [ 'UTC-10' ], [ 'UTC' ], [ 'UTC+10' ] ] )(
|
|
98
96
|
const publishingDate = await getPublishingDate();
|
99
97
|
|
100
98
|
expect( publishingDate ).toBe(
|
101
|
-
formatDatePickerValues( datePickerValues )
|
99
|
+
formatDatePickerValues( datePickerValues, timezone )
|
102
100
|
);
|
103
101
|
} );
|
104
102
|
|
@@ -119,7 +117,7 @@ describe.each( [ [ 'UTC-10' ], [ 'UTC' ], [ 'UTC+10' ] ] )(
|
|
119
117
|
expect( publishingDate ).not.toEqual( 'Immediately' );
|
120
118
|
// The expected date format will be "Sep 26, 2018 11:52 pm".
|
121
119
|
expect( publishingDate ).toBe(
|
122
|
-
formatDatePickerValues( datePickerValues )
|
120
|
+
formatDatePickerValues( datePickerValues, timezone )
|
123
121
|
);
|
124
122
|
} );
|
125
123
|
|
@@ -392,7 +392,7 @@ describe( 'Links', () => {
|
|
392
392
|
await page.waitForSelector( '.block-editor-link-control__search-item' );
|
393
393
|
await page.keyboard.press( 'ArrowDown' );
|
394
394
|
|
395
|
-
// Expect the
|
395
|
+
// Expect the escape key to dismiss the popover when the autocomplete suggestion list is open.
|
396
396
|
await page.keyboard.press( 'Escape' );
|
397
397
|
expect(
|
398
398
|
await page.$(
|
@@ -417,7 +417,7 @@ describe( 'Links', () => {
|
|
417
417
|
)
|
418
418
|
).not.toBeNull();
|
419
419
|
|
420
|
-
// Expect the
|
420
|
+
// Expect the escape key to dismiss the popover normally.
|
421
421
|
await page.keyboard.press( 'Escape' );
|
422
422
|
expect(
|
423
423
|
await page.$(
|
@@ -440,7 +440,7 @@ describe( 'Links', () => {
|
|
440
440
|
await page.keyboard.press( 'Tab' );
|
441
441
|
await page.keyboard.press( 'Tab' );
|
442
442
|
|
443
|
-
// Expect the
|
443
|
+
// Expect the escape key to dismiss the popover normally.
|
444
444
|
await page.keyboard.press( 'Escape' );
|
445
445
|
expect(
|
446
446
|
await page.$(
|
@@ -108,7 +108,6 @@ describe( 'Multi-block selection', () => {
|
|
108
108
|
await pressKeyWithModifier( 'primary', 'a' );
|
109
109
|
await pressKeyWithModifier( 'primary', 'a' );
|
110
110
|
|
111
|
-
await testNativeSelection();
|
112
111
|
expect( await getSelectedFlatIndices() ).toEqual( [ 1, 2, 3 ] );
|
113
112
|
|
114
113
|
// TODO: It would be great to do this test by spying on `wp.a11y.speak`,
|
@@ -420,7 +419,6 @@ describe( 'Multi-block selection', () => {
|
|
420
419
|
await page.mouse.move( coord2.x, coord2.y, { steps: 10 } );
|
421
420
|
await page.mouse.up();
|
422
421
|
|
423
|
-
await testNativeSelection();
|
424
422
|
expect( await getSelectedFlatIndices() ).toEqual( [ 1, 2 ] );
|
425
423
|
} );
|
426
424
|
|
@@ -720,9 +718,8 @@ describe( 'Multi-block selection', () => {
|
|
720
718
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
721
719
|
|
722
720
|
// Clear the selected block.
|
723
|
-
|
724
|
-
|
725
|
-
await page.mouse.click( box.x - 1, box.y );
|
721
|
+
await page.keyboard.press( 'Escape' );
|
722
|
+
await page.keyboard.press( 'Escape' );
|
726
723
|
|
727
724
|
await pressKeyWithModifier( 'primary', 'a' );
|
728
725
|
|
@@ -908,30 +905,6 @@ describe( 'Multi-block selection', () => {
|
|
908
905
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
909
906
|
} );
|
910
907
|
|
911
|
-
it( 'should merge into quote with correct selection', async () => {
|
912
|
-
await clickBlockAppender();
|
913
|
-
await page.keyboard.type( '> 1[' );
|
914
|
-
await page.keyboard.press( 'Enter' );
|
915
|
-
await page.keyboard.press( 'Enter' );
|
916
|
-
await page.keyboard.type( ']2' );
|
917
|
-
await page.keyboard.press( 'ArrowLeft' );
|
918
|
-
// Select everything between [].
|
919
|
-
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
920
|
-
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
921
|
-
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
922
|
-
|
923
|
-
// Test setup.
|
924
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
925
|
-
|
926
|
-
await page.keyboard.press( 'Backspace' );
|
927
|
-
|
928
|
-
// Ensure selection is in the correct place.
|
929
|
-
await page.keyboard.type( '&' );
|
930
|
-
|
931
|
-
// Expect two blocks with "&" in between.
|
932
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
933
|
-
} );
|
934
|
-
|
935
908
|
it( 'should select separator (single element block)', async () => {
|
936
909
|
await clickBlockAppender();
|
937
910
|
await page.keyboard.type( '/hr' );
|
@@ -19,7 +19,7 @@ describe( 'Post visibility', () => {
|
|
19
19
|
|
20
20
|
await openDocumentSettingsSidebar();
|
21
21
|
|
22
|
-
await page.click( '
|
22
|
+
await page.click( '*[aria-label^="Select visibility"]' );
|
23
23
|
|
24
24
|
const [ privateLabel ] = await page.$x(
|
25
25
|
'//label[text()="Private"]'
|
@@ -57,7 +57,7 @@ describe( 'Post visibility', () => {
|
|
57
57
|
.getEditedPostAttribute( 'status' );
|
58
58
|
} );
|
59
59
|
|
60
|
-
await page.click( '
|
60
|
+
await page.click( '*[aria-label^="Select visibility"]' );
|
61
61
|
|
62
62
|
const [ privateLabel ] = await page.$x(
|
63
63
|
'//label[text()="Private"]'
|
@@ -90,7 +90,7 @@ describe( 'Post visibility', () => {
|
|
90
90
|
await openDocumentSettingsSidebar();
|
91
91
|
|
92
92
|
// Set a publish date for the next month.
|
93
|
-
await page.click( '
|
93
|
+
await page.click( '*[aria-label^="Change date"]' );
|
94
94
|
await page.click(
|
95
95
|
'*[aria-label="Move forward to switch to the next month."]'
|
96
96
|
);
|
@@ -100,7 +100,7 @@ describe( 'Post visibility', () => {
|
|
100
100
|
)
|
101
101
|
)[ 0 ].click();
|
102
102
|
|
103
|
-
await page.click( '
|
103
|
+
await page.click( '*[aria-label^="Select visibility"]' );
|
104
104
|
|
105
105
|
const [ privateLabel ] = await page.$x( '//label[text()="Private"]' );
|
106
106
|
await privateLabel.click();
|
@@ -364,6 +364,8 @@ describe( 'Reusable blocks', () => {
|
|
364
364
|
'.block-editor-block-list__block[aria-label="Block: Quote"]'
|
365
365
|
);
|
366
366
|
await quoteBlock.click();
|
367
|
+
// Select the quote block.
|
368
|
+
await page.keyboard.press( 'ArrowDown' );
|
367
369
|
await openDocumentSettingsSidebar();
|
368
370
|
await page.waitForXPath(
|
369
371
|
'//*[@role="region"][@aria-label="Editor settings"]//button[.="Styles"]'
|
@@ -39,7 +39,7 @@ describe( 'Scheduling', () => {
|
|
39
39
|
expect( await getPublishButtonText() ).toBe( 'Publish' );
|
40
40
|
|
41
41
|
// Open the datepicker.
|
42
|
-
await page.click( '
|
42
|
+
await page.click( '*[aria-label^="Change date"]' );
|
43
43
|
|
44
44
|
// Change the publishing date to a year in the future.
|
45
45
|
await page.click( '.components-datetime__time-field-year' );
|
@@ -56,7 +56,7 @@ describe( 'Scheduling', () => {
|
|
56
56
|
it( 'Should keep date time UI focused when the previous and next month buttons are clicked', async () => {
|
57
57
|
await createNewPost();
|
58
58
|
|
59
|
-
await page.click( '
|
59
|
+
await page.click( '*[aria-label^="Change date"]' );
|
60
60
|
await page.click(
|
61
61
|
'*[aria-label="Move backward to switch to the previous month."]'
|
62
62
|
);
|
@@ -5,17 +5,16 @@ import {
|
|
5
5
|
activatePlugin,
|
6
6
|
createNewPost,
|
7
7
|
deactivatePlugin,
|
8
|
-
findSidebarPanelWithTitle,
|
9
8
|
publishPost,
|
10
9
|
} from '@wordpress/e2e-test-utils';
|
11
10
|
|
12
|
-
const
|
11
|
+
const urlButtonSelector = '*[aria-label^="Change URL"]';
|
13
12
|
|
14
13
|
// This tests are not together with the remaining sidebar tests,
|
15
|
-
// because we need to publish/save a post, to correctly test the permalink
|
14
|
+
// because we need to publish/save a post, to correctly test the permalink row.
|
16
15
|
// The sidebar test suit enforces that focus is never lost, but during save operations
|
17
16
|
// the focus is lost and a new element is focused once the save is completed.
|
18
|
-
describe( 'Sidebar Permalink
|
17
|
+
describe( 'Sidebar Permalink', () => {
|
19
18
|
beforeAll( async () => {
|
20
19
|
await activatePlugin( 'gutenberg-test-custom-post-types' );
|
21
20
|
} );
|
@@ -24,39 +23,30 @@ describe( 'Sidebar Permalink Panel', () => {
|
|
24
23
|
await deactivatePlugin( 'gutenberg-test-custom-post-types' );
|
25
24
|
} );
|
26
25
|
|
27
|
-
it( 'should
|
28
|
-
await createNewPost();
|
29
|
-
await page.evaluate( () => {
|
30
|
-
const { removeEditorPanel } = wp.data.dispatch( 'core/edit-post' );
|
31
|
-
removeEditorPanel( 'post-link' );
|
32
|
-
} );
|
33
|
-
expect( await page.$x( permalinkPanelXPath ) ).toEqual( [] );
|
34
|
-
} );
|
35
|
-
|
36
|
-
it( 'should not render link panel when post is publicly queryable but not public', async () => {
|
26
|
+
it( 'should not render URL when post is publicly queryable but not public', async () => {
|
37
27
|
await createNewPost( { postType: 'public_q_not_public' } );
|
38
28
|
await page.keyboard.type( 'aaaaa' );
|
39
29
|
await publishPost();
|
40
30
|
// Start editing again.
|
41
31
|
await page.type( '.editor-post-title__input', ' (Updated)' );
|
42
|
-
expect( await page.$
|
32
|
+
expect( await page.$( urlButtonSelector ) ).toBeNull();
|
43
33
|
} );
|
44
34
|
|
45
|
-
it( 'should not render
|
35
|
+
it( 'should not render URL when post is public but not publicly queryable', async () => {
|
46
36
|
await createNewPost( { postType: 'not_public_q_public' } );
|
47
37
|
await page.keyboard.type( 'aaaaa' );
|
48
38
|
await publishPost();
|
49
39
|
// Start editing again.
|
50
40
|
await page.type( '.editor-post-title__input', ' (Updated)' );
|
51
|
-
expect( await page.$
|
41
|
+
expect( await page.$( urlButtonSelector ) ).toBeNull();
|
52
42
|
} );
|
53
43
|
|
54
|
-
it( 'should render
|
44
|
+
it( 'should render URL when post is public and publicly queryable', async () => {
|
55
45
|
await createNewPost( { postType: 'public_q_public' } );
|
56
46
|
await page.keyboard.type( 'aaaaa' );
|
57
47
|
await publishPost();
|
58
48
|
// Start editing again.
|
59
49
|
await page.type( '.editor-post-title__input', ' (Updated)' );
|
60
|
-
expect( await
|
50
|
+
expect( await page.$( urlButtonSelector ) ).not.toBeNull();
|
61
51
|
} );
|
62
52
|
} );
|
@@ -131,9 +131,7 @@ describe( 'Sidebar', () => {
|
|
131
131
|
).toBeDefined();
|
132
132
|
expect( await findSidebarPanelWithTitle( 'Excerpt' ) ).toBeDefined();
|
133
133
|
expect( await findSidebarPanelWithTitle( 'Discussion' ) ).toBeDefined();
|
134
|
-
expect(
|
135
|
-
await findSidebarPanelWithTitle( 'Status & visibility' )
|
136
|
-
).toBeDefined();
|
134
|
+
expect( await findSidebarPanelWithTitle( 'Summary' ) ).toBeDefined();
|
137
135
|
|
138
136
|
await page.evaluate( () => {
|
139
137
|
const { removeEditorPanel } = wp.data.dispatch( 'core/edit-post' );
|
@@ -165,8 +163,8 @@ describe( 'Sidebar', () => {
|
|
165
163
|
expect(
|
166
164
|
await page.$x( getPanelToggleSelector( 'Discussion' ) )
|
167
165
|
).toEqual( [] );
|
168
|
-
expect(
|
169
|
-
|
170
|
-
)
|
166
|
+
expect( await page.$x( getPanelToggleSelector( 'Summary' ) ) ).toEqual(
|
167
|
+
[]
|
168
|
+
);
|
171
169
|
} );
|
172
170
|
} );
|
@@ -31,7 +31,7 @@ describe( 'TypeWriter', () => {
|
|
31
31
|
|
32
32
|
expect( await getCaretPosition() ).toBeGreaterThan( initialPosition );
|
33
33
|
|
34
|
-
// Create blocks until the
|
34
|
+
// Create blocks until the typewriter effect kicks in.
|
35
35
|
while (
|
36
36
|
await page.evaluate(
|
37
37
|
() =>
|
@@ -173,7 +173,7 @@ describe( 'TypeWriter', () => {
|
|
173
173
|
|
174
174
|
let count = 0;
|
175
175
|
|
176
|
-
// Create blocks until the
|
176
|
+
// Create blocks until the typewriter effect kicks in, create at
|
177
177
|
// least 10 blocks to properly test the .
|
178
178
|
while (
|
179
179
|
( await page.evaluate(
|
@@ -282,7 +282,7 @@ describe( 'Writing Flow', () => {
|
|
282
282
|
} );
|
283
283
|
|
284
284
|
it( 'should not create extra line breaks in multiline value', async () => {
|
285
|
-
await insertBlock( '
|
285
|
+
await insertBlock( 'List' );
|
286
286
|
await page.keyboard.type( 'a' );
|
287
287
|
await page.keyboard.press( 'Backspace' );
|
288
288
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
@@ -753,4 +753,77 @@ describe( 'Writing Flow', () => {
|
|
753
753
|
);
|
754
754
|
expect( paragraphs ).toEqual( [ 'first', 'second' ] );
|
755
755
|
} );
|
756
|
+
|
757
|
+
it( 'should move to the start of the first line on ArrowUp', async () => {
|
758
|
+
await page.keyboard.press( 'Enter' );
|
759
|
+
await page.keyboard.type( 'a' );
|
760
|
+
|
761
|
+
async function getHeight() {
|
762
|
+
return await page.evaluate(
|
763
|
+
() => document.activeElement.offsetHeight
|
764
|
+
);
|
765
|
+
}
|
766
|
+
|
767
|
+
const height = await getHeight();
|
768
|
+
|
769
|
+
// Keep typing until the height of the element increases. We need two
|
770
|
+
// lines.
|
771
|
+
while ( height === ( await getHeight() ) ) {
|
772
|
+
await page.keyboard.type( 'a' );
|
773
|
+
}
|
774
|
+
|
775
|
+
// Move to the start of the second line.
|
776
|
+
await page.keyboard.press( 'ArrowLeft' );
|
777
|
+
// Move to the start of the first line.
|
778
|
+
await page.keyboard.press( 'ArrowUp' );
|
779
|
+
// Insert a "." for testing.
|
780
|
+
await page.keyboard.type( '.' );
|
781
|
+
|
782
|
+
// Expect the "." to be added at the start of the paragraph.
|
783
|
+
expect(
|
784
|
+
await page.evaluate( () =>
|
785
|
+
document.activeElement.getAttribute( 'data-type' )
|
786
|
+
)
|
787
|
+
).toBe( 'core/paragraph' );
|
788
|
+
expect(
|
789
|
+
await page.evaluate( () => document.activeElement.textContent )
|
790
|
+
).toMatch( /^\.a+$/ );
|
791
|
+
} );
|
792
|
+
|
793
|
+
it( 'should vertically move the caret from corner to corner', async () => {
|
794
|
+
await page.keyboard.press( 'Enter' );
|
795
|
+
await page.keyboard.type( 'a' );
|
796
|
+
|
797
|
+
async function getHeight() {
|
798
|
+
return await page.evaluate(
|
799
|
+
() => document.activeElement.offsetHeight
|
800
|
+
);
|
801
|
+
}
|
802
|
+
|
803
|
+
const height = await getHeight();
|
804
|
+
|
805
|
+
// Keep typing until the height of the element increases. We need two
|
806
|
+
// lines.
|
807
|
+
while ( height === ( await getHeight() ) ) {
|
808
|
+
await page.keyboard.type( 'a' );
|
809
|
+
}
|
810
|
+
|
811
|
+
// Create a new paragraph.
|
812
|
+
await page.keyboard.press( 'Enter' );
|
813
|
+
// Move to the start of the first line.
|
814
|
+
await page.keyboard.press( 'ArrowUp' );
|
815
|
+
// Insert a "." for testing.
|
816
|
+
await page.keyboard.type( '.' );
|
817
|
+
|
818
|
+
// Expect the "." to be added at the start of the second line.
|
819
|
+
// It should not be added to the first line!
|
820
|
+
expect(
|
821
|
+
await page.evaluate( () =>
|
822
|
+
document.activeElement.getAttribute( 'data-type' )
|
823
|
+
)
|
824
|
+
).toBe( 'core/paragraph' );
|
825
|
+
expect(
|
826
|
+
await page.evaluate( () => document.activeElement.textContent )
|
827
|
+
).toMatch( /^a+\.a$/ );
|
828
|
+
} );
|
756
829
|
} );
|
@@ -1,33 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Buttons can jump to the link editor using the keyboard shortcut 1`] = `
|
4
|
-
"<!-- wp:buttons -->
|
5
|
-
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
|
6
|
-
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\" href=\\"https://www.wordpress.org/\\">WordPress</a></div>
|
7
|
-
<!-- /wp:button --></div>
|
8
|
-
<!-- /wp:buttons -->"
|
9
|
-
`;
|
10
|
-
|
11
|
-
exports[`Buttons dismisses link editor when escape is pressed 1`] = `
|
12
|
-
"<!-- wp:buttons -->
|
13
|
-
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
|
14
|
-
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\">WordPress</a></div>
|
15
|
-
<!-- /wp:button --></div>
|
16
|
-
<!-- /wp:buttons -->"
|
17
|
-
`;
|
18
|
-
|
19
|
-
exports[`Buttons has focus on button content (slash inserter) 1`] = `
|
20
|
-
"<!-- wp:buttons -->
|
21
|
-
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
|
22
|
-
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\">Content</a></div>
|
23
|
-
<!-- /wp:button --></div>
|
24
|
-
<!-- /wp:buttons -->"
|
25
|
-
`;
|
26
|
-
|
27
|
-
exports[`Buttons has focus on button content 1`] = `
|
28
|
-
"<!-- wp:buttons -->
|
29
|
-
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
|
30
|
-
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\">Content</a></div>
|
31
|
-
<!-- /wp:button --></div>
|
32
|
-
<!-- /wp:buttons -->"
|
33
|
-
`;
|