@wordpress/e2e-tests 3.1.0 → 4.0.1
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 +6 -0
- package/README.md +2 -0
- package/config/flaky-tests-reporter.js +1 -0
- package/package.json +10 -8
- package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +8 -0
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +2 -2
- package/specs/editor/blocks/__snapshots__/separator.test.js.snap +1 -1
- package/specs/editor/blocks/buttons.test.js +10 -0
- package/specs/editor/blocks/columns.test.js +3 -3
- package/specs/editor/blocks/gallery.test.js +36 -6
- package/specs/editor/blocks/heading.test.js +1 -1
- package/specs/editor/blocks/navigation.test.js +370 -72
- package/specs/editor/blocks/query.test.js +13 -3
- package/specs/editor/plugins/annotations.test.js +63 -67
- package/specs/editor/various/__snapshots__/block-deletion.test.js.snap +20 -12
- package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +26 -0
- package/specs/editor/various/__snapshots__/block-hierarchy-navigation.test.js.snap +1 -1
- package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +122 -6
- package/specs/editor/various/__snapshots__/writing-flow.test.js.snap +6 -6
- package/specs/editor/various/autosave.test.js +3 -3
- package/specs/editor/various/block-deletion.test.js +1 -0
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +3 -5
- package/specs/editor/various/block-hierarchy-navigation.test.js +10 -16
- package/specs/editor/various/block-locking.test.js +120 -0
- package/specs/editor/various/keyboard-navigable-blocks.test.js +23 -0
- package/specs/editor/various/list-view.test.js +139 -7
- package/specs/editor/various/multi-block-selection.test.js +153 -9
- package/specs/editor/various/post-editor-template-mode.test.js +1 -1
- package/specs/editor/various/toolbar-roving-tabindex.test.js +10 -4
- package/specs/editor/various/writing-flow.test.js +10 -5
- package/specs/experiments/blocks/comments-query.test.js +131 -0
- package/specs/experiments/navigation-editor.test.js +126 -121
- package/specs/performance/post-editor.test.js +4 -6
- package/specs/site-editor/global-styles-sidebar.test.js +42 -0
- package/specs/site-editor/iframe-rendering-mode.test.js +31 -0
- package/specs/site-editor/site-editor-export.test.js +2 -2
- package/specs/site-editor/style-variations.test.js +9 -7
- package/specs/site-editor/template-part.test.js +3 -1
- package/specs/editor/various/__snapshots__/copy-cut-paste-whole-blocks.test.js.snap +0 -125
- package/specs/editor/various/copy-cut-paste-whole-blocks.test.js +0 -187
- package/specs/editor/various/new-post.test.js +0 -99
- package/specs/widgets/customizing-widgets.test.js +0 -913
@@ -0,0 +1,131 @@
|
|
1
|
+
/**
|
2
|
+
* WordPress dependencies
|
3
|
+
*/
|
4
|
+
import {
|
5
|
+
activateTheme,
|
6
|
+
createNewPost,
|
7
|
+
insertBlock,
|
8
|
+
pressKeyTimes,
|
9
|
+
publishPost,
|
10
|
+
setOption,
|
11
|
+
trashAllComments,
|
12
|
+
} from '@wordpress/e2e-test-utils';
|
13
|
+
|
14
|
+
describe( 'Comment Query Loop', () => {
|
15
|
+
let previousPageComments,
|
16
|
+
previousCommentsPerPage,
|
17
|
+
previousDefaultCommentsPage;
|
18
|
+
beforeAll( async () => {
|
19
|
+
await activateTheme( 'emptytheme' );
|
20
|
+
previousPageComments = await setOption( 'page_comments', '1' );
|
21
|
+
previousCommentsPerPage = await setOption( 'comments_per_page', '1' );
|
22
|
+
previousDefaultCommentsPage = await setOption(
|
23
|
+
'default_comments_page',
|
24
|
+
'newest'
|
25
|
+
);
|
26
|
+
} );
|
27
|
+
it( 'Pagination links are working as expected', async () => {
|
28
|
+
await createNewPost();
|
29
|
+
// Insert the Query Comment Loop block.
|
30
|
+
await insertBlock( 'Comments Query Loop' );
|
31
|
+
// Insert the Comment Loop form.
|
32
|
+
await insertBlock( 'Post Comments Form' );
|
33
|
+
await publishPost();
|
34
|
+
// Visit the post that was just published.
|
35
|
+
await page.click(
|
36
|
+
'.post-publish-panel__postpublish-buttons .is-primary'
|
37
|
+
);
|
38
|
+
|
39
|
+
// TODO: We can extract this into a util once we find we need it elsewhere.
|
40
|
+
// Create three comments for that post.
|
41
|
+
for ( let i = 0; i < 3; i++ ) {
|
42
|
+
await page.waitForSelector( 'textarea#comment' );
|
43
|
+
await page.click( 'textarea#comment' );
|
44
|
+
await page.type(
|
45
|
+
`textarea#comment`,
|
46
|
+
`This is an automated comment - ${ i }`
|
47
|
+
);
|
48
|
+
await pressKeyTimes( 'Tab', 1 );
|
49
|
+
await Promise.all( [
|
50
|
+
page.keyboard.press( 'Enter' ),
|
51
|
+
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
|
52
|
+
] );
|
53
|
+
}
|
54
|
+
|
55
|
+
// We check that there is a previous comments page link.
|
56
|
+
expect(
|
57
|
+
await page.$( '.wp-block-comments-pagination-previous' )
|
58
|
+
).not.toBeNull();
|
59
|
+
expect(
|
60
|
+
await page.$( '.wp-block-comments-pagination-next' )
|
61
|
+
).toBeNull();
|
62
|
+
|
63
|
+
await Promise.all( [
|
64
|
+
page.click( '.wp-block-comments-pagination-previous' ),
|
65
|
+
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
|
66
|
+
] );
|
67
|
+
|
68
|
+
// We check that there are a previous and a next link.
|
69
|
+
expect(
|
70
|
+
await page.$( '.wp-block-comments-pagination-previous' )
|
71
|
+
).not.toBeNull();
|
72
|
+
expect(
|
73
|
+
await page.$( '.wp-block-comments-pagination-next' )
|
74
|
+
).not.toBeNull();
|
75
|
+
|
76
|
+
await Promise.all( [
|
77
|
+
page.click( '.wp-block-comments-pagination-previous' ),
|
78
|
+
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
|
79
|
+
] );
|
80
|
+
|
81
|
+
// We check that there is only have a next link
|
82
|
+
expect(
|
83
|
+
await page.$( '.wp-block-comments-pagination-previous' )
|
84
|
+
).toBeNull();
|
85
|
+
expect(
|
86
|
+
await page.$( '.wp-block-comments-pagination-next' )
|
87
|
+
).not.toBeNull();
|
88
|
+
} );
|
89
|
+
it( 'Pagination links are not appearing if break comments is not enabled', async () => {
|
90
|
+
await setOption( 'page_comments', '0' );
|
91
|
+
await createNewPost();
|
92
|
+
// Insert the Query Comment Loop block.
|
93
|
+
await insertBlock( 'Comments Query Loop' );
|
94
|
+
// Insert the Comment Loop form.
|
95
|
+
await insertBlock( 'Post Comments Form' );
|
96
|
+
await publishPost();
|
97
|
+
// Visit the post that was just published.
|
98
|
+
await page.click(
|
99
|
+
'.post-publish-panel__postpublish-buttons .is-primary'
|
100
|
+
);
|
101
|
+
|
102
|
+
// Create three comments for that post.
|
103
|
+
for ( let i = 0; i < 3; i++ ) {
|
104
|
+
await page.waitForSelector( 'textarea#comment' );
|
105
|
+
await page.click( 'textarea#comment' );
|
106
|
+
await page.type(
|
107
|
+
`textarea#comment`,
|
108
|
+
`This is an automated comment - ${ i }`
|
109
|
+
);
|
110
|
+
await pressKeyTimes( 'Tab', 1 );
|
111
|
+
await Promise.all( [
|
112
|
+
page.keyboard.press( 'Enter' ),
|
113
|
+
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
|
114
|
+
] );
|
115
|
+
}
|
116
|
+
// We check that there are no comments page link.
|
117
|
+
expect(
|
118
|
+
await page.$( '.wp-block-comments-pagination-previous' )
|
119
|
+
).toBeNull();
|
120
|
+
expect(
|
121
|
+
await page.$( '.wp-block-comments-pagination-next' )
|
122
|
+
).toBeNull();
|
123
|
+
} );
|
124
|
+
afterAll( async () => {
|
125
|
+
await trashAllComments();
|
126
|
+
await activateTheme( 'twentytwentyone' );
|
127
|
+
await setOption( 'page_comments', previousPageComments );
|
128
|
+
await setOption( 'comments_per_page', previousCommentsPerPage );
|
129
|
+
await setOption( 'default_comments_page', previousDefaultCommentsPage );
|
130
|
+
} );
|
131
|
+
} );
|
@@ -701,147 +701,152 @@ describe.skip( 'Navigation editor', () => {
|
|
701
701
|
expect( lastItemAttributes.isTopLevelLink ).toBeTruthy();
|
702
702
|
} );
|
703
703
|
} );
|
704
|
-
} );
|
705
704
|
|
706
|
-
describe( 'Delete menu button', () => {
|
707
|
-
|
705
|
+
describe( 'Delete menu button', () => {
|
706
|
+
useExperimentalFeatures( [ '#gutenberg-navigation' ] );
|
708
707
|
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
afterEach( async () => {
|
715
|
-
await deleteAllMenus();
|
716
|
-
await deleteAllLinkedResources();
|
717
|
-
} );
|
708
|
+
beforeAll( async () => {
|
709
|
+
await deleteAllMenus();
|
710
|
+
await deleteAllLinkedResources();
|
711
|
+
} );
|
718
712
|
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
`should retain menu when confirmation is canceled and the viewport is %s`,
|
724
|
-
async ( viewport ) => {
|
725
|
-
const menuName = 'Menu delete test';
|
726
|
-
await createMenu( { name: menuName }, menuItemsFixture );
|
727
|
-
await visitNavigationEditor();
|
728
|
-
await setBrowserViewport( viewport );
|
729
|
-
// Wait for the header to show the menu name.
|
730
|
-
await page.waitForXPath(
|
731
|
-
`//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
|
732
|
-
);
|
713
|
+
afterEach( async () => {
|
714
|
+
await deleteAllMenus();
|
715
|
+
await deleteAllLinkedResources();
|
716
|
+
} );
|
733
717
|
|
734
|
-
|
735
|
-
|
736
|
-
|
718
|
+
afterEach( async () => {
|
719
|
+
await setBrowserViewport( 'large' );
|
720
|
+
} );
|
721
|
+
it.each( [ 'large', 'small' ] )(
|
722
|
+
`should retain menu when confirmation is canceled and the viewport is %s`,
|
723
|
+
async ( viewport ) => {
|
724
|
+
const menuName = 'Menu delete test';
|
725
|
+
await createMenu( { name: menuName }, menuItemsFixture );
|
726
|
+
await visitNavigationEditor();
|
727
|
+
await setBrowserViewport( viewport );
|
728
|
+
// Wait for the header to show the menu name.
|
729
|
+
await page.waitForXPath(
|
730
|
+
`//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
|
737
731
|
);
|
738
|
-
await openSettingsSidebar.click();
|
739
|
-
}
|
740
732
|
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
733
|
+
if ( viewport === 'small' ) {
|
734
|
+
const openSettingsSidebar = await page.waitForXPath(
|
735
|
+
'//button[@aria-label="Settings"][@aria-expanded="false"]'
|
736
|
+
);
|
737
|
+
await openSettingsSidebar.click();
|
738
|
+
}
|
745
739
|
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
740
|
+
const deleteMenuButton = await page.waitForXPath(
|
741
|
+
'//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
|
742
|
+
);
|
743
|
+
await deleteMenuButton.click();
|
750
744
|
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
( el ) => el.textContent,
|
756
|
-
menuActionsDropdown
|
757
|
-
);
|
745
|
+
const cancelButton = await page.waitForXPath(
|
746
|
+
'//*[@role="dialog"]//button[text()="Cancel"]'
|
747
|
+
);
|
748
|
+
await cancelButton.click();
|
758
749
|
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
const menuName = 'Menu delete test';
|
766
|
-
await createMenu( { name: menuName }, menuItemsFixture );
|
767
|
-
await visitNavigationEditor();
|
768
|
-
await setBrowserViewport( viewport );
|
769
|
-
// Wait for the header to show the menu name.
|
770
|
-
await page.waitForXPath(
|
771
|
-
`//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
|
772
|
-
);
|
773
|
-
if ( viewport === 'small' ) {
|
774
|
-
const openSettingsSidebar = await page.waitForXPath(
|
775
|
-
'//button[@aria-label="Settings"][@aria-expanded="false"]'
|
750
|
+
const menuActionsDropdown = await page.waitForXPath(
|
751
|
+
`//*[contains(@class,"edit-navigation-menu-actions")]//h2[text()="${ menuName }"]`
|
752
|
+
);
|
753
|
+
const currentSelectedMenu = await page.evaluate(
|
754
|
+
( el ) => el.textContent,
|
755
|
+
menuActionsDropdown
|
776
756
|
);
|
777
|
-
|
757
|
+
|
758
|
+
expect( currentSelectedMenu ).toBe( menuName );
|
778
759
|
}
|
760
|
+
);
|
761
|
+
it.each( [ 'large', 'small' ] )(
|
762
|
+
`should delete menu when confirmation is confirmed and there are no other menus and the viewport is %s`,
|
763
|
+
async ( viewport ) => {
|
764
|
+
const menuName = 'Menu delete test';
|
765
|
+
await createMenu( { name: menuName }, menuItemsFixture );
|
766
|
+
await visitNavigationEditor();
|
767
|
+
await setBrowserViewport( viewport );
|
768
|
+
// Wait for the header to show the menu name.
|
769
|
+
await page.waitForXPath(
|
770
|
+
`//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
|
771
|
+
);
|
772
|
+
if ( viewport === 'small' ) {
|
773
|
+
const openSettingsSidebar = await page.waitForXPath(
|
774
|
+
'//button[@aria-label="Settings"][@aria-expanded="false"]'
|
775
|
+
);
|
776
|
+
await openSettingsSidebar.click();
|
777
|
+
}
|
779
778
|
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
779
|
+
const deleteMenuButton = await page.waitForXPath(
|
780
|
+
'//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
|
781
|
+
);
|
782
|
+
await deleteMenuButton.click();
|
784
783
|
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
784
|
+
const confirmButton = await page.waitForXPath(
|
785
|
+
'//*[@role="dialog"]//button[text()="OK"]'
|
786
|
+
);
|
787
|
+
await confirmButton.click();
|
789
788
|
|
790
|
-
|
791
|
-
|
792
|
-
|
789
|
+
await page.waitForXPath(
|
790
|
+
`//*[@role="button"][@aria-label="Dismiss this notice"]//*[text()='"${ menuName }" menu has been deleted']`
|
791
|
+
);
|
793
792
|
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
793
|
+
// If the "Create your first menu" prompt appears, we know there are no remaining menus,
|
794
|
+
// so our test menu must have been deleted successfully.
|
795
|
+
const createFirstMenuPrompt = await page.waitForXPath(
|
796
|
+
'//h3[.="Create your first menu"]',
|
797
|
+
{
|
798
|
+
visible: true,
|
799
|
+
}
|
800
|
+
);
|
801
|
+
const noMenusRemaining = createFirstMenuPrompt ? true : false;
|
802
|
+
expect( noMenusRemaining ).toBe( true );
|
803
|
+
}
|
804
|
+
);
|
806
805
|
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
806
|
+
it.each( [ 'large', 'small' ] )(
|
807
|
+
`should delete menu when confirmation is confirmed and there are other existing menus and the viewport is %s`,
|
808
|
+
async () => {
|
809
|
+
const menuName = 'Menu delete test';
|
810
|
+
await createMenu( { name: menuName }, menuItemsFixture );
|
811
|
+
await createMenu(
|
812
|
+
{ name: `${ menuName } 2` },
|
813
|
+
menuItemsFixture
|
814
|
+
);
|
815
|
+
await visitNavigationEditor();
|
816
|
+
// Wait for the header to show the menu name
|
817
|
+
await page.waitForXPath(
|
818
|
+
`//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
|
819
|
+
);
|
818
820
|
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
821
|
+
// Confirm both test menus are present
|
822
|
+
openMenuActionsDropdown();
|
823
|
+
const firstTestMenuItem = await getMenuItem( menuName );
|
824
|
+
const secondTestMenuItem = await getMenuItem(
|
825
|
+
`${ menuName } 2`
|
826
|
+
);
|
823
827
|
|
824
|
-
|
825
|
-
|
828
|
+
expect( firstTestMenuItem ).not.toBeNull();
|
829
|
+
expect( secondTestMenuItem ).not.toBeNull();
|
826
830
|
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
831
|
+
// Delete the first test menu
|
832
|
+
const deleteMenuButton = await page.waitForXPath(
|
833
|
+
'//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
|
834
|
+
);
|
835
|
+
await deleteMenuButton.click();
|
832
836
|
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
+
const confirmButton = await page.waitForXPath(
|
838
|
+
'//*[@role="dialog"]//button[text()="OK"]'
|
839
|
+
);
|
840
|
+
await confirmButton.click();
|
837
841
|
|
838
|
-
|
839
|
-
|
840
|
-
|
842
|
+
await page.waitForXPath(
|
843
|
+
`//*[@role="button"][@aria-label="Dismiss this notice"]//*[text()='"${ menuName }" menu has been deleted']`
|
844
|
+
);
|
841
845
|
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
846
|
+
openMenuActionsDropdown();
|
847
|
+
const deletedTestMenuItem = await getMenuItem( menuName );
|
848
|
+
expect( deletedTestMenuItem ).toBeNull();
|
849
|
+
}
|
850
|
+
);
|
851
|
+
} );
|
847
852
|
} );
|
@@ -86,12 +86,10 @@ describe( 'Post Editor Performance', () => {
|
|
86
86
|
beforeEach( async () => {
|
87
87
|
// Disable auto-save to avoid impacting the metrics.
|
88
88
|
await page.evaluate( () => {
|
89
|
-
window.wp.data
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
.dispatch( 'core/editor' )
|
94
|
-
.updateEditorSettings( { autosaveInterval: 100000000000 } );
|
89
|
+
window.wp.data.dispatch( 'core/editor' ).updateEditorSettings( {
|
90
|
+
autosaveInterval: 100000000000,
|
91
|
+
localAutosaveInterval: 100000000000,
|
92
|
+
} );
|
95
93
|
} );
|
96
94
|
} );
|
97
95
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
* WordPress dependencies
|
3
|
+
*/
|
4
|
+
import {
|
5
|
+
deleteAllTemplates,
|
6
|
+
activateTheme,
|
7
|
+
visitSiteEditor,
|
8
|
+
toggleGlobalStyles,
|
9
|
+
openGlobalStylesPanel,
|
10
|
+
} from '@wordpress/e2e-test-utils';
|
11
|
+
|
12
|
+
describe( 'Global styles sidebar', () => {
|
13
|
+
beforeAll( async () => {
|
14
|
+
await activateTheme( 'emptytheme' );
|
15
|
+
await Promise.all( [
|
16
|
+
deleteAllTemplates( 'wp_template' ),
|
17
|
+
deleteAllTemplates( 'wp_template_part' ),
|
18
|
+
] );
|
19
|
+
} );
|
20
|
+
afterAll( async () => {
|
21
|
+
await Promise.all( [
|
22
|
+
deleteAllTemplates( 'wp_template' ),
|
23
|
+
deleteAllTemplates( 'wp_template_part' ),
|
24
|
+
] );
|
25
|
+
await activateTheme( 'twentytwentyone' );
|
26
|
+
} );
|
27
|
+
beforeEach( async () => {
|
28
|
+
await visitSiteEditor();
|
29
|
+
} );
|
30
|
+
describe( 'blocks list', () => {
|
31
|
+
it( 'should filter results properly', async () => {
|
32
|
+
await toggleGlobalStyles();
|
33
|
+
await openGlobalStylesPanel( 'Blocks' );
|
34
|
+
await page.focus( '.edit-site-block-types-search input' );
|
35
|
+
await page.keyboard.type( 'heading' );
|
36
|
+
const results = await page.$$(
|
37
|
+
'.edit-site-block-types-item-list div[role="listitem"]'
|
38
|
+
);
|
39
|
+
expect( results.length ).toEqual( 1 );
|
40
|
+
} );
|
41
|
+
} );
|
42
|
+
} );
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/**
|
2
|
+
* WordPress dependencies
|
3
|
+
*/
|
4
|
+
import { activateTheme, visitSiteEditor } from '@wordpress/e2e-test-utils';
|
5
|
+
|
6
|
+
describe( 'Site editor iframe rendering mode', () => {
|
7
|
+
beforeAll( async () => {
|
8
|
+
await activateTheme( 'emptytheme' );
|
9
|
+
} );
|
10
|
+
|
11
|
+
afterAll( async () => {
|
12
|
+
await activateTheme( 'twentytwentyone' );
|
13
|
+
} );
|
14
|
+
|
15
|
+
it( 'Should render editor in standards mode.', async () => {
|
16
|
+
await visitSiteEditor( {
|
17
|
+
postId: 'emptytheme//index',
|
18
|
+
postType: 'wp_template',
|
19
|
+
} );
|
20
|
+
|
21
|
+
const compatMode = await page.evaluate(
|
22
|
+
() =>
|
23
|
+
document.querySelector( `iframe[name='editor-canvas']` )
|
24
|
+
.contentDocument.compatMode
|
25
|
+
);
|
26
|
+
|
27
|
+
// CSS1Compat = expected standards mode.
|
28
|
+
// BackCompat = quirks mode.
|
29
|
+
expect( compatMode ).toBe( 'CSS1Compat' );
|
30
|
+
} );
|
31
|
+
} );
|
@@ -43,7 +43,7 @@ describe( 'Site Editor Templates Export', () => {
|
|
43
43
|
await visitSiteEditor();
|
44
44
|
} );
|
45
45
|
|
46
|
-
it( 'clicking export should download
|
46
|
+
it( 'clicking export should download emptytheme.zip file', async () => {
|
47
47
|
const directory = fs.mkdtempSync(
|
48
48
|
path.join( os.tmpdir(), 'test-edit-site-export-' )
|
49
49
|
);
|
@@ -53,7 +53,7 @@ describe( 'Site Editor Templates Export', () => {
|
|
53
53
|
} );
|
54
54
|
|
55
55
|
await clickOnMoreMenuItem( 'Export', 'site-editor' );
|
56
|
-
const filePath = path.join( directory, '
|
56
|
+
const filePath = path.join( directory, 'emptytheme.zip' );
|
57
57
|
await waitForFileExists( filePath );
|
58
58
|
expect( fs.existsSync( filePath ) ).toBe( true );
|
59
59
|
fs.unlinkSync( filePath );
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
} from '@wordpress/e2e-test-utils';
|
12
12
|
|
13
13
|
async function openOtherStyles() {
|
14
|
-
const OTHER_STYLES_SELECTOR = '//div[contains(text(),"
|
14
|
+
const OTHER_STYLES_SELECTOR = '//div[contains(text(),"Browse styles")]';
|
15
15
|
await ( await page.waitForXPath( OTHER_STYLES_SELECTOR ) ).click();
|
16
16
|
}
|
17
17
|
|
@@ -22,19 +22,21 @@ async function getAvailableStyleVariations() {
|
|
22
22
|
return page.$$( VARIATION_ITEMS_STYLES_SELECTOR );
|
23
23
|
}
|
24
24
|
|
25
|
-
async function applyVariation(
|
25
|
+
async function applyVariation( label ) {
|
26
26
|
await toggleGlobalStyles();
|
27
27
|
await openOtherStyles();
|
28
|
-
const
|
29
|
-
|
28
|
+
const variation = await page.waitForXPath(
|
29
|
+
`//*[@role="button"][@aria-label="${ label }"]`
|
30
|
+
);
|
31
|
+
await variation.click();
|
30
32
|
}
|
31
33
|
|
32
34
|
async function applyPinkVariation() {
|
33
|
-
await applyVariation(
|
35
|
+
await applyVariation( 'pink' );
|
34
36
|
}
|
35
37
|
|
36
38
|
async function applyYellowVariation() {
|
37
|
-
await applyVariation(
|
39
|
+
await applyVariation( 'yellow' );
|
38
40
|
}
|
39
41
|
|
40
42
|
async function openColorsPanel() {
|
@@ -71,7 +73,7 @@ async function getCustomFontSizeValue() {
|
|
71
73
|
async function getColorValue( colorType ) {
|
72
74
|
return page.evaluate( ( _colorType ) => {
|
73
75
|
return document.evaluate(
|
74
|
-
`substring-before(substring-after(//div[@
|
76
|
+
`substring-before(substring-after(//div[contains(@class, "edit-site-global-styles-sidebar__panel")]//button[.//*[text()="${ _colorType }"]]//*[contains(@class,"component-color-indicator")]/@style, "background: "), ";")`,
|
75
77
|
document,
|
76
78
|
null,
|
77
79
|
XPathResult.ANY_TYPE,
|
@@ -21,9 +21,11 @@ describe( 'Template Part', () => {
|
|
21
21
|
await deleteAllTemplates( 'wp_template' );
|
22
22
|
await deleteAllTemplates( 'wp_template_part' );
|
23
23
|
} );
|
24
|
-
|
24
|
+
afterEach( async () => {
|
25
25
|
await deleteAllTemplates( 'wp_template' );
|
26
26
|
await deleteAllTemplates( 'wp_template_part' );
|
27
|
+
} );
|
28
|
+
afterAll( async () => {
|
27
29
|
await activateTheme( 'twentytwentyone' );
|
28
30
|
} );
|
29
31
|
|