@wordpress/e2e-tests 7.13.8 → 7.15.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/plugins/iframed-inline-styles.php +0 -7
- package/plugins/iframed-masonry-block.php +0 -7
- package/plugins/iframed-multiple-stylesheets.php +0 -7
- package/specs/editor/various/change-detection.test.js +1 -0
- package/specs/editor/various/datepicker.test.js +1 -3
- package/specs/editor/various/scheduling.test.js +1 -3
- package/specs/editor/blocks/post-title.test.js +0 -36
- package/specs/editor/plugins/__snapshots__/iframed-inline-styles.test.js.snap +0 -7
- package/specs/editor/plugins/__snapshots__/iframed-masonry-block.test.js.snap +0 -7
- package/specs/editor/plugins/iframed-enqueue-block-editor-settings.test.js +0 -108
- package/specs/editor/plugins/iframed-inline-styles.test.js +0 -56
- package/specs/editor/plugins/iframed-masonry-block.test.js +0 -49
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +0 -58
- package/specs/editor/various/__snapshots__/keyboard-navigable-blocks.test.js.snap +0 -19
- package/specs/editor/various/__snapshots__/links.test.js.snap +0 -49
- package/specs/editor/various/format-library/__snapshots__/text-color.test.js.snap +0 -13
- package/specs/editor/various/format-library/text-color.test.js +0 -46
- package/specs/editor/various/keyboard-navigable-blocks.test.js +0 -239
- package/specs/editor/various/links.test.js +0 -916
- package/specs/local/demo.test.js +0 -50
- package/specs/site-editor/global-styles-sidebar.test.js +0 -45
@@ -1,239 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
createNewPost,
|
6
|
-
insertBlock,
|
7
|
-
pressKeyWithModifier,
|
8
|
-
clickBlockAppender,
|
9
|
-
getEditedPostContent,
|
10
|
-
showBlockToolbar,
|
11
|
-
canvas,
|
12
|
-
} from '@wordpress/e2e-test-utils';
|
13
|
-
|
14
|
-
async function getActiveLabel() {
|
15
|
-
return await page.evaluate( () => {
|
16
|
-
const { activeElement } =
|
17
|
-
document.activeElement.contentDocument ?? document;
|
18
|
-
return (
|
19
|
-
activeElement.getAttribute( 'aria-label' ) ||
|
20
|
-
activeElement.innerHTML
|
21
|
-
);
|
22
|
-
} );
|
23
|
-
}
|
24
|
-
|
25
|
-
const navigateToContentEditorTop = async () => {
|
26
|
-
// Use 'Ctrl+`' to return to the top of the editor.
|
27
|
-
await pressKeyWithModifier( 'ctrl', '`' );
|
28
|
-
await pressKeyWithModifier( 'ctrl', '`' );
|
29
|
-
await pressKeyWithModifier( 'ctrl', '`' );
|
30
|
-
await pressKeyWithModifier( 'ctrl', '`' );
|
31
|
-
await pressKeyWithModifier( 'ctrl', '`' );
|
32
|
-
};
|
33
|
-
|
34
|
-
const tabThroughParagraphBlock = async ( paragraphText ) => {
|
35
|
-
await tabThroughBlockToolbar();
|
36
|
-
|
37
|
-
await page.keyboard.press( 'Tab' );
|
38
|
-
await expect( await getActiveLabel() ).toBe( 'Block: Paragraph' );
|
39
|
-
await expect(
|
40
|
-
await page.evaluate( () => {
|
41
|
-
const { activeElement } =
|
42
|
-
document.activeElement.contentDocument ?? document;
|
43
|
-
return activeElement.innerHTML;
|
44
|
-
} )
|
45
|
-
).toBe( paragraphText );
|
46
|
-
|
47
|
-
await page.keyboard.press( 'Tab' );
|
48
|
-
await expect( await getActiveLabel() ).toBe( 'Open document settings' );
|
49
|
-
|
50
|
-
// Need to shift+tab here to end back in the block. If not, we'll be in the next region and it will only require 4 region jumps instead of 5.
|
51
|
-
await pressKeyWithModifier( 'shift', 'Tab' );
|
52
|
-
await expect( await getActiveLabel() ).toBe( 'Block: Paragraph' );
|
53
|
-
};
|
54
|
-
|
55
|
-
const tabThroughBlockToolbar = async () => {
|
56
|
-
await page.keyboard.press( 'Tab' );
|
57
|
-
await expect( await getActiveLabel() ).toBe( 'Paragraph' );
|
58
|
-
|
59
|
-
await page.keyboard.press( 'ArrowRight' );
|
60
|
-
await expect( await getActiveLabel() ).toBe( 'Move up' );
|
61
|
-
|
62
|
-
await page.keyboard.press( 'ArrowRight' );
|
63
|
-
await expect( await getActiveLabel() ).toBe( 'Move down' );
|
64
|
-
|
65
|
-
await page.keyboard.press( 'ArrowRight' );
|
66
|
-
await expect( await getActiveLabel() ).toBe( 'Align text' );
|
67
|
-
|
68
|
-
await page.keyboard.press( 'ArrowRight' );
|
69
|
-
await expect( await getActiveLabel() ).toBe( 'Bold' );
|
70
|
-
|
71
|
-
await page.keyboard.press( 'ArrowRight' );
|
72
|
-
await expect( await getActiveLabel() ).toBe( 'Italic' );
|
73
|
-
|
74
|
-
await page.keyboard.press( 'ArrowRight' );
|
75
|
-
await expect( await getActiveLabel() ).toBe( 'Link' );
|
76
|
-
|
77
|
-
await page.keyboard.press( 'ArrowRight' );
|
78
|
-
await expect( await getActiveLabel() ).toBe( 'More' );
|
79
|
-
|
80
|
-
await page.keyboard.press( 'ArrowRight' );
|
81
|
-
await expect( await getActiveLabel() ).toBe( 'Options' );
|
82
|
-
|
83
|
-
await page.keyboard.press( 'ArrowRight' );
|
84
|
-
await expect( await getActiveLabel() ).toBe( 'Paragraph' );
|
85
|
-
};
|
86
|
-
|
87
|
-
describe( 'Order of block keyboard navigation', () => {
|
88
|
-
beforeEach( async () => {
|
89
|
-
await createNewPost();
|
90
|
-
} );
|
91
|
-
|
92
|
-
it( 'permits tabbing through paragraph blocks in the expected order', async () => {
|
93
|
-
const paragraphBlocks = [ 'Paragraph 0', 'Paragraph 1', 'Paragraph 2' ];
|
94
|
-
|
95
|
-
// Create 3 paragraphs blocks with some content.
|
96
|
-
for ( const paragraphBlock of paragraphBlocks ) {
|
97
|
-
await insertBlock( 'Paragraph' );
|
98
|
-
await page.keyboard.type( paragraphBlock );
|
99
|
-
}
|
100
|
-
|
101
|
-
// Select the middle block.
|
102
|
-
await page.keyboard.press( 'ArrowUp' );
|
103
|
-
await showBlockToolbar();
|
104
|
-
await navigateToContentEditorTop();
|
105
|
-
await tabThroughParagraphBlock( 'Paragraph 1' );
|
106
|
-
|
107
|
-
// Repeat the same steps to ensure that there is no change introduced in how the focus is handled.
|
108
|
-
// This prevents the previous regression explained in: https://github.com/WordPress/gutenberg/issues/11773.
|
109
|
-
await navigateToContentEditorTop();
|
110
|
-
await tabThroughParagraphBlock( 'Paragraph 1' );
|
111
|
-
} );
|
112
|
-
|
113
|
-
it( 'allows tabbing in navigation mode if no block is selected', async () => {
|
114
|
-
const paragraphBlocks = [ '0', '1' ];
|
115
|
-
|
116
|
-
// Create 2 paragraphs blocks with some content.
|
117
|
-
for ( const paragraphBlock of paragraphBlocks ) {
|
118
|
-
await insertBlock( 'Paragraph' );
|
119
|
-
await page.keyboard.type( paragraphBlock );
|
120
|
-
}
|
121
|
-
|
122
|
-
// Clear the selected block.
|
123
|
-
const paragraph = await canvas().$( '[data-type="core/paragraph"]' );
|
124
|
-
const box = await paragraph.boundingBox();
|
125
|
-
await page.mouse.click( box.x - 1, box.y );
|
126
|
-
|
127
|
-
await page.keyboard.press( 'Tab' );
|
128
|
-
await expect( await getActiveLabel() ).toBe( 'Add title' );
|
129
|
-
|
130
|
-
await page.keyboard.press( 'Tab' );
|
131
|
-
await expect( await getActiveLabel() ).toBe(
|
132
|
-
'Paragraph Block. Row 1. 0'
|
133
|
-
);
|
134
|
-
|
135
|
-
await page.keyboard.press( 'Tab' );
|
136
|
-
await expect( await getActiveLabel() ).toBe(
|
137
|
-
'Paragraph Block. Row 2. 1'
|
138
|
-
);
|
139
|
-
|
140
|
-
await page.keyboard.press( 'Tab' );
|
141
|
-
await expect( await getActiveLabel() ).toBe( 'Open document settings' );
|
142
|
-
} );
|
143
|
-
|
144
|
-
it( 'allows tabbing in navigation mode if no block is selected (reverse)', async () => {
|
145
|
-
const paragraphBlocks = [ '0', '1' ];
|
146
|
-
|
147
|
-
// Create 2 paragraphs blocks with some content.
|
148
|
-
for ( const paragraphBlock of paragraphBlocks ) {
|
149
|
-
await insertBlock( 'Paragraph' );
|
150
|
-
await page.keyboard.type( paragraphBlock );
|
151
|
-
}
|
152
|
-
|
153
|
-
// Clear the selected block.
|
154
|
-
const paragraph = await canvas().$( '[data-type="core/paragraph"]' );
|
155
|
-
const box = await paragraph.boundingBox();
|
156
|
-
await page.mouse.click( box.x - 1, box.y );
|
157
|
-
|
158
|
-
// Put focus behind the block list.
|
159
|
-
await page.evaluate( () => {
|
160
|
-
document
|
161
|
-
.querySelector( '.interface-interface-skeleton__sidebar' )
|
162
|
-
.focus();
|
163
|
-
} );
|
164
|
-
|
165
|
-
await pressKeyWithModifier( 'shift', 'Tab' );
|
166
|
-
await expect( await getActiveLabel() ).toBe( 'Add block' );
|
167
|
-
|
168
|
-
await pressKeyWithModifier( 'shift', 'Tab' );
|
169
|
-
await expect( await getActiveLabel() ).toBe( 'Add default block' );
|
170
|
-
|
171
|
-
await pressKeyWithModifier( 'shift', 'Tab' );
|
172
|
-
await expect( await getActiveLabel() ).toBe(
|
173
|
-
'Paragraph Block. Row 2. 1'
|
174
|
-
);
|
175
|
-
|
176
|
-
await pressKeyWithModifier( 'shift', 'Tab' );
|
177
|
-
await expect( await getActiveLabel() ).toBe(
|
178
|
-
'Paragraph Block. Row 1. 0'
|
179
|
-
);
|
180
|
-
|
181
|
-
await pressKeyWithModifier( 'shift', 'Tab' );
|
182
|
-
await expect( await getActiveLabel() ).toBe( 'Add title' );
|
183
|
-
} );
|
184
|
-
|
185
|
-
it( 'should navigate correctly with multi selection', async () => {
|
186
|
-
await clickBlockAppender();
|
187
|
-
await page.keyboard.type( '1' );
|
188
|
-
await page.keyboard.press( 'Enter' );
|
189
|
-
await page.keyboard.type( '2' );
|
190
|
-
await page.keyboard.press( 'Enter' );
|
191
|
-
await page.keyboard.type( '3' );
|
192
|
-
await page.keyboard.press( 'Enter' );
|
193
|
-
await page.keyboard.type( '4' );
|
194
|
-
await page.keyboard.press( 'ArrowUp' );
|
195
|
-
await pressKeyWithModifier( 'shift', 'ArrowUp' );
|
196
|
-
|
197
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
198
|
-
|
199
|
-
expect( await getActiveLabel() ).toBe( 'Multiple selected blocks' );
|
200
|
-
|
201
|
-
await page.keyboard.press( 'Tab' );
|
202
|
-
await expect( await getActiveLabel() ).toBe( 'Post' );
|
203
|
-
|
204
|
-
await pressKeyWithModifier( 'shift', 'Tab' );
|
205
|
-
await expect( await getActiveLabel() ).toBe(
|
206
|
-
'Multiple selected blocks'
|
207
|
-
);
|
208
|
-
|
209
|
-
await pressKeyWithModifier( 'shift', 'Tab' );
|
210
|
-
await page.keyboard.press( 'ArrowRight' );
|
211
|
-
await expect( await getActiveLabel() ).toBe( 'Move up' );
|
212
|
-
} );
|
213
|
-
|
214
|
-
it( 'allows the first element within a block to receive focus', async () => {
|
215
|
-
// Insert a image block.
|
216
|
-
await insertBlock( 'Image' );
|
217
|
-
|
218
|
-
// Make sure the upload button has focus.
|
219
|
-
const uploadButton = await canvas().waitForXPath(
|
220
|
-
'//button[contains( text(), "Upload" ) ]'
|
221
|
-
);
|
222
|
-
await expect( uploadButton ).toHaveFocus();
|
223
|
-
|
224
|
-
// Try to focus the image block wrapper.
|
225
|
-
await page.keyboard.press( 'ArrowUp' );
|
226
|
-
await expect( await getActiveLabel() ).toBe( 'Block: Image' );
|
227
|
-
} );
|
228
|
-
|
229
|
-
it( 'allows the block wrapper to gain focus for a group block instead of the first element', async () => {
|
230
|
-
// Insert a group block.
|
231
|
-
await insertBlock( 'Group' );
|
232
|
-
// Select the default, selected Group layout from the variation picker.
|
233
|
-
await canvas().click(
|
234
|
-
'button[aria-label="Group: Gather blocks in a container."]'
|
235
|
-
);
|
236
|
-
// If active label matches, that means focus did not change from group block wrapper.
|
237
|
-
await expect( await getActiveLabel() ).toBe( 'Block: Group' );
|
238
|
-
} );
|
239
|
-
} );
|