@wordpress/e2e-tests 3.0.1-next.33ec3857e2.0 → 3.0.4
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 +2 -1
- package/LICENSE.md +1 -1
- package/README.md +31 -19
- package/config/is-gutenberg-plugin.js +6 -0
- package/jest.config.js +1 -1
- package/jest.performance.config.js +1 -1
- package/mu-plugins/enable-templates-ui.php +24 -0
- package/package.json +9 -9
- package/plugins/plugins-api/error-boundary.js +11 -0
- package/plugins/plugins-error-boundary.php +27 -0
- package/plugins/query-block.php +2 -2
- package/specs/editor/blocks/__snapshots__/image.test.js.snap +6 -6
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +4 -2
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
- package/specs/editor/blocks/classic.test.js +5 -2
- package/specs/editor/blocks/cover.test.js +7 -3
- package/specs/editor/blocks/gallery.test.js +6 -1
- package/specs/editor/blocks/heading.test.js +1 -11
- package/specs/editor/blocks/navigation.test.js +279 -240
- package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +2 -2
- package/specs/editor/plugins/block-variations.test.js +3 -3
- package/specs/editor/plugins/iframed-inline-styles.test.js +0 -6
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +0 -4
- package/specs/editor/plugins/plugins-api.test.js +30 -0
- package/specs/editor/plugins/templates.test.js +1 -7
- package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +38 -24
- package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +1 -1
- package/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +35 -0
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +43 -3
- package/specs/editor/various/font-size-picker.test.js +57 -11
- package/specs/editor/various/fullscreen-mode.test.js +1 -1
- package/specs/editor/various/keep-styles-on-block-transforms.test.js +81 -0
- package/specs/editor/various/post-editor-template-mode.test.js +1 -1
- package/specs/editor/various/post-visibility.test.js +54 -0
- package/specs/editor/various/preview.test.js +66 -1
- package/specs/editor/various/reusable-blocks.test.js +52 -5
- package/specs/editor/various/style-variation.test.js +9 -5
- package/specs/editor/various/undo.test.js +21 -0
- package/specs/performance/site-editor.test.js +3 -4
- package/specs/site-editor/document-settings.test.js +12 -14
- package/specs/site-editor/multi-entity-editing.test.js +14 -16
- package/specs/site-editor/multi-entity-saving.test.js +18 -27
- package/specs/site-editor/settings-sidebar.test.js +7 -12
- package/specs/site-editor/site-editor-export.test.js +9 -10
- package/specs/site-editor/site-editor-inserter.test.js +7 -9
- package/specs/site-editor/style-variations.test.js +211 -0
- package/specs/site-editor/template-part.test.js +14 -22
- package/specs/site-editor/template-revert.test.js +31 -37
- package/specs/widgets/customizing-widgets.test.js +3 -23
- package/specs/widgets/editing-widgets.test.js +36 -12
- package/themes/style-variations/block-templates/index.html +11 -0
- package/themes/style-variations/index.php +0 -0
- package/themes/style-variations/style.css +15 -0
- package/themes/style-variations/styles/pink.json +33 -0
- package/themes/style-variations/styles/yellow.json +12 -0
- package/themes/style-variations/theme.json +8 -0
- package/config/gutenberg-phase.js +0 -9
- package/specs/editor/various/__snapshots__/style-variation.test.js.snap +0 -7
- package/specs/site-editor/utils.js +0 -153
@@ -1,16 +1,15 @@
|
|
1
1
|
/**
|
2
2
|
* WordPress dependencies
|
3
3
|
*/
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
import { siteEditor } from './utils';
|
4
|
+
import {
|
5
|
+
trashAllPosts,
|
6
|
+
activateTheme,
|
7
|
+
visitSiteEditor,
|
8
|
+
} from '@wordpress/e2e-test-utils';
|
10
9
|
|
11
10
|
describe( 'Site Editor Inserter', () => {
|
12
11
|
beforeAll( async () => {
|
13
|
-
await activateTheme( '
|
12
|
+
await activateTheme( 'emptytheme' );
|
14
13
|
await trashAllPosts( 'wp_template' );
|
15
14
|
await trashAllPosts( 'wp_template_part' );
|
16
15
|
} );
|
@@ -18,8 +17,7 @@ describe( 'Site Editor Inserter', () => {
|
|
18
17
|
await activateTheme( 'twentytwentyone' );
|
19
18
|
} );
|
20
19
|
beforeEach( async () => {
|
21
|
-
await
|
22
|
-
await siteEditor.disableWelcomeGuide();
|
20
|
+
await visitSiteEditor();
|
23
21
|
} );
|
24
22
|
|
25
23
|
it( 'inserter toggle button should toggle global inserter', async () => {
|
@@ -0,0 +1,211 @@
|
|
1
|
+
/**
|
2
|
+
* WordPress dependencies
|
3
|
+
*/
|
4
|
+
import {
|
5
|
+
trashAllPosts,
|
6
|
+
activateTheme,
|
7
|
+
visitSiteEditor,
|
8
|
+
toggleGlobalStyles,
|
9
|
+
openGlobalStylesPanel,
|
10
|
+
openPreviousGlobalStylesPanel,
|
11
|
+
} from '@wordpress/e2e-test-utils';
|
12
|
+
|
13
|
+
async function openOtherStyles() {
|
14
|
+
const OTHER_STYLES_SELECTOR = '//div[contains(text(),"Other styles")]';
|
15
|
+
await ( await page.waitForXPath( OTHER_STYLES_SELECTOR ) ).click();
|
16
|
+
}
|
17
|
+
|
18
|
+
async function getAvailableStyleVariations() {
|
19
|
+
const VARIATION_ITEMS_STYLES_SELECTOR =
|
20
|
+
'.edit-site-global-styles-variations_item';
|
21
|
+
await page.waitForSelector( VARIATION_ITEMS_STYLES_SELECTOR );
|
22
|
+
return page.$$( VARIATION_ITEMS_STYLES_SELECTOR );
|
23
|
+
}
|
24
|
+
|
25
|
+
async function applyVariation( number ) {
|
26
|
+
await toggleGlobalStyles();
|
27
|
+
await openOtherStyles();
|
28
|
+
const variations = await getAvailableStyleVariations();
|
29
|
+
await variations[ number ].click();
|
30
|
+
}
|
31
|
+
|
32
|
+
async function applyPinkVariation() {
|
33
|
+
await applyVariation( 1 );
|
34
|
+
}
|
35
|
+
|
36
|
+
async function applyYellowVariation() {
|
37
|
+
await applyVariation( 2 );
|
38
|
+
}
|
39
|
+
|
40
|
+
async function openColorsPanel() {
|
41
|
+
await openGlobalStylesPanel( 'Colors' );
|
42
|
+
}
|
43
|
+
|
44
|
+
async function openTypographyPanel() {
|
45
|
+
await openGlobalStylesPanel( 'Typography' );
|
46
|
+
}
|
47
|
+
|
48
|
+
async function openTextPanel() {
|
49
|
+
await openGlobalStylesPanel( 'Text' );
|
50
|
+
}
|
51
|
+
|
52
|
+
async function openPalettePanel() {
|
53
|
+
const selector = `//div[./h2[text()="Palette"]]//button`;
|
54
|
+
await ( await page.waitForXPath( selector ) ).click();
|
55
|
+
}
|
56
|
+
|
57
|
+
async function getFontSizeHint() {
|
58
|
+
const element = await page.$(
|
59
|
+
'.components-font-size-picker__header__hint'
|
60
|
+
);
|
61
|
+
return element.evaluate( ( el ) => el.textContent );
|
62
|
+
}
|
63
|
+
|
64
|
+
async function getCustomFontSizeValue() {
|
65
|
+
const element = await page.$(
|
66
|
+
'.components-font-size-picker input[aria-label="Custom"]'
|
67
|
+
);
|
68
|
+
return element.evaluate( ( el ) => el.value );
|
69
|
+
}
|
70
|
+
|
71
|
+
async function getColorValue( colorType ) {
|
72
|
+
return page.evaluate( ( _colorType ) => {
|
73
|
+
return document.evaluate(
|
74
|
+
`substring-before(substring-after(//div[@aria-label="Settings"]//button[.//*[text()="${ _colorType }"]]//*[contains(@class,"component-color-indicator")]/@style, "background: "), ";")`,
|
75
|
+
document,
|
76
|
+
null,
|
77
|
+
XPathResult.ANY_TYPE,
|
78
|
+
null
|
79
|
+
).stringValue;
|
80
|
+
}, colorType );
|
81
|
+
}
|
82
|
+
|
83
|
+
async function getBackgroundColorValue() {
|
84
|
+
return getColorValue( 'Background' );
|
85
|
+
}
|
86
|
+
|
87
|
+
async function getTextColorValue() {
|
88
|
+
return getColorValue( 'Text' );
|
89
|
+
}
|
90
|
+
|
91
|
+
async function getColorPalette( paletteSource ) {
|
92
|
+
const paletteOptions = await page.$x(
|
93
|
+
`//div[./*/h2[text()="${ paletteSource }"]]//button[contains(@class,"components-circular-option-picker__option")]`
|
94
|
+
);
|
95
|
+
return Promise.all(
|
96
|
+
paletteOptions.map( ( element ) => {
|
97
|
+
return element.evaluate( ( el ) => {
|
98
|
+
const color = el.style.backgroundColor;
|
99
|
+
const name = el
|
100
|
+
.getAttribute( 'aria-label' )
|
101
|
+
.substring( 'Color: '.length );
|
102
|
+
return { color, name };
|
103
|
+
} );
|
104
|
+
} )
|
105
|
+
);
|
106
|
+
}
|
107
|
+
|
108
|
+
async function getThemePalette() {
|
109
|
+
return getColorPalette( 'Theme' );
|
110
|
+
}
|
111
|
+
|
112
|
+
describe( 'Global styles variations', () => {
|
113
|
+
beforeAll( async () => {
|
114
|
+
await activateTheme( 'gutenberg-test-themes/style-variations' );
|
115
|
+
await trashAllPosts( 'wp_template' );
|
116
|
+
await trashAllPosts( 'wp_template_part' );
|
117
|
+
} );
|
118
|
+
afterAll( async () => {
|
119
|
+
await activateTheme( 'twentytwentyone' );
|
120
|
+
} );
|
121
|
+
beforeEach( async () => {
|
122
|
+
await visitSiteEditor();
|
123
|
+
} );
|
124
|
+
|
125
|
+
it( 'Should have three variations available with the first one being active', async () => {
|
126
|
+
await toggleGlobalStyles();
|
127
|
+
await openOtherStyles();
|
128
|
+
const variations = await getAvailableStyleVariations();
|
129
|
+
expect( variations ).toHaveLength( 3 );
|
130
|
+
expect(
|
131
|
+
await (
|
132
|
+
await variations[ 0 ].getProperty( 'className' )
|
133
|
+
).jsonValue()
|
134
|
+
).toContain( 'is-active' );
|
135
|
+
expect(
|
136
|
+
await (
|
137
|
+
await variations[ 1 ].getProperty( 'className' )
|
138
|
+
).jsonValue()
|
139
|
+
).not.toContain( 'is-active' );
|
140
|
+
expect(
|
141
|
+
await (
|
142
|
+
await variations[ 2 ].getProperty( 'className' )
|
143
|
+
).jsonValue()
|
144
|
+
).not.toContain( 'is-active' );
|
145
|
+
} );
|
146
|
+
|
147
|
+
it( 'Should apply preset colors and font sizes in a variation', async () => {
|
148
|
+
await applyPinkVariation();
|
149
|
+
await openPreviousGlobalStylesPanel();
|
150
|
+
await openColorsPanel();
|
151
|
+
expect( await getBackgroundColorValue() ).toBe( 'rgb(202, 105, 211)' );
|
152
|
+
expect( await getTextColorValue() ).toBe( 'rgb(74, 7, 74)' );
|
153
|
+
await openPreviousGlobalStylesPanel();
|
154
|
+
await openTypographyPanel();
|
155
|
+
await openTextPanel();
|
156
|
+
expect( await getFontSizeHint() ).toBe( 'Medium(px)' );
|
157
|
+
} );
|
158
|
+
|
159
|
+
it( 'Should apply custom colors and font sizes in a variation', async () => {
|
160
|
+
await applyYellowVariation();
|
161
|
+
await openPreviousGlobalStylesPanel();
|
162
|
+
await openColorsPanel();
|
163
|
+
expect( await getBackgroundColorValue() ).toBe( 'rgb(255, 239, 11)' );
|
164
|
+
expect( await getTextColorValue() ).toBe( 'rgb(25, 25, 17)' );
|
165
|
+
await openPreviousGlobalStylesPanel();
|
166
|
+
await openTypographyPanel();
|
167
|
+
await openTextPanel();
|
168
|
+
expect( await getFontSizeHint() ).toBe( '(Custom)' );
|
169
|
+
expect( await getCustomFontSizeValue() ).toBe( '15' );
|
170
|
+
} );
|
171
|
+
|
172
|
+
it( 'Should apply a color palette in a variation', async () => {
|
173
|
+
await applyPinkVariation();
|
174
|
+
await openPreviousGlobalStylesPanel();
|
175
|
+
await openColorsPanel();
|
176
|
+
await openPalettePanel();
|
177
|
+
expect( await getThemePalette() ).toMatchObject( [
|
178
|
+
{
|
179
|
+
color: 'rgb(74, 7, 74)',
|
180
|
+
name: 'Foreground',
|
181
|
+
},
|
182
|
+
{
|
183
|
+
color: 'rgb(202, 105, 211)',
|
184
|
+
name: 'Background',
|
185
|
+
},
|
186
|
+
{
|
187
|
+
color: 'rgba(204, 0, 255, 0.77)',
|
188
|
+
name: 'Awesome pink',
|
189
|
+
},
|
190
|
+
] );
|
191
|
+
} );
|
192
|
+
|
193
|
+
it( 'Should reflect style variations in the styles applied to the editor', async () => {
|
194
|
+
await applyYellowVariation();
|
195
|
+
const frame = await (
|
196
|
+
await page.waitForSelector( '.edit-site-visual-editor iframe' )
|
197
|
+
).contentFrame();
|
198
|
+
const paragraph = await frame.waitForXPath(
|
199
|
+
`//p[text()="My awesome paragraph"]`
|
200
|
+
);
|
201
|
+
const paragraphColor = await paragraph.evaluate( ( el ) => {
|
202
|
+
return window.getComputedStyle( el ).color;
|
203
|
+
} );
|
204
|
+
expect( paragraphColor ).toBe( 'rgb(25, 25, 17)' );
|
205
|
+
const body = await frame.$( 'body' );
|
206
|
+
const backgroundColor = await body.evaluate( ( el ) => {
|
207
|
+
return window.getComputedStyle( el ).backgroundColor;
|
208
|
+
} );
|
209
|
+
expect( backgroundColor ).toBe( 'rgb(255, 239, 11)' );
|
210
|
+
} );
|
211
|
+
} );
|
@@ -9,19 +9,15 @@ import {
|
|
9
9
|
selectBlockByClientId,
|
10
10
|
clickBlockToolbarButton,
|
11
11
|
canvas,
|
12
|
+
visitSiteEditor,
|
12
13
|
} from '@wordpress/e2e-test-utils';
|
13
14
|
|
14
|
-
/**
|
15
|
-
* Internal dependencies
|
16
|
-
*/
|
17
|
-
import { siteEditor } from './utils';
|
18
|
-
|
19
15
|
const templatePartNameInput =
|
20
16
|
'.edit-site-create-template-part-modal .components-text-control__input';
|
21
17
|
|
22
18
|
describe( 'Template Part', () => {
|
23
19
|
beforeAll( async () => {
|
24
|
-
await activateTheme( '
|
20
|
+
await activateTheme( 'emptytheme' );
|
25
21
|
await trashAllPosts( 'wp_template' );
|
26
22
|
await trashAllPosts( 'wp_template_part' );
|
27
23
|
} );
|
@@ -33,14 +29,13 @@ describe( 'Template Part', () => {
|
|
33
29
|
|
34
30
|
describe( 'Template part block', () => {
|
35
31
|
beforeEach( async () => {
|
36
|
-
await
|
37
|
-
await siteEditor.disableWelcomeGuide();
|
32
|
+
await visitSiteEditor();
|
38
33
|
} );
|
39
34
|
|
40
35
|
async function navigateToHeader() {
|
41
36
|
// Switch to editing the header template part.
|
42
|
-
await
|
43
|
-
postId: '
|
37
|
+
await visitSiteEditor( {
|
38
|
+
postId: 'emptytheme//header',
|
44
39
|
postType: 'wp_template_part',
|
45
40
|
} );
|
46
41
|
}
|
@@ -60,8 +55,8 @@ describe( 'Template Part', () => {
|
|
60
55
|
);
|
61
56
|
|
62
57
|
// Switch back to the Index template.
|
63
|
-
await
|
64
|
-
postId: '
|
58
|
+
await visitSiteEditor( {
|
59
|
+
postId: 'emptytheme//index',
|
65
60
|
postType: 'wp_template',
|
66
61
|
} );
|
67
62
|
}
|
@@ -93,12 +88,9 @@ describe( 'Template Part', () => {
|
|
93
88
|
expect( paragraphInTemplatePart ).not.toBeNull();
|
94
89
|
}
|
95
90
|
|
96
|
-
async function
|
97
|
-
await canvas().waitForSelector(
|
98
|
-
'.wp-block-template-part.site-header.block-editor-block-list__layout'
|
99
|
-
);
|
91
|
+
async function awaitHeaderLoad() {
|
100
92
|
await canvas().waitForSelector(
|
101
|
-
'.wp-block-template-part.
|
93
|
+
'header.wp-block-template-part.block-editor-block-list__layout'
|
102
94
|
);
|
103
95
|
}
|
104
96
|
|
@@ -172,7 +164,7 @@ describe( 'Template Part', () => {
|
|
172
164
|
} );
|
173
165
|
|
174
166
|
it( 'Should convert selected block to template part', async () => {
|
175
|
-
await
|
167
|
+
await awaitHeaderLoad();
|
176
168
|
const initialTemplateParts = await canvas().$$(
|
177
169
|
'.wp-block-template-part'
|
178
170
|
);
|
@@ -210,7 +202,7 @@ describe( 'Template Part', () => {
|
|
210
202
|
} );
|
211
203
|
|
212
204
|
it( 'Should convert multiple selected blocks to template part', async () => {
|
213
|
-
await
|
205
|
+
await awaitHeaderLoad();
|
214
206
|
const initialTemplateParts = await canvas().$$(
|
215
207
|
'.wp-block-template-part'
|
216
208
|
);
|
@@ -277,7 +269,7 @@ describe( 'Template Part', () => {
|
|
277
269
|
|
278
270
|
it( 'Should insert new template part on creation', async () => {
|
279
271
|
let siteEditorCanvas = canvas();
|
280
|
-
await
|
272
|
+
await awaitHeaderLoad();
|
281
273
|
|
282
274
|
// Create new template part.
|
283
275
|
await insertBlock( 'Template Part' );
|
@@ -317,9 +309,9 @@ describe( 'Template Part', () => {
|
|
317
309
|
await page.click( entitiesSaveSelector );
|
318
310
|
|
319
311
|
// Reload the page so as the new template part is available in the existing template parts.
|
320
|
-
await
|
312
|
+
await visitSiteEditor();
|
321
313
|
siteEditorCanvas = canvas();
|
322
|
-
await
|
314
|
+
await awaitHeaderLoad();
|
323
315
|
// Try to insert the template part we created.
|
324
316
|
await insertBlock( 'Template Part' );
|
325
317
|
const chooseExistingButton = await siteEditorCanvas.waitForXPath(
|
@@ -8,43 +8,36 @@ import {
|
|
8
8
|
switchUserToAdmin,
|
9
9
|
switchUserToTest,
|
10
10
|
visitAdminPage,
|
11
|
+
visitSiteEditor,
|
12
|
+
getCurrentSiteEditorContent,
|
11
13
|
} from '@wordpress/e2e-test-utils';
|
12
14
|
import { addQueryArgs } from '@wordpress/url';
|
13
15
|
|
14
|
-
|
15
|
-
* Internal dependencies
|
16
|
-
*/
|
17
|
-
import { siteEditor } from './utils';
|
18
|
-
|
19
|
-
const {
|
20
|
-
visit: visitSiteEditor,
|
21
|
-
getEditedPostContent,
|
22
|
-
disableWelcomeGuide,
|
23
|
-
} = siteEditor;
|
24
|
-
|
25
|
-
const assertSaveButtonIsDisabled = () =>
|
16
|
+
const assertSaveButtonIsDisabled = async () =>
|
26
17
|
page.waitForSelector(
|
27
18
|
'.edit-site-save-button__button[aria-disabled="true"]'
|
28
19
|
);
|
29
20
|
|
30
|
-
const assertSaveButtonIsEnabled = () =>
|
21
|
+
const assertSaveButtonIsEnabled = async () =>
|
31
22
|
page.waitForSelector(
|
32
23
|
'.edit-site-save-button__button[aria-disabled="false"]'
|
33
24
|
);
|
34
25
|
|
35
|
-
const waitForNotice = () => page.waitForSelector( '.components-snackbar' );
|
36
|
-
|
37
26
|
const clickButtonInNotice = async () => {
|
38
27
|
const selector = '.components-snackbar button';
|
39
28
|
await page.waitForSelector( selector );
|
40
29
|
await page.click( selector );
|
41
30
|
};
|
42
31
|
|
43
|
-
const clickUndoInHeaderToolbar = () =>
|
32
|
+
const clickUndoInHeaderToolbar = async () =>
|
44
33
|
page.click( '.edit-site-header__toolbar button[aria-label="Undo"]' );
|
45
34
|
|
46
|
-
const clickRedoInHeaderToolbar = () =>
|
47
|
-
page.
|
35
|
+
const clickRedoInHeaderToolbar = async () => {
|
36
|
+
await page.waitForSelector(
|
37
|
+
'.edit-site-header__toolbar button[aria-label="Redo"][aria-disabled="false"]'
|
38
|
+
);
|
39
|
+
return page.click( '.edit-site-header__toolbar button[aria-label="Redo"]' );
|
40
|
+
};
|
48
41
|
|
49
42
|
const undoRevertInHeaderToolbar = async () => {
|
50
43
|
await clickUndoInHeaderToolbar();
|
@@ -72,7 +65,9 @@ const save = async () => {
|
|
72
65
|
const revertTemplate = async () => {
|
73
66
|
await page.click( '.edit-site-document-actions__get-info' );
|
74
67
|
await page.click( '.edit-site-template-details__revert-button' );
|
75
|
-
await
|
68
|
+
await page.waitForXPath(
|
69
|
+
'//*[contains(@class, "components-snackbar") and contains(text(), "Template reverted")]'
|
70
|
+
);
|
76
71
|
await assertSaveButtonIsEnabled();
|
77
72
|
};
|
78
73
|
|
@@ -89,7 +84,7 @@ const assertTemplatesAreDeleted = async () => {
|
|
89
84
|
|
90
85
|
describe( 'Template Revert', () => {
|
91
86
|
beforeAll( async () => {
|
92
|
-
await activateTheme( '
|
87
|
+
await activateTheme( 'emptytheme' );
|
93
88
|
await trashAllPosts( 'wp_template' );
|
94
89
|
await trashAllPosts( 'wp_template_part' );
|
95
90
|
} );
|
@@ -101,7 +96,6 @@ describe( 'Template Revert', () => {
|
|
101
96
|
beforeEach( async () => {
|
102
97
|
await trashAllPosts( 'wp_template' );
|
103
98
|
await visitSiteEditor();
|
104
|
-
await disableWelcomeGuide();
|
105
99
|
} );
|
106
100
|
|
107
101
|
it( 'should delete the template after saving the reverted template', async () => {
|
@@ -114,19 +108,19 @@ describe( 'Template Revert', () => {
|
|
114
108
|
} );
|
115
109
|
|
116
110
|
it( 'should show the original content after revert', async () => {
|
117
|
-
const contentBefore = await
|
111
|
+
const contentBefore = await getCurrentSiteEditorContent();
|
118
112
|
|
119
113
|
await addDummyText();
|
120
114
|
await save();
|
121
115
|
await revertTemplate();
|
122
116
|
await save();
|
123
117
|
|
124
|
-
const contentAfter = await
|
118
|
+
const contentAfter = await getCurrentSiteEditorContent();
|
125
119
|
expect( contentBefore ).toBe( contentAfter );
|
126
120
|
} );
|
127
121
|
|
128
122
|
it( 'should show the original content after revert and page reload', async () => {
|
129
|
-
const contentBefore = await
|
123
|
+
const contentBefore = await getCurrentSiteEditorContent();
|
130
124
|
|
131
125
|
await addDummyText();
|
132
126
|
await save();
|
@@ -134,38 +128,38 @@ describe( 'Template Revert', () => {
|
|
134
128
|
await save();
|
135
129
|
await visitSiteEditor();
|
136
130
|
|
137
|
-
const contentAfter = await
|
131
|
+
const contentAfter = await getCurrentSiteEditorContent();
|
138
132
|
expect( contentBefore ).toBe( contentAfter );
|
139
133
|
} );
|
140
134
|
|
141
135
|
it( 'should show the edited content after revert and clicking undo in the header toolbar', async () => {
|
142
136
|
await addDummyText();
|
143
137
|
await save();
|
144
|
-
const contentBefore = await
|
138
|
+
const contentBefore = await getCurrentSiteEditorContent();
|
145
139
|
|
146
140
|
await revertTemplate();
|
147
141
|
await save();
|
148
142
|
await undoRevertInHeaderToolbar();
|
149
143
|
|
150
|
-
const contentAfter = await
|
144
|
+
const contentAfter = await getCurrentSiteEditorContent();
|
151
145
|
expect( contentBefore ).toBe( contentAfter );
|
152
146
|
} );
|
153
147
|
|
154
148
|
it( 'should show the edited content after revert and clicking undo in the notice', async () => {
|
155
149
|
await addDummyText();
|
156
150
|
await save();
|
157
|
-
const contentBefore = await
|
151
|
+
const contentBefore = await getCurrentSiteEditorContent();
|
158
152
|
|
159
153
|
await revertTemplate();
|
160
154
|
await save();
|
161
155
|
await undoRevertInNotice();
|
162
156
|
|
163
|
-
const contentAfter = await
|
157
|
+
const contentAfter = await getCurrentSiteEditorContent();
|
164
158
|
expect( contentBefore ).toBe( contentAfter );
|
165
159
|
} );
|
166
160
|
|
167
161
|
it( 'should show the original content after revert, clicking undo then redo in the header toolbar', async () => {
|
168
|
-
const contentBefore = await
|
162
|
+
const contentBefore = await getCurrentSiteEditorContent();
|
169
163
|
|
170
164
|
await addDummyText();
|
171
165
|
await save();
|
@@ -174,12 +168,12 @@ describe( 'Template Revert', () => {
|
|
174
168
|
await undoRevertInHeaderToolbar();
|
175
169
|
await clickRedoInHeaderToolbar();
|
176
170
|
|
177
|
-
const contentAfter = await
|
171
|
+
const contentAfter = await getCurrentSiteEditorContent();
|
178
172
|
expect( contentBefore ).toBe( contentAfter );
|
179
173
|
} );
|
180
174
|
|
181
175
|
it( 'should show the original content after revert, clicking undo in the notice then undo in the header toolbar', async () => {
|
182
|
-
const contentBefore = await
|
176
|
+
const contentBefore = await getCurrentSiteEditorContent();
|
183
177
|
|
184
178
|
await addDummyText();
|
185
179
|
await save();
|
@@ -188,14 +182,14 @@ describe( 'Template Revert', () => {
|
|
188
182
|
await undoRevertInNotice();
|
189
183
|
await undoRevertInHeaderToolbar();
|
190
184
|
|
191
|
-
const contentAfter = await
|
185
|
+
const contentAfter = await getCurrentSiteEditorContent();
|
192
186
|
expect( contentBefore ).toBe( contentAfter );
|
193
187
|
} );
|
194
188
|
|
195
189
|
it( 'should show the edited content after revert, clicking undo in the header toolbar, save and reload', async () => {
|
196
190
|
await addDummyText();
|
197
191
|
await save();
|
198
|
-
const contentBefore = await
|
192
|
+
const contentBefore = await getCurrentSiteEditorContent();
|
199
193
|
|
200
194
|
await revertTemplate();
|
201
195
|
await save();
|
@@ -204,14 +198,14 @@ describe( 'Template Revert', () => {
|
|
204
198
|
await assertSaveButtonIsDisabled();
|
205
199
|
await visitSiteEditor();
|
206
200
|
|
207
|
-
const contentAfter = await
|
201
|
+
const contentAfter = await getCurrentSiteEditorContent();
|
208
202
|
expect( contentBefore ).toBe( contentAfter );
|
209
203
|
} );
|
210
204
|
|
211
205
|
it( 'should show the edited content after revert, clicking undo in the notice and reload', async () => {
|
212
206
|
await addDummyText();
|
213
207
|
await save();
|
214
|
-
const contentBefore = await
|
208
|
+
const contentBefore = await getCurrentSiteEditorContent();
|
215
209
|
|
216
210
|
await revertTemplate();
|
217
211
|
await save();
|
@@ -219,7 +213,7 @@ describe( 'Template Revert', () => {
|
|
219
213
|
await save();
|
220
214
|
await visitSiteEditor();
|
221
215
|
|
222
|
-
const contentAfter = await
|
216
|
+
const contentAfter = await getCurrentSiteEditorContent();
|
223
217
|
expect( contentBefore ).toBe( contentAfter );
|
224
218
|
} );
|
225
219
|
} );
|
@@ -19,10 +19,6 @@ import {
|
|
19
19
|
// eslint-disable-next-line no-restricted-imports
|
20
20
|
import { find, findAll } from 'puppeteer-testing-library';
|
21
21
|
|
22
|
-
const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added.
|
23
|
-
For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
|
24
|
-
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`;
|
25
|
-
|
26
22
|
describe( 'Widgets Customizer', () => {
|
27
23
|
beforeEach( async () => {
|
28
24
|
await deleteAllWidgets();
|
@@ -163,8 +159,6 @@ describe( 'Widgets Customizer', () => {
|
|
163
159
|
name: 'My Search',
|
164
160
|
selector: '.widget-content *',
|
165
161
|
} ).toBeFound( findOptions );
|
166
|
-
|
167
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
168
162
|
} );
|
169
163
|
|
170
164
|
it( 'should open the inspector panel', async () => {
|
@@ -195,7 +189,7 @@ describe( 'Widgets Customizer', () => {
|
|
195
189
|
|
196
190
|
const backButton = await find( {
|
197
191
|
role: 'button',
|
198
|
-
name:
|
192
|
+
name: /Back/,
|
199
193
|
focused: true,
|
200
194
|
} );
|
201
195
|
await expect( backButton ).toHaveFocus();
|
@@ -250,8 +244,6 @@ describe( 'Widgets Customizer', () => {
|
|
250
244
|
} ).toBeFound();
|
251
245
|
|
252
246
|
await expect( inspectorHeading ).not.toBeVisible();
|
253
|
-
|
254
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
255
247
|
} );
|
256
248
|
|
257
249
|
it( 'should handle the inserter outer section', async () => {
|
@@ -349,7 +341,7 @@ describe( 'Widgets Customizer', () => {
|
|
349
341
|
// Back to the widget areas panel.
|
350
342
|
const backButton = await find( {
|
351
343
|
role: 'button',
|
352
|
-
name:
|
344
|
+
name: /Back/,
|
353
345
|
} );
|
354
346
|
await backButton.click();
|
355
347
|
|
@@ -359,8 +351,6 @@ describe( 'Widgets Customizer', () => {
|
|
359
351
|
name: 'Add a block',
|
360
352
|
level: 2,
|
361
353
|
} ).not.toBeFound();
|
362
|
-
|
363
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
364
354
|
} );
|
365
355
|
|
366
356
|
it( 'should move focus to the block', async () => {
|
@@ -387,7 +377,7 @@ describe( 'Widgets Customizer', () => {
|
|
387
377
|
await page.keyboard.type( 'First Heading' );
|
388
378
|
|
389
379
|
// Navigate back to the parent panel.
|
390
|
-
const backButton = await find( { role: 'button', name:
|
380
|
+
const backButton = await find( { role: 'button', name: /Back/ } );
|
391
381
|
await backButton.click();
|
392
382
|
|
393
383
|
await waitForPreviewIframe();
|
@@ -456,8 +446,6 @@ describe( 'Widgets Customizer', () => {
|
|
456
446
|
text: 'First Heading',
|
457
447
|
} );
|
458
448
|
await expect( headingBlock ).toHaveFocus();
|
459
|
-
|
460
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
461
449
|
} );
|
462
450
|
|
463
451
|
it( 'should clear block selection', async () => {
|
@@ -520,8 +508,6 @@ describe( 'Widgets Customizer', () => {
|
|
520
508
|
role: 'toolbar',
|
521
509
|
name: 'Block tools',
|
522
510
|
} ).not.toBeFound();
|
523
|
-
|
524
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
525
511
|
} );
|
526
512
|
|
527
513
|
it( 'should handle legacy widgets', async () => {
|
@@ -700,8 +686,6 @@ describe( 'Widgets Customizer', () => {
|
|
700
686
|
selector: '*[aria-live="polite"][aria-relevant="additions text"]',
|
701
687
|
} ).toBeFound();
|
702
688
|
await expect( paragraphBlock ).toBeVisible();
|
703
|
-
|
704
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
705
689
|
} );
|
706
690
|
|
707
691
|
it( 'should move (inner) blocks to another sidebar', async () => {
|
@@ -761,8 +745,6 @@ describe( 'Widgets Customizer', () => {
|
|
761
745
|
await expect( movedParagraphBlockQuery ).toBeFound();
|
762
746
|
const movedParagraphBlock = await find( movedParagraphBlockQuery );
|
763
747
|
await expect( movedParagraphBlock ).toHaveFocus();
|
764
|
-
|
765
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
766
748
|
} );
|
767
749
|
|
768
750
|
it( 'should not render Block Settings sections', async () => {
|
@@ -855,8 +837,6 @@ describe( 'Widgets Customizer', () => {
|
|
855
837
|
name: 'Customizing ▸ Widgets ▸ Footer #1 Block Settings',
|
856
838
|
level: 3,
|
857
839
|
} );
|
858
|
-
|
859
|
-
expect( console ).toHaveWarned( twentyTwentyError );
|
860
840
|
} );
|
861
841
|
} );
|
862
842
|
|