@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,213 +0,0 @@
|
|
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(),"Browse 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( label ) {
|
26
|
-
await toggleGlobalStyles();
|
27
|
-
await openOtherStyles();
|
28
|
-
const variation = await page.waitForXPath(
|
29
|
-
`//*[@role="button"][@aria-label="${ label }"]`
|
30
|
-
);
|
31
|
-
await variation.click();
|
32
|
-
}
|
33
|
-
|
34
|
-
async function applyPinkVariation() {
|
35
|
-
await applyVariation( 'pink' );
|
36
|
-
}
|
37
|
-
|
38
|
-
async function applyYellowVariation() {
|
39
|
-
await applyVariation( 'yellow' );
|
40
|
-
}
|
41
|
-
|
42
|
-
async function openColorsPanel() {
|
43
|
-
await openGlobalStylesPanel( 'Colors' );
|
44
|
-
}
|
45
|
-
|
46
|
-
async function openTypographyPanel() {
|
47
|
-
await openGlobalStylesPanel( 'Typography' );
|
48
|
-
}
|
49
|
-
|
50
|
-
async function openTextPanel() {
|
51
|
-
await openGlobalStylesPanel( 'Text' );
|
52
|
-
}
|
53
|
-
|
54
|
-
async function openPalettePanel() {
|
55
|
-
const selector = `//div[./h2[text()="Palette"]]//button`;
|
56
|
-
await ( await page.waitForXPath( selector ) ).click();
|
57
|
-
}
|
58
|
-
|
59
|
-
async function getFontSizeHint() {
|
60
|
-
const element = await page.$(
|
61
|
-
'.components-font-size-picker__header__hint'
|
62
|
-
);
|
63
|
-
return element.evaluate( ( el ) => el.textContent );
|
64
|
-
}
|
65
|
-
|
66
|
-
async function getCustomFontSizeValue() {
|
67
|
-
const element = await page.$(
|
68
|
-
'.components-font-size-picker input[aria-label="Custom"]'
|
69
|
-
);
|
70
|
-
return element.evaluate( ( el ) => el.value );
|
71
|
-
}
|
72
|
-
|
73
|
-
async function getColorValue( colorType ) {
|
74
|
-
return page.evaluate( ( _colorType ) => {
|
75
|
-
return document.evaluate(
|
76
|
-
`substring-before(substring-after(//div[contains(@class, "edit-site-global-styles-sidebar__panel")]//button[.//*[text()="${ _colorType }"]]//*[contains(@class,"component-color-indicator")]/@style, "background: "), ";")`,
|
77
|
-
document,
|
78
|
-
null,
|
79
|
-
XPathResult.ANY_TYPE,
|
80
|
-
null
|
81
|
-
).stringValue;
|
82
|
-
}, colorType );
|
83
|
-
}
|
84
|
-
|
85
|
-
async function getBackgroundColorValue() {
|
86
|
-
return getColorValue( 'Background' );
|
87
|
-
}
|
88
|
-
|
89
|
-
async function getTextColorValue() {
|
90
|
-
return getColorValue( 'Text' );
|
91
|
-
}
|
92
|
-
|
93
|
-
async function getColorPalette( paletteSource ) {
|
94
|
-
const paletteOptions = await page.$x(
|
95
|
-
`//div[./*/h2[text()="${ paletteSource }"]]//button[contains(@class,"components-circular-option-picker__option")]`
|
96
|
-
);
|
97
|
-
return Promise.all(
|
98
|
-
paletteOptions.map( ( element ) => {
|
99
|
-
return element.evaluate( ( el ) => {
|
100
|
-
const color = el.style.backgroundColor;
|
101
|
-
const name = el
|
102
|
-
.getAttribute( 'aria-label' )
|
103
|
-
.substring( 'Color: '.length );
|
104
|
-
return { color, name };
|
105
|
-
} );
|
106
|
-
} )
|
107
|
-
);
|
108
|
-
}
|
109
|
-
|
110
|
-
async function getThemePalette() {
|
111
|
-
return getColorPalette( 'Theme' );
|
112
|
-
}
|
113
|
-
|
114
|
-
describe( 'Global styles variations', () => {
|
115
|
-
beforeAll( async () => {
|
116
|
-
await activateTheme( 'gutenberg-test-themes/style-variations' );
|
117
|
-
await trashAllPosts( 'wp_template' );
|
118
|
-
await trashAllPosts( 'wp_template_part' );
|
119
|
-
} );
|
120
|
-
afterAll( async () => {
|
121
|
-
await activateTheme( 'twentytwentyone' );
|
122
|
-
} );
|
123
|
-
beforeEach( async () => {
|
124
|
-
await visitSiteEditor();
|
125
|
-
} );
|
126
|
-
|
127
|
-
it( 'Should have three variations available with the first one being active', async () => {
|
128
|
-
await toggleGlobalStyles();
|
129
|
-
await openOtherStyles();
|
130
|
-
const variations = await getAvailableStyleVariations();
|
131
|
-
expect( variations ).toHaveLength( 3 );
|
132
|
-
expect(
|
133
|
-
await (
|
134
|
-
await variations[ 0 ].getProperty( 'className' )
|
135
|
-
).jsonValue()
|
136
|
-
).toContain( 'is-active' );
|
137
|
-
expect(
|
138
|
-
await (
|
139
|
-
await variations[ 1 ].getProperty( 'className' )
|
140
|
-
).jsonValue()
|
141
|
-
).not.toContain( 'is-active' );
|
142
|
-
expect(
|
143
|
-
await (
|
144
|
-
await variations[ 2 ].getProperty( 'className' )
|
145
|
-
).jsonValue()
|
146
|
-
).not.toContain( 'is-active' );
|
147
|
-
} );
|
148
|
-
|
149
|
-
it( 'Should apply preset colors and font sizes in a variation', async () => {
|
150
|
-
await applyPinkVariation();
|
151
|
-
await openPreviousGlobalStylesPanel();
|
152
|
-
await openColorsPanel();
|
153
|
-
expect( await getBackgroundColorValue() ).toBe( 'rgb(202, 105, 211)' );
|
154
|
-
expect( await getTextColorValue() ).toBe( 'rgb(74, 7, 74)' );
|
155
|
-
await openPreviousGlobalStylesPanel();
|
156
|
-
await openTypographyPanel();
|
157
|
-
await openTextPanel();
|
158
|
-
expect( await getFontSizeHint() ).toBe( 'Medium(px)' );
|
159
|
-
} );
|
160
|
-
|
161
|
-
it( 'Should apply custom colors and font sizes in a variation', async () => {
|
162
|
-
await applyYellowVariation();
|
163
|
-
await openPreviousGlobalStylesPanel();
|
164
|
-
await openColorsPanel();
|
165
|
-
expect( await getBackgroundColorValue() ).toBe( 'rgb(255, 239, 11)' );
|
166
|
-
expect( await getTextColorValue() ).toBe( 'rgb(25, 25, 17)' );
|
167
|
-
await openPreviousGlobalStylesPanel();
|
168
|
-
await openTypographyPanel();
|
169
|
-
await openTextPanel();
|
170
|
-
expect( await getFontSizeHint() ).toBe( '(Custom)' );
|
171
|
-
expect( await getCustomFontSizeValue() ).toBe( '15' );
|
172
|
-
} );
|
173
|
-
|
174
|
-
it( 'Should apply a color palette in a variation', async () => {
|
175
|
-
await applyPinkVariation();
|
176
|
-
await openPreviousGlobalStylesPanel();
|
177
|
-
await openColorsPanel();
|
178
|
-
await openPalettePanel();
|
179
|
-
expect( await getThemePalette() ).toMatchObject( [
|
180
|
-
{
|
181
|
-
color: 'rgb(74, 7, 74)',
|
182
|
-
name: 'Foreground',
|
183
|
-
},
|
184
|
-
{
|
185
|
-
color: 'rgb(202, 105, 211)',
|
186
|
-
name: 'Background',
|
187
|
-
},
|
188
|
-
{
|
189
|
-
color: 'rgba(204, 0, 255, 0.77)',
|
190
|
-
name: 'Awesome pink',
|
191
|
-
},
|
192
|
-
] );
|
193
|
-
} );
|
194
|
-
|
195
|
-
it( 'Should reflect style variations in the styles applied to the editor', async () => {
|
196
|
-
await applyYellowVariation();
|
197
|
-
const frame = await (
|
198
|
-
await page.waitForSelector( '.edit-site-visual-editor iframe' )
|
199
|
-
).contentFrame();
|
200
|
-
const paragraph = await frame.waitForXPath(
|
201
|
-
`//p[text()="My awesome paragraph"]`
|
202
|
-
);
|
203
|
-
const paragraphColor = await paragraph.evaluate( ( el ) => {
|
204
|
-
return window.getComputedStyle( el ).color;
|
205
|
-
} );
|
206
|
-
expect( paragraphColor ).toBe( 'rgb(25, 25, 17)' );
|
207
|
-
const body = await frame.$( 'body' );
|
208
|
-
const backgroundColor = await body.evaluate( ( el ) => {
|
209
|
-
return window.getComputedStyle( el ).backgroundColor;
|
210
|
-
} );
|
211
|
-
expect( backgroundColor ).toBe( 'rgb(255, 239, 11)' );
|
212
|
-
} );
|
213
|
-
} );
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<!-- wp:query {"queryId":1,"query":{"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","sticky":""}} -->
|
2
|
-
<div class="wp-block-query">
|
3
|
-
<!-- wp:post-template -->
|
4
|
-
<!-- wp:post-title {"isLink":true} /-->
|
5
|
-
<!-- wp:post-excerpt /-->
|
6
|
-
<!-- /wp:post-template -->
|
7
|
-
</div>
|
8
|
-
<!-- /wp:query -->
|
9
|
-
<!-- wp:paragraph -->
|
10
|
-
<p>My awesome paragraph</p>
|
11
|
-
<!-- /wp:paragraph -->
|
File without changes
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Theme Name: Style variations
|
3
|
-
Theme URI: https://github.com/wordpress/theme-experiments/
|
4
|
-
Author: the WordPress team
|
5
|
-
Description: Style variations test theme.
|
6
|
-
Requires at least: 5.3
|
7
|
-
Tested up to: 5.5
|
8
|
-
Requires PHP: 5.6
|
9
|
-
Version: 1.0
|
10
|
-
License: GNU General Public License v2 or later
|
11
|
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12
|
-
Text Domain: style-variations
|
13
|
-
Style variations WordPress Theme, (C) 2021 WordPress.org
|
14
|
-
Style variations is distributed under the terms of the GNU GPL.
|
15
|
-
*/
|
@@ -1,33 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 2,
|
3
|
-
"settings": {
|
4
|
-
"color": {
|
5
|
-
"palette": [
|
6
|
-
{
|
7
|
-
"slug": "foreground",
|
8
|
-
"color": "#4a074a",
|
9
|
-
"name": "Foreground"
|
10
|
-
},
|
11
|
-
{
|
12
|
-
"slug": "background",
|
13
|
-
"color": "#ca69d3",
|
14
|
-
"name": "Background"
|
15
|
-
},
|
16
|
-
{
|
17
|
-
"slug": "awesome-pink",
|
18
|
-
"color": "#cc00ffc4",
|
19
|
-
"name": "Awesome pink"
|
20
|
-
}
|
21
|
-
]
|
22
|
-
}
|
23
|
-
},
|
24
|
-
"styles": {
|
25
|
-
"color": {
|
26
|
-
"background": "var(--wp--preset--color--background)",
|
27
|
-
"text": "var(--wp--preset--color--foreground)"
|
28
|
-
},
|
29
|
-
"typography": {
|
30
|
-
"fontSize": "var(--wp--preset--font-size--medium)"
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|