@wordpress/e2e-tests 4.1.0 → 4.4.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/config/flaky-tests-reporter.js +1 -0
- package/config/setup-test-framework.js +3 -0
- package/package.json +6 -6
- package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +4 -4
- package/specs/editor/blocks/__snapshots__/heading.test.js.snap +0 -6
- package/specs/editor/blocks/{comments-query.test.js → comments.test.js} +5 -13
- package/specs/editor/blocks/heading.test.js +7 -7
- package/specs/editor/blocks/navigation.test.js +58 -10
- package/specs/editor/blocks/table.test.js +14 -1
- package/specs/editor/fixtures/menu-items-response-fixture.json +48 -144
- package/specs/editor/plugins/iframed-inline-styles.test.js +1 -0
- package/specs/editor/plugins/nonce.test.js +6 -7
- package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +1 -1
- package/specs/editor/various/block-switcher.test.js +3 -0
- package/specs/editor/various/datepicker.test.js +19 -7
- package/specs/editor/various/inserting-blocks.test.js +1 -1
- package/specs/editor/various/keyboard-navigable-blocks.test.js +0 -3
- package/specs/editor/various/multi-block-selection.test.js +48 -0
- package/specs/editor/various/post-visibility.test.js +1 -1
- package/specs/editor/various/scheduling.test.js +2 -2
- package/specs/editor/various/switch-to-draft.test.js +1 -1
- package/specs/editor/various/writing-flow.test.js +52 -19
- package/specs/experiments/blocks/post-comments-form.test.js +46 -0
- package/specs/editor/blocks/__snapshots__/code.test.js.snap +0 -14
- package/specs/editor/blocks/__snapshots__/html.test.js.snap +0 -8
- package/specs/editor/blocks/__snapshots__/image.test.js.snap +0 -25
- package/specs/editor/blocks/__snapshots__/preformatted.test.js.snap +0 -24
- package/specs/editor/blocks/__snapshots__/separator.test.js.snap +0 -7
- package/specs/editor/blocks/code.test.js +0 -48
- package/specs/editor/blocks/html.test.js +0 -31
- package/specs/editor/blocks/image.test.js +0 -373
- package/specs/editor/blocks/paragraph.test.js +0 -26
- package/specs/editor/blocks/preformatted.test.js +0 -62
- package/specs/editor/blocks/separator.test.js +0 -22
- package/specs/editor/plugins/image-size.test.js +0 -71
- package/specs/editor/various/block-locking.test.js +0 -120
- package/specs/editor/various/popovers.test.js +0 -27
- package/specs/site-editor/template-part.test.js +0 -346
- package/specs/site-editor/template-revert.test.js +0 -209
@@ -1,27 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import { createNewPost } from '@wordpress/e2e-test-utils';
|
5
|
-
|
6
|
-
describe( 'popovers', () => {
|
7
|
-
beforeEach( async () => {
|
8
|
-
await createNewPost();
|
9
|
-
} );
|
10
|
-
|
11
|
-
describe( 'dropdown', () => {
|
12
|
-
it( 'toggles via click', async () => {
|
13
|
-
const isMoreMenuOpen = async () =>
|
14
|
-
!! ( await page.$( '.interface-more-menu-dropdown__content' ) );
|
15
|
-
|
16
|
-
expect( await isMoreMenuOpen() ).toBe( false );
|
17
|
-
|
18
|
-
// Toggle opened.
|
19
|
-
await page.click( '.interface-more-menu-dropdown > button' );
|
20
|
-
expect( await isMoreMenuOpen() ).toBe( true );
|
21
|
-
|
22
|
-
// Toggle closed.
|
23
|
-
await page.click( '.interface-more-menu-dropdown > button' );
|
24
|
-
expect( await isMoreMenuOpen() ).toBe( false );
|
25
|
-
} );
|
26
|
-
} );
|
27
|
-
} );
|
@@ -1,346 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
insertBlock,
|
6
|
-
deleteAllTemplates,
|
7
|
-
activateTheme,
|
8
|
-
getAllBlocks,
|
9
|
-
selectBlockByClientId,
|
10
|
-
clickBlockToolbarButton,
|
11
|
-
canvas,
|
12
|
-
visitSiteEditor,
|
13
|
-
} from '@wordpress/e2e-test-utils';
|
14
|
-
|
15
|
-
const templatePartNameInput =
|
16
|
-
'.edit-site-create-template-part-modal .components-text-control__input';
|
17
|
-
|
18
|
-
describe( 'Template Part', () => {
|
19
|
-
beforeAll( async () => {
|
20
|
-
await activateTheme( 'emptytheme' );
|
21
|
-
await deleteAllTemplates( 'wp_template' );
|
22
|
-
await deleteAllTemplates( 'wp_template_part' );
|
23
|
-
} );
|
24
|
-
afterEach( async () => {
|
25
|
-
await deleteAllTemplates( 'wp_template' );
|
26
|
-
await deleteAllTemplates( 'wp_template_part' );
|
27
|
-
} );
|
28
|
-
afterAll( async () => {
|
29
|
-
await activateTheme( 'twentytwentyone' );
|
30
|
-
} );
|
31
|
-
|
32
|
-
describe( 'Template part block', () => {
|
33
|
-
beforeEach( async () => {
|
34
|
-
await visitSiteEditor();
|
35
|
-
} );
|
36
|
-
|
37
|
-
async function navigateToHeader() {
|
38
|
-
// Switch to editing the header template part.
|
39
|
-
await visitSiteEditor( {
|
40
|
-
postId: 'emptytheme//header',
|
41
|
-
postType: 'wp_template_part',
|
42
|
-
} );
|
43
|
-
}
|
44
|
-
|
45
|
-
async function updateHeader( content ) {
|
46
|
-
await navigateToHeader();
|
47
|
-
|
48
|
-
// Edit it.
|
49
|
-
await insertBlock( 'Paragraph' );
|
50
|
-
await page.keyboard.type( content );
|
51
|
-
|
52
|
-
// Save it.
|
53
|
-
await page.click( '.edit-site-save-button__button' );
|
54
|
-
await page.click( '.editor-entities-saved-states__save-button' );
|
55
|
-
await page.waitForSelector(
|
56
|
-
'.edit-site-save-button__button:not(.is-busy)'
|
57
|
-
);
|
58
|
-
|
59
|
-
// Switch back to the Index template.
|
60
|
-
await visitSiteEditor( {
|
61
|
-
postId: 'emptytheme//index',
|
62
|
-
postType: 'wp_template',
|
63
|
-
} );
|
64
|
-
}
|
65
|
-
|
66
|
-
async function triggerEllipsisMenuItem( textPrompt ) {
|
67
|
-
await clickBlockToolbarButton( 'Options' );
|
68
|
-
const button = await page.waitForXPath(
|
69
|
-
`//span[contains(text(), "${ textPrompt }")]`
|
70
|
-
);
|
71
|
-
await button.click();
|
72
|
-
}
|
73
|
-
|
74
|
-
async function createParagraphAndGetClientId( content ) {
|
75
|
-
await insertBlock( 'Paragraph' );
|
76
|
-
await page.keyboard.type( content );
|
77
|
-
const allBlocks = await getAllBlocks();
|
78
|
-
const paragraphBlock = allBlocks.find(
|
79
|
-
( block ) =>
|
80
|
-
block.name === 'core/paragraph' &&
|
81
|
-
block.attributes.content === content
|
82
|
-
);
|
83
|
-
return paragraphBlock.clientId;
|
84
|
-
}
|
85
|
-
|
86
|
-
async function assertParagraphInTemplatePart( content ) {
|
87
|
-
const paragraphInTemplatePart = await canvas().waitForXPath(
|
88
|
-
`//*[@data-type="core/template-part"][//p[text()="${ content }"]]`
|
89
|
-
);
|
90
|
-
expect( paragraphInTemplatePart ).not.toBeNull();
|
91
|
-
}
|
92
|
-
|
93
|
-
async function awaitHeaderLoad() {
|
94
|
-
await canvas().waitForSelector(
|
95
|
-
'header.wp-block-template-part.block-editor-block-list__layout'
|
96
|
-
);
|
97
|
-
}
|
98
|
-
|
99
|
-
it( 'Should load customizations when in a template even if only the slug and theme attributes are set.', async () => {
|
100
|
-
await updateHeader( 'Header Template Part 123' );
|
101
|
-
|
102
|
-
// Verify that the header template part is updated.
|
103
|
-
await assertParagraphInTemplatePart( 'Header Template Part 123' );
|
104
|
-
} );
|
105
|
-
|
106
|
-
it( 'Should detach blocks from template part', async () => {
|
107
|
-
await updateHeader( 'Header Template Part 456' );
|
108
|
-
|
109
|
-
const initialTemplateParts = await canvas().$$(
|
110
|
-
'.wp-block-template-part'
|
111
|
-
);
|
112
|
-
|
113
|
-
// Select the header template part block.
|
114
|
-
const allBlocks = await getAllBlocks();
|
115
|
-
const headerBlock = allBlocks.find(
|
116
|
-
( block ) => block.name === 'core/template-part'
|
117
|
-
);
|
118
|
-
await selectBlockByClientId( headerBlock.clientId );
|
119
|
-
|
120
|
-
// Detach blocks from template part using ellipsis menu.
|
121
|
-
await triggerEllipsisMenuItem( 'Detach blocks from template part' );
|
122
|
-
|
123
|
-
// Verify there is one less template part on the page.
|
124
|
-
const finalTemplateParts = await canvas().$$(
|
125
|
-
'.wp-block-template-part'
|
126
|
-
);
|
127
|
-
expect(
|
128
|
-
initialTemplateParts.length - finalTemplateParts.length
|
129
|
-
).toBe( 1 );
|
130
|
-
|
131
|
-
// Verify content of the template part is still present.
|
132
|
-
const [ expectedContent ] = await canvas().$x(
|
133
|
-
'//p[contains(text(), "Header Template Part 456")]'
|
134
|
-
);
|
135
|
-
expect( expectedContent ).not.toBeUndefined();
|
136
|
-
} );
|
137
|
-
|
138
|
-
it( 'Should load navigate-to-links properly', async () => {
|
139
|
-
await navigateToHeader();
|
140
|
-
await insertBlock( 'Paragraph' );
|
141
|
-
await page.keyboard.type( 'Header Template Part 789' );
|
142
|
-
|
143
|
-
// Select the paragraph block.
|
144
|
-
const text = await canvas().waitForXPath(
|
145
|
-
'//p[contains(text(), "Header Template Part 789")]'
|
146
|
-
);
|
147
|
-
|
148
|
-
// Highlight all the text in the paragraph block.
|
149
|
-
await text.click( { clickCount: 3 } );
|
150
|
-
|
151
|
-
// Click the convert to link toolbar button.
|
152
|
-
await page.waitForSelector( 'button[aria-label="Link"]' );
|
153
|
-
await page.click( 'button[aria-label="Link"]' );
|
154
|
-
|
155
|
-
// Enter url for link.
|
156
|
-
await page.keyboard.type( 'https://google.com' );
|
157
|
-
await page.keyboard.press( 'Enter' );
|
158
|
-
|
159
|
-
// Verify that there is no error.
|
160
|
-
await canvas().click( 'p[data-type="core/paragraph"] a' );
|
161
|
-
const expectedContent = await canvas().$x(
|
162
|
-
'//p[contains(text(), "Header Template Part 789")]'
|
163
|
-
);
|
164
|
-
|
165
|
-
expect( expectedContent ).not.toBeUndefined();
|
166
|
-
} );
|
167
|
-
|
168
|
-
it( 'Should convert selected block to template part', async () => {
|
169
|
-
await awaitHeaderLoad();
|
170
|
-
const initialTemplateParts = await canvas().$$(
|
171
|
-
'.wp-block-template-part'
|
172
|
-
);
|
173
|
-
|
174
|
-
// Add some block and select it.
|
175
|
-
const clientId = await createParagraphAndGetClientId(
|
176
|
-
'Some block...'
|
177
|
-
);
|
178
|
-
await selectBlockByClientId( clientId );
|
179
|
-
|
180
|
-
// Convert block to a template part.
|
181
|
-
await triggerEllipsisMenuItem( 'Make template part' );
|
182
|
-
const nameInput = await page.waitForSelector(
|
183
|
-
templatePartNameInput
|
184
|
-
);
|
185
|
-
await nameInput.click();
|
186
|
-
await page.keyboard.type( 'My template part' );
|
187
|
-
await page.keyboard.press( 'Enter' );
|
188
|
-
|
189
|
-
// Wait for creation to finish.
|
190
|
-
await page.waitForXPath(
|
191
|
-
'//*[contains(@class, "components-snackbar")]/*[text()="Template part created."]'
|
192
|
-
);
|
193
|
-
|
194
|
-
// Verify new template part is created with expected content.
|
195
|
-
await assertParagraphInTemplatePart( 'Some block...' );
|
196
|
-
|
197
|
-
// Verify there is 1 more template part on the page than previously.
|
198
|
-
const finalTemplateParts = await canvas().$$(
|
199
|
-
'.wp-block-template-part'
|
200
|
-
);
|
201
|
-
expect(
|
202
|
-
finalTemplateParts.length - initialTemplateParts.length
|
203
|
-
).toBe( 1 );
|
204
|
-
} );
|
205
|
-
|
206
|
-
it( 'Should convert multiple selected blocks to template part', async () => {
|
207
|
-
await awaitHeaderLoad();
|
208
|
-
const initialTemplateParts = await canvas().$$(
|
209
|
-
'.wp-block-template-part'
|
210
|
-
);
|
211
|
-
|
212
|
-
// Add two blocks and select them.
|
213
|
-
const block1Id = await createParagraphAndGetClientId(
|
214
|
-
'Some block #1'
|
215
|
-
);
|
216
|
-
const block2Id = await createParagraphAndGetClientId(
|
217
|
-
'Some block #2'
|
218
|
-
);
|
219
|
-
await page.evaluate(
|
220
|
-
( id1, id2 ) => {
|
221
|
-
wp.data
|
222
|
-
.dispatch( 'core/block-editor' )
|
223
|
-
.multiSelect( id1, id2 );
|
224
|
-
},
|
225
|
-
block1Id,
|
226
|
-
block2Id
|
227
|
-
);
|
228
|
-
|
229
|
-
// Convert block to a template part.
|
230
|
-
await triggerEllipsisMenuItem( 'Make template part' );
|
231
|
-
const nameInput = await page.waitForSelector(
|
232
|
-
templatePartNameInput
|
233
|
-
);
|
234
|
-
await nameInput.click();
|
235
|
-
await page.keyboard.type( 'My multi template part' );
|
236
|
-
await page.keyboard.press( 'Enter' );
|
237
|
-
|
238
|
-
// Wait for creation to finish.
|
239
|
-
await page.waitForXPath(
|
240
|
-
'//*[contains(@class, "components-snackbar")]/*[text()="Template part created."]'
|
241
|
-
);
|
242
|
-
|
243
|
-
// Verify new template part is created with expected content.
|
244
|
-
await assertParagraphInTemplatePart( 'Some block #1' );
|
245
|
-
await assertParagraphInTemplatePart( 'Some block #2' );
|
246
|
-
|
247
|
-
// Verify there is 1 more template part on the page than previously.
|
248
|
-
const finalTemplateParts = await canvas().$$(
|
249
|
-
'.wp-block-template-part'
|
250
|
-
);
|
251
|
-
expect(
|
252
|
-
finalTemplateParts.length - initialTemplateParts.length
|
253
|
-
).toBe( 1 );
|
254
|
-
} );
|
255
|
-
|
256
|
-
describe( 'Template part placeholder', () => {
|
257
|
-
// Test constants for template part.
|
258
|
-
const testContent = 'some words...';
|
259
|
-
|
260
|
-
// Selectors.
|
261
|
-
const entitiesSaveSelector =
|
262
|
-
'.editor-entities-saved-states__save-button';
|
263
|
-
const savePostSelector = '.edit-site-save-button__button';
|
264
|
-
const templatePartSelector = '*[data-type="core/template-part"]';
|
265
|
-
const activatedTemplatePartSelector = `${ templatePartSelector }.block-editor-block-list__layout`;
|
266
|
-
const startBlockButtonSelector =
|
267
|
-
'//button[contains(text(), "Start blank")]';
|
268
|
-
const chooseExistingButtonSelector =
|
269
|
-
'//button[contains(text(), "Choose")]';
|
270
|
-
const confirmTitleButtonSelector =
|
271
|
-
'.wp-block-template-part__placeholder-create-new__title-form .components-button.is-primary';
|
272
|
-
|
273
|
-
it( 'Should insert new template part on creation', async () => {
|
274
|
-
let siteEditorCanvas = canvas();
|
275
|
-
await awaitHeaderLoad();
|
276
|
-
|
277
|
-
// Create new template part.
|
278
|
-
await insertBlock( 'Template Part' );
|
279
|
-
const startBlankButton = await siteEditorCanvas.waitForXPath(
|
280
|
-
startBlockButtonSelector
|
281
|
-
);
|
282
|
-
await startBlankButton.click();
|
283
|
-
const confirmTitleButton = await page.waitForSelector(
|
284
|
-
confirmTitleButtonSelector
|
285
|
-
);
|
286
|
-
await page.keyboard.press( 'Tab' );
|
287
|
-
await page.keyboard.press( 'Tab' );
|
288
|
-
await page.keyboard.type( 'Create New' );
|
289
|
-
await confirmTitleButton.click();
|
290
|
-
|
291
|
-
const newTemplatePart = await siteEditorCanvas.waitForSelector(
|
292
|
-
activatedTemplatePartSelector
|
293
|
-
);
|
294
|
-
expect( newTemplatePart ).toBeTruthy();
|
295
|
-
|
296
|
-
// Finish creating template part, insert some text, and save.
|
297
|
-
await siteEditorCanvas.waitForSelector(
|
298
|
-
'.block-editor-button-block-appender'
|
299
|
-
);
|
300
|
-
await siteEditorCanvas.click(
|
301
|
-
'.block-editor-button-block-appender'
|
302
|
-
);
|
303
|
-
await page.waitForSelector(
|
304
|
-
'.editor-block-list-item-paragraph'
|
305
|
-
);
|
306
|
-
await page.click( '.editor-block-list-item-paragraph' );
|
307
|
-
await page.keyboard.type( testContent );
|
308
|
-
await page.click( savePostSelector );
|
309
|
-
await page.click( entitiesSaveSelector );
|
310
|
-
|
311
|
-
// Reload the page so as the new template part is available in the existing template parts.
|
312
|
-
await visitSiteEditor();
|
313
|
-
siteEditorCanvas = canvas();
|
314
|
-
await awaitHeaderLoad();
|
315
|
-
// Try to insert the template part we created.
|
316
|
-
await insertBlock( 'Template Part' );
|
317
|
-
const chooseExistingButton = await siteEditorCanvas.waitForXPath(
|
318
|
-
chooseExistingButtonSelector
|
319
|
-
);
|
320
|
-
await chooseExistingButton.click();
|
321
|
-
const preview = await page.waitForSelector(
|
322
|
-
'.block-editor-block-patterns-list__item'
|
323
|
-
);
|
324
|
-
await preview.click();
|
325
|
-
|
326
|
-
// Wait for the template parts to load properly.
|
327
|
-
await siteEditorCanvas.waitForSelector(
|
328
|
-
'[data-type="core/template-part"] > p:first-child'
|
329
|
-
);
|
330
|
-
|
331
|
-
// We now have the same template part two times in the page, so check accordingly.
|
332
|
-
const paragraphs = await siteEditorCanvas.$$eval(
|
333
|
-
'[data-type="core/template-part"] > p:first-child',
|
334
|
-
( options ) =>
|
335
|
-
options.map( ( option ) => option.textContent )
|
336
|
-
);
|
337
|
-
expect( paragraphs ).toHaveLength( 2 );
|
338
|
-
expect(
|
339
|
-
paragraphs.every(
|
340
|
-
( paragraph ) => paragraph === testContent
|
341
|
-
)
|
342
|
-
).toBeTruthy();
|
343
|
-
} );
|
344
|
-
} );
|
345
|
-
} );
|
346
|
-
} );
|
@@ -1,209 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
insertBlock,
|
6
|
-
activateTheme,
|
7
|
-
deleteAllTemplates,
|
8
|
-
visitSiteEditor,
|
9
|
-
getCurrentSiteEditorContent,
|
10
|
-
} from '@wordpress/e2e-test-utils';
|
11
|
-
|
12
|
-
const assertSaveButtonIsDisabled = async () =>
|
13
|
-
page.waitForSelector(
|
14
|
-
'.edit-site-save-button__button[aria-disabled="true"]'
|
15
|
-
);
|
16
|
-
|
17
|
-
const assertSaveButtonIsEnabled = async () =>
|
18
|
-
page.waitForSelector(
|
19
|
-
'.edit-site-save-button__button[aria-disabled="false"]'
|
20
|
-
);
|
21
|
-
|
22
|
-
const clickButtonInNotice = async () => {
|
23
|
-
const selector = '.components-snackbar button';
|
24
|
-
await page.waitForSelector( selector );
|
25
|
-
await page.click( selector );
|
26
|
-
};
|
27
|
-
|
28
|
-
const clickUndoInHeaderToolbar = async () =>
|
29
|
-
page.click( '.edit-site-header__toolbar button[aria-label="Undo"]' );
|
30
|
-
|
31
|
-
const clickRedoInHeaderToolbar = async () => {
|
32
|
-
await page.waitForSelector(
|
33
|
-
'.edit-site-header__toolbar button[aria-label="Redo"][aria-disabled="false"]'
|
34
|
-
);
|
35
|
-
return page.click( '.edit-site-header__toolbar button[aria-label="Redo"]' );
|
36
|
-
};
|
37
|
-
|
38
|
-
const undoRevertInHeaderToolbar = async () => {
|
39
|
-
await clickUndoInHeaderToolbar();
|
40
|
-
await assertSaveButtonIsEnabled();
|
41
|
-
};
|
42
|
-
|
43
|
-
const undoRevertInNotice = async () => {
|
44
|
-
await clickButtonInNotice();
|
45
|
-
await assertSaveButtonIsEnabled();
|
46
|
-
};
|
47
|
-
|
48
|
-
const addDummyText = async () => {
|
49
|
-
await insertBlock( 'Paragraph' );
|
50
|
-
await page.keyboard.type( 'Test' );
|
51
|
-
};
|
52
|
-
|
53
|
-
const save = async () => {
|
54
|
-
await page.click( '.edit-site-save-button__button' );
|
55
|
-
await page.click( '.editor-entities-saved-states__save-button' );
|
56
|
-
await page.waitForSelector(
|
57
|
-
'.edit-site-save-button__button:not(.is-busy)'
|
58
|
-
);
|
59
|
-
};
|
60
|
-
|
61
|
-
const revertTemplate = async () => {
|
62
|
-
await page.click( '.edit-site-document-actions__get-info' );
|
63
|
-
await page.click( '.edit-site-template-details__revert-button' );
|
64
|
-
await page.waitForXPath(
|
65
|
-
'//*[contains(@class, "components-snackbar") and contains(text(), "Template reverted")]'
|
66
|
-
);
|
67
|
-
await assertSaveButtonIsEnabled();
|
68
|
-
};
|
69
|
-
|
70
|
-
describe( 'Template Revert', () => {
|
71
|
-
beforeAll( async () => {
|
72
|
-
await activateTheme( 'emptytheme' );
|
73
|
-
await deleteAllTemplates( 'wp_template' );
|
74
|
-
await deleteAllTemplates( 'wp_template_part' );
|
75
|
-
} );
|
76
|
-
afterAll( async () => {
|
77
|
-
await deleteAllTemplates( 'wp_template' );
|
78
|
-
await deleteAllTemplates( 'wp_template_part' );
|
79
|
-
await activateTheme( 'twentytwentyone' );
|
80
|
-
} );
|
81
|
-
beforeEach( async () => {
|
82
|
-
await deleteAllTemplates( 'wp_template' );
|
83
|
-
await visitSiteEditor();
|
84
|
-
} );
|
85
|
-
|
86
|
-
it( 'should delete the template after saving the reverted template', async () => {
|
87
|
-
await addDummyText();
|
88
|
-
await save();
|
89
|
-
await revertTemplate();
|
90
|
-
await save();
|
91
|
-
|
92
|
-
await page.click( '.edit-site-document-actions__get-info' );
|
93
|
-
|
94
|
-
// The revert button isn't visible anymore.
|
95
|
-
expect(
|
96
|
-
await page.$( '.edit-site-template-details__revert-button' )
|
97
|
-
).toBeNull();
|
98
|
-
} );
|
99
|
-
|
100
|
-
it( 'should show the original content after revert', async () => {
|
101
|
-
const contentBefore = await getCurrentSiteEditorContent();
|
102
|
-
|
103
|
-
await addDummyText();
|
104
|
-
await save();
|
105
|
-
await revertTemplate();
|
106
|
-
await save();
|
107
|
-
|
108
|
-
const contentAfter = await getCurrentSiteEditorContent();
|
109
|
-
expect( contentBefore ).toBe( contentAfter );
|
110
|
-
} );
|
111
|
-
|
112
|
-
it( 'should show the original content after revert and page reload', async () => {
|
113
|
-
const contentBefore = await getCurrentSiteEditorContent();
|
114
|
-
|
115
|
-
await addDummyText();
|
116
|
-
await save();
|
117
|
-
await revertTemplate();
|
118
|
-
await save();
|
119
|
-
await visitSiteEditor();
|
120
|
-
|
121
|
-
const contentAfter = await getCurrentSiteEditorContent();
|
122
|
-
expect( contentBefore ).toBe( contentAfter );
|
123
|
-
} );
|
124
|
-
|
125
|
-
it( 'should show the edited content after revert and clicking undo in the header toolbar', async () => {
|
126
|
-
await addDummyText();
|
127
|
-
await save();
|
128
|
-
const contentBefore = await getCurrentSiteEditorContent();
|
129
|
-
|
130
|
-
await revertTemplate();
|
131
|
-
await save();
|
132
|
-
await undoRevertInHeaderToolbar();
|
133
|
-
|
134
|
-
const contentAfter = await getCurrentSiteEditorContent();
|
135
|
-
expect( contentBefore ).toBe( contentAfter );
|
136
|
-
} );
|
137
|
-
|
138
|
-
it( 'should show the edited content after revert and clicking undo in the notice', async () => {
|
139
|
-
await addDummyText();
|
140
|
-
await save();
|
141
|
-
const contentBefore = await getCurrentSiteEditorContent();
|
142
|
-
|
143
|
-
await revertTemplate();
|
144
|
-
await save();
|
145
|
-
await undoRevertInNotice();
|
146
|
-
|
147
|
-
const contentAfter = await getCurrentSiteEditorContent();
|
148
|
-
expect( contentBefore ).toBe( contentAfter );
|
149
|
-
} );
|
150
|
-
|
151
|
-
it( 'should show the original content after revert, clicking undo then redo in the header toolbar', async () => {
|
152
|
-
const contentBefore = await getCurrentSiteEditorContent();
|
153
|
-
|
154
|
-
await addDummyText();
|
155
|
-
await save();
|
156
|
-
await revertTemplate();
|
157
|
-
await save();
|
158
|
-
await undoRevertInHeaderToolbar();
|
159
|
-
await clickRedoInHeaderToolbar();
|
160
|
-
|
161
|
-
const contentAfter = await getCurrentSiteEditorContent();
|
162
|
-
expect( contentBefore ).toBe( contentAfter );
|
163
|
-
} );
|
164
|
-
|
165
|
-
it( 'should show the original content after revert, clicking undo in the notice then undo in the header toolbar', async () => {
|
166
|
-
const contentBefore = await getCurrentSiteEditorContent();
|
167
|
-
|
168
|
-
await addDummyText();
|
169
|
-
await save();
|
170
|
-
await revertTemplate();
|
171
|
-
await save();
|
172
|
-
await undoRevertInNotice();
|
173
|
-
await undoRevertInHeaderToolbar();
|
174
|
-
|
175
|
-
const contentAfter = await getCurrentSiteEditorContent();
|
176
|
-
expect( contentBefore ).toBe( contentAfter );
|
177
|
-
} );
|
178
|
-
|
179
|
-
it( 'should show the edited content after revert, clicking undo in the header toolbar, save and reload', async () => {
|
180
|
-
await addDummyText();
|
181
|
-
await save();
|
182
|
-
const contentBefore = await getCurrentSiteEditorContent();
|
183
|
-
|
184
|
-
await revertTemplate();
|
185
|
-
await save();
|
186
|
-
await clickUndoInHeaderToolbar();
|
187
|
-
await save();
|
188
|
-
await assertSaveButtonIsDisabled();
|
189
|
-
await visitSiteEditor();
|
190
|
-
|
191
|
-
const contentAfter = await getCurrentSiteEditorContent();
|
192
|
-
expect( contentBefore ).toBe( contentAfter );
|
193
|
-
} );
|
194
|
-
|
195
|
-
it( 'should show the edited content after revert, clicking undo in the notice and reload', async () => {
|
196
|
-
await addDummyText();
|
197
|
-
await save();
|
198
|
-
const contentBefore = await getCurrentSiteEditorContent();
|
199
|
-
|
200
|
-
await revertTemplate();
|
201
|
-
await save();
|
202
|
-
await undoRevertInNotice();
|
203
|
-
await save();
|
204
|
-
await visitSiteEditor();
|
205
|
-
|
206
|
-
const contentAfter = await getCurrentSiteEditorContent();
|
207
|
-
expect( contentBefore ).toBe( contentAfter );
|
208
|
-
} );
|
209
|
-
} );
|