@wordpress/e2e-tests 4.5.0 → 4.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/package.json +5 -5
- package/specs/editor/blocks/navigation.test.js +8 -12
- package/specs/editor/plugins/iframed-block.test.js +3 -2
- package/specs/editor/plugins/iframed-masonry-block.test.js +3 -2
- package/specs/editor/various/datepicker.test.js +9 -11
- package/specs/editor/various/sidebar.test.js +4 -6
- package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +0 -33
- 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/spacer.test.js +0 -48
- package/specs/editor/blocks/table.test.js +0 -295
- package/specs/editor/various/__snapshots__/rtl.test.js.snap +0 -63
- 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
@@ -1,295 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
clickButton,
|
6
|
-
clickBlockToolbarButton,
|
7
|
-
createNewPost,
|
8
|
-
getEditedPostContent,
|
9
|
-
insertBlock,
|
10
|
-
openDocumentSettingsSidebar,
|
11
|
-
} from '@wordpress/e2e-test-utils';
|
12
|
-
|
13
|
-
const createButtonLabel = 'Create Table';
|
14
|
-
|
15
|
-
/**
|
16
|
-
* Utility function for changing the selected cell alignment.
|
17
|
-
*
|
18
|
-
* @param {string} align The alignment (one of 'left', 'center', or 'right').
|
19
|
-
*/
|
20
|
-
async function changeCellAlignment( align ) {
|
21
|
-
await clickBlockToolbarButton( 'Change column alignment' );
|
22
|
-
await clickButton( `Align column ${ align.toLowerCase() }` );
|
23
|
-
}
|
24
|
-
|
25
|
-
describe( 'Table', () => {
|
26
|
-
beforeEach( async () => {
|
27
|
-
await createNewPost();
|
28
|
-
} );
|
29
|
-
|
30
|
-
it( 'displays a form for choosing the row and column count of the table', async () => {
|
31
|
-
await insertBlock( 'Table' );
|
32
|
-
|
33
|
-
// Check for existence of the column count field.
|
34
|
-
const columnCountLabel = await page.$x(
|
35
|
-
"//figure[@data-type='core/table']//label[text()='Column count']"
|
36
|
-
);
|
37
|
-
expect( columnCountLabel ).toHaveLength( 1 );
|
38
|
-
|
39
|
-
// Modify the column count.
|
40
|
-
await columnCountLabel[ 0 ].click();
|
41
|
-
const currentColumnCount = await page.evaluate(
|
42
|
-
() => document.activeElement.value
|
43
|
-
);
|
44
|
-
expect( currentColumnCount ).toBe( '2' );
|
45
|
-
await page.keyboard.press( 'Backspace' );
|
46
|
-
await page.keyboard.type( '5' );
|
47
|
-
|
48
|
-
// Check for existence of the row count field.
|
49
|
-
const rowCountLabel = await page.$x(
|
50
|
-
"//figure[@data-type='core/table']//label[text()='Row count']"
|
51
|
-
);
|
52
|
-
expect( rowCountLabel ).toHaveLength( 1 );
|
53
|
-
|
54
|
-
// Modify the row count.
|
55
|
-
await rowCountLabel[ 0 ].click();
|
56
|
-
const currentRowCount = await page.evaluate(
|
57
|
-
() => document.activeElement.value
|
58
|
-
);
|
59
|
-
expect( currentRowCount ).toBe( '2' );
|
60
|
-
await page.keyboard.press( 'Backspace' );
|
61
|
-
await page.keyboard.type( '10' );
|
62
|
-
|
63
|
-
// Create the table.
|
64
|
-
await clickButton( createButtonLabel );
|
65
|
-
|
66
|
-
// Expect the post content to have a correctly sized table.
|
67
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
68
|
-
} );
|
69
|
-
|
70
|
-
it( 'allows text to by typed into cells', async () => {
|
71
|
-
await insertBlock( 'Table' );
|
72
|
-
|
73
|
-
// Create the table.
|
74
|
-
await clickButton( createButtonLabel );
|
75
|
-
|
76
|
-
// Click the first cell and add some text.
|
77
|
-
await page.click( 'td' );
|
78
|
-
await page.keyboard.type( 'This' );
|
79
|
-
|
80
|
-
// Navigate to the next cell and add some text.
|
81
|
-
await page.keyboard.press( 'ArrowRight' );
|
82
|
-
await page.keyboard.type( 'is' );
|
83
|
-
|
84
|
-
// Navigate to the next cell and add some text.
|
85
|
-
await page.keyboard.press( 'ArrowRight' );
|
86
|
-
await page.keyboard.type( 'table' );
|
87
|
-
|
88
|
-
// Navigate to the next cell and add some text.
|
89
|
-
await page.keyboard.press( 'ArrowRight' );
|
90
|
-
await page.keyboard.type( 'block' );
|
91
|
-
|
92
|
-
// Expect the post to have the correct written content inside the table.
|
93
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
94
|
-
} );
|
95
|
-
|
96
|
-
it( 'allows header and footer rows to be switched on and off', async () => {
|
97
|
-
await insertBlock( 'Table' );
|
98
|
-
await openDocumentSettingsSidebar();
|
99
|
-
|
100
|
-
const headerSwitchSelector = "//label[text()='Header section']";
|
101
|
-
const footerSwitchSelector = "//label[text()='Footer section']";
|
102
|
-
|
103
|
-
// Expect the header and footer switches not to be present before the table has been created.
|
104
|
-
let headerSwitch = await page.$x( headerSwitchSelector );
|
105
|
-
let footerSwitch = await page.$x( footerSwitchSelector );
|
106
|
-
expect( headerSwitch ).toHaveLength( 0 );
|
107
|
-
expect( footerSwitch ).toHaveLength( 0 );
|
108
|
-
|
109
|
-
// Create the table.
|
110
|
-
await clickButton( createButtonLabel );
|
111
|
-
|
112
|
-
// Expect the header and footer switches to be present now that the table has been created.
|
113
|
-
headerSwitch = await page.$x( headerSwitchSelector );
|
114
|
-
footerSwitch = await page.$x( footerSwitchSelector );
|
115
|
-
expect( headerSwitch ).toHaveLength( 1 );
|
116
|
-
expect( footerSwitch ).toHaveLength( 1 );
|
117
|
-
|
118
|
-
// Toggle on the switches and add some content.
|
119
|
-
await headerSwitch[ 0 ].click();
|
120
|
-
await footerSwitch[ 0 ].click();
|
121
|
-
|
122
|
-
await page.click( 'thead th' );
|
123
|
-
await page.keyboard.type( 'header' );
|
124
|
-
|
125
|
-
await page.click( 'tbody td' );
|
126
|
-
await page.keyboard.type( 'body' );
|
127
|
-
|
128
|
-
await page.click( 'tfoot td' );
|
129
|
-
await page.keyboard.type( 'footer' );
|
130
|
-
|
131
|
-
// Expect the table to have a header, body and footer with written content.
|
132
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
133
|
-
|
134
|
-
// Toggle off the switches.
|
135
|
-
await headerSwitch[ 0 ].click();
|
136
|
-
await footerSwitch[ 0 ].click();
|
137
|
-
|
138
|
-
// Expect the table to have only a body with written content.
|
139
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
140
|
-
} );
|
141
|
-
|
142
|
-
it( 'allows adding and deleting columns across the table header, body and footer', async () => {
|
143
|
-
await insertBlock( 'Table' );
|
144
|
-
await openDocumentSettingsSidebar();
|
145
|
-
|
146
|
-
// Create the table.
|
147
|
-
await clickButton( createButtonLabel );
|
148
|
-
|
149
|
-
// Toggle on the switches and add some content.
|
150
|
-
const headerSwitch = await page.$x(
|
151
|
-
"//label[text()='Header section']"
|
152
|
-
);
|
153
|
-
const footerSwitch = await page.$x(
|
154
|
-
"//label[text()='Footer section']"
|
155
|
-
);
|
156
|
-
await headerSwitch[ 0 ].click();
|
157
|
-
await footerSwitch[ 0 ].click();
|
158
|
-
|
159
|
-
await page.click( 'td' );
|
160
|
-
|
161
|
-
// Add a column.
|
162
|
-
await clickBlockToolbarButton( 'Edit table' );
|
163
|
-
await clickButton( 'Insert column after' );
|
164
|
-
|
165
|
-
// Expect the table to have 3 columns across the header, body and footer.
|
166
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
167
|
-
|
168
|
-
await page.click( 'td' );
|
169
|
-
|
170
|
-
// Delete a column.
|
171
|
-
await clickBlockToolbarButton( 'Edit table' );
|
172
|
-
await clickButton( 'Delete column' );
|
173
|
-
|
174
|
-
// Expect the table to have 2 columns across the header, body and footer.
|
175
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
176
|
-
} );
|
177
|
-
|
178
|
-
it( 'allows columns to be aligned', async () => {
|
179
|
-
await insertBlock( 'Table' );
|
180
|
-
|
181
|
-
const [ columnCountLabel ] = await page.$x(
|
182
|
-
"//figure[@data-type='core/table']//label[text()='Column count']"
|
183
|
-
);
|
184
|
-
await columnCountLabel.click();
|
185
|
-
await page.keyboard.press( 'Backspace' );
|
186
|
-
await page.keyboard.type( '4' );
|
187
|
-
|
188
|
-
// Create the table.
|
189
|
-
await clickButton( createButtonLabel );
|
190
|
-
|
191
|
-
// Click the first cell and add some text. Don't align.
|
192
|
-
const cells = await page.$$( 'td,th' );
|
193
|
-
await cells[ 0 ].click();
|
194
|
-
await page.keyboard.type( 'None' );
|
195
|
-
|
196
|
-
// Click to the next cell and add some text. Align left.
|
197
|
-
await cells[ 1 ].click();
|
198
|
-
await page.keyboard.type( 'To the left' );
|
199
|
-
await changeCellAlignment( 'left' );
|
200
|
-
|
201
|
-
// Click the next cell and add some text. Align center.
|
202
|
-
await cells[ 2 ].click();
|
203
|
-
await page.keyboard.type( 'Centered' );
|
204
|
-
await changeCellAlignment( 'center' );
|
205
|
-
|
206
|
-
// Tab to the next cell and add some text. Align right.
|
207
|
-
await cells[ 3 ].click();
|
208
|
-
await page.keyboard.type( 'Right aligned' );
|
209
|
-
await changeCellAlignment( 'right' );
|
210
|
-
|
211
|
-
// Expect the post to have the correct alignment classes inside the table.
|
212
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
213
|
-
} );
|
214
|
-
|
215
|
-
// Testing for regressions of https://github.com/WordPress/gutenberg/issues/14904.
|
216
|
-
it( 'allows cells to be selected when the cell area outside of the RichText is clicked', async () => {
|
217
|
-
await insertBlock( 'Table' );
|
218
|
-
await openDocumentSettingsSidebar();
|
219
|
-
|
220
|
-
// Create the table.
|
221
|
-
await clickButton( createButtonLabel );
|
222
|
-
|
223
|
-
// Enable fixed width as it exascerbates the amount of empty space around the RichText.
|
224
|
-
const [ fixedWidthSwitch ] = await page.$x(
|
225
|
-
"//label[text()='Fixed width table cells']"
|
226
|
-
);
|
227
|
-
await fixedWidthSwitch.click();
|
228
|
-
|
229
|
-
// Add multiple new lines to the first cell to make it taller.
|
230
|
-
await page.click( 'td' );
|
231
|
-
await page.keyboard.type( '\n\n\n\n' );
|
232
|
-
|
233
|
-
// Get the bounding client rect for the second cell.
|
234
|
-
const { x: secondCellX, y: secondCellY } = await page.evaluate( () => {
|
235
|
-
const secondCell =
|
236
|
-
document.querySelectorAll( '.wp-block-table td' )[ 1 ];
|
237
|
-
// Page.evaluate can only return a serializable value to the
|
238
|
-
// parent process, so destructure and restructure the result
|
239
|
-
// into an object.
|
240
|
-
const { x, y } = secondCell.getBoundingClientRect();
|
241
|
-
return { x, y };
|
242
|
-
} );
|
243
|
-
|
244
|
-
// Click in the top left corner of the second cell and type some text.
|
245
|
-
await page.mouse.click( secondCellX, secondCellY );
|
246
|
-
await page.keyboard.type( 'Second cell.' );
|
247
|
-
|
248
|
-
// Expect that the snapshot shows the text in the second cell.
|
249
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
250
|
-
} );
|
251
|
-
|
252
|
-
it( 'allows a caption to be added', async () => {
|
253
|
-
await insertBlock( 'Table' );
|
254
|
-
|
255
|
-
// Create the table.
|
256
|
-
await clickButton( createButtonLabel );
|
257
|
-
|
258
|
-
// Click the first cell and add some text.
|
259
|
-
await page.click( '.wp-block-table figcaption' );
|
260
|
-
await page.keyboard.type( 'Caption!' );
|
261
|
-
|
262
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
263
|
-
} );
|
264
|
-
|
265
|
-
it( 'up and down arrow navigation', async () => {
|
266
|
-
await insertBlock( 'Table' );
|
267
|
-
|
268
|
-
// Create the table.
|
269
|
-
await clickButton( createButtonLabel );
|
270
|
-
|
271
|
-
await page.keyboard.type( '1' );
|
272
|
-
await page.keyboard.press( 'ArrowDown' );
|
273
|
-
await page.keyboard.type( '2' );
|
274
|
-
await page.keyboard.press( 'ArrowRight' );
|
275
|
-
await page.keyboard.type( '3' );
|
276
|
-
await page.keyboard.press( 'ArrowUp' );
|
277
|
-
await page.keyboard.type( '4' );
|
278
|
-
|
279
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
280
|
-
} );
|
281
|
-
|
282
|
-
it( 'should not have focus loss after creation', async () => {
|
283
|
-
// Insert table block.
|
284
|
-
await insertBlock( 'Table' );
|
285
|
-
|
286
|
-
// Create the table.
|
287
|
-
await clickButton( createButtonLabel );
|
288
|
-
|
289
|
-
// Focus should be in first td.
|
290
|
-
const isInTd = await page.waitForSelector(
|
291
|
-
'td[contentEditable="true"]'
|
292
|
-
);
|
293
|
-
await expect( isInTd ).toHaveFocus();
|
294
|
-
} );
|
295
|
-
} );
|
@@ -1,63 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`RTL should arrow navigate 1`] = `
|
4
|
-
"<!-- wp:paragraph -->
|
5
|
-
<p>٠١٢</p>
|
6
|
-
<!-- /wp:paragraph -->"
|
7
|
-
`;
|
8
|
-
|
9
|
-
exports[`RTL should arrow navigate between blocks 1`] = `
|
10
|
-
"<!-- wp:paragraph -->
|
11
|
-
<p>٠<br>١</p>
|
12
|
-
<!-- /wp:paragraph -->
|
13
|
-
|
14
|
-
<!-- wp:paragraph -->
|
15
|
-
<p>٠<br>١<br>٢</p>
|
16
|
-
<!-- /wp:paragraph -->"
|
17
|
-
`;
|
18
|
-
|
19
|
-
exports[`RTL should merge backward 1`] = `
|
20
|
-
"<!-- wp:paragraph -->
|
21
|
-
<p>٠١</p>
|
22
|
-
<!-- /wp:paragraph -->"
|
23
|
-
`;
|
24
|
-
|
25
|
-
exports[`RTL should merge forward 1`] = `
|
26
|
-
"<!-- wp:paragraph -->
|
27
|
-
<p>٠١</p>
|
28
|
-
<!-- /wp:paragraph -->"
|
29
|
-
`;
|
30
|
-
|
31
|
-
exports[`RTL should navigate inline boundaries 1`] = `
|
32
|
-
"<!-- wp:paragraph -->
|
33
|
-
<p><strong>١</strong>٠٢</p>
|
34
|
-
<!-- /wp:paragraph -->"
|
35
|
-
`;
|
36
|
-
|
37
|
-
exports[`RTL should navigate inline boundaries 2`] = `
|
38
|
-
"<!-- wp:paragraph -->
|
39
|
-
<p><strong>١٠</strong>٢</p>
|
40
|
-
<!-- /wp:paragraph -->"
|
41
|
-
`;
|
42
|
-
|
43
|
-
exports[`RTL should navigate inline boundaries 3`] = `
|
44
|
-
"<!-- wp:paragraph -->
|
45
|
-
<p><strong>٠١</strong>٢</p>
|
46
|
-
<!-- /wp:paragraph -->"
|
47
|
-
`;
|
48
|
-
|
49
|
-
exports[`RTL should navigate inline boundaries 4`] = `
|
50
|
-
"<!-- wp:paragraph -->
|
51
|
-
<p>٠<strong>١</strong>٢</p>
|
52
|
-
<!-- /wp:paragraph -->"
|
53
|
-
`;
|
54
|
-
|
55
|
-
exports[`RTL should split 1`] = `
|
56
|
-
"<!-- wp:paragraph -->
|
57
|
-
<p>٠</p>
|
58
|
-
<!-- /wp:paragraph -->
|
59
|
-
|
60
|
-
<!-- wp:paragraph -->
|
61
|
-
<p>١</p>
|
62
|
-
<!-- /wp:paragraph -->"
|
63
|
-
`;
|