@wordpress/e2e-tests 3.1.1 → 4.0.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -0
  3. package/config/flaky-tests-reporter.js +1 -0
  4. package/package.json +8 -6
  5. package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +8 -0
  6. package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +2 -2
  7. package/specs/editor/blocks/__snapshots__/separator.test.js.snap +1 -1
  8. package/specs/editor/blocks/buttons.test.js +10 -0
  9. package/specs/editor/blocks/columns.test.js +3 -3
  10. package/specs/editor/blocks/gallery.test.js +36 -6
  11. package/specs/editor/blocks/heading.test.js +1 -1
  12. package/specs/editor/blocks/navigation.test.js +370 -72
  13. package/specs/editor/plugins/annotations.test.js +63 -67
  14. package/specs/editor/various/__snapshots__/block-deletion.test.js.snap +20 -12
  15. package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +26 -0
  16. package/specs/editor/various/__snapshots__/block-hierarchy-navigation.test.js.snap +1 -1
  17. package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +122 -6
  18. package/specs/editor/various/__snapshots__/writing-flow.test.js.snap +6 -6
  19. package/specs/editor/various/autosave.test.js +3 -3
  20. package/specs/editor/various/block-deletion.test.js +1 -0
  21. package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +3 -5
  22. package/specs/editor/various/block-hierarchy-navigation.test.js +10 -16
  23. package/specs/editor/various/block-locking.test.js +120 -0
  24. package/specs/editor/various/keyboard-navigable-blocks.test.js +23 -0
  25. package/specs/editor/various/list-view.test.js +139 -7
  26. package/specs/editor/various/multi-block-selection.test.js +153 -9
  27. package/specs/editor/various/post-editor-template-mode.test.js +1 -1
  28. package/specs/editor/various/toolbar-roving-tabindex.test.js +10 -4
  29. package/specs/editor/various/writing-flow.test.js +10 -5
  30. package/specs/experiments/blocks/comments-query.test.js +131 -0
  31. package/specs/experiments/navigation-editor.test.js +126 -121
  32. package/specs/performance/post-editor.test.js +4 -6
  33. package/specs/site-editor/iframe-rendering-mode.test.js +31 -0
  34. package/specs/site-editor/site-editor-export.test.js +2 -2
  35. package/specs/site-editor/style-variations.test.js +9 -7
  36. package/specs/site-editor/template-part.test.js +3 -1
  37. package/specs/editor/various/__snapshots__/copy-cut-paste-whole-blocks.test.js.snap +0 -125
  38. package/specs/editor/various/copy-cut-paste-whole-blocks.test.js +0 -187
  39. package/specs/editor/various/new-post.test.js +0 -99
  40. 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
- useExperimentalFeatures( [ '#gutenberg-navigation' ] );
705
+ describe( 'Delete menu button', () => {
706
+ useExperimentalFeatures( [ '#gutenberg-navigation' ] );
708
707
 
709
- beforeAll( async () => {
710
- await deleteAllMenus();
711
- await deleteAllLinkedResources();
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
- afterEach( async () => {
720
- await setBrowserViewport( 'large' );
721
- } );
722
- it.each( [ 'large', 'small' ] )(
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
- if ( viewport === 'small' ) {
735
- const openSettingsSidebar = await page.waitForXPath(
736
- '//button[@aria-label="Settings"][@aria-expanded="false"]'
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
- const deleteMenuButton = await page.waitForXPath(
742
- '//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
743
- );
744
- await deleteMenuButton.click();
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
- const cancelButton = await page.waitForXPath(
747
- '//*[@role="dialog"]//button[text()="Cancel"]'
748
- );
749
- await cancelButton.click();
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
- const menuActionsDropdown = await page.waitForXPath(
752
- `//*[contains(@class,"edit-navigation-menu-actions")]//h2[text()="${ menuName }"]`
753
- );
754
- const currentSelectedMenu = await page.evaluate(
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
- expect( currentSelectedMenu ).toBe( menuName );
760
- }
761
- );
762
- it.each( [ 'large', 'small' ] )(
763
- `should delete menu when confirmation is confirmed and there are no other menus and the viewport is %s`,
764
- async ( viewport ) => {
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
- await openSettingsSidebar.click();
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
- const deleteMenuButton = await page.waitForXPath(
781
- '//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
782
- );
783
- await deleteMenuButton.click();
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
- const confirmButton = await page.waitForXPath(
786
- '//*[@role="dialog"]//button[text()="OK"]'
787
- );
788
- await confirmButton.click();
784
+ const confirmButton = await page.waitForXPath(
785
+ '//*[@role="dialog"]//button[text()="OK"]'
786
+ );
787
+ await confirmButton.click();
789
788
 
790
- await page.waitForXPath(
791
- `//*[@role="button"][@aria-label="Dismiss this notice"]//*[text()='"${ menuName }" menu has been deleted']`
792
- );
789
+ await page.waitForXPath(
790
+ `//*[@role="button"][@aria-label="Dismiss this notice"]//*[text()='"${ menuName }" menu has been deleted']`
791
+ );
793
792
 
794
- // If the "Create your first menu" prompt appears, we know there are no remaining menus,
795
- // so our test menu must have been deleted successfully.
796
- const createFirstMenuPrompt = await page.waitForXPath(
797
- '//h3[.="Create your first menu"]',
798
- {
799
- visible: true,
800
- }
801
- );
802
- const noMenusRemaining = createFirstMenuPrompt ? true : false;
803
- expect( noMenusRemaining ).toBe( true );
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
- it.each( [ 'large', 'small' ] )(
808
- `should delete menu when confirmation is confirmed and there are other existing menus and the viewport is %s`,
809
- async () => {
810
- const menuName = 'Menu delete test';
811
- await createMenu( { name: menuName }, menuItemsFixture );
812
- await createMenu( { name: `${ menuName } 2` }, menuItemsFixture );
813
- await visitNavigationEditor();
814
- // Wait for the header to show the menu name
815
- await page.waitForXPath(
816
- `//*[@role="region"][@aria-label="Navigation top bar"]//h2[contains(text(), "${ menuName }")]`
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
- // Confirm both test menus are present
820
- openMenuActionsDropdown();
821
- const firstTestMenuItem = await getMenuItem( menuName );
822
- const secondTestMenuItem = await getMenuItem( `${ menuName } 2` );
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
- expect( firstTestMenuItem ).not.toBeNull();
825
- expect( secondTestMenuItem ).not.toBeNull();
828
+ expect( firstTestMenuItem ).not.toBeNull();
829
+ expect( secondTestMenuItem ).not.toBeNull();
826
830
 
827
- // Delete the first test menu
828
- const deleteMenuButton = await page.waitForXPath(
829
- '//*[@role="region"][@aria-label="Navigation settings"]//button[text()="Delete menu"]'
830
- );
831
- await deleteMenuButton.click();
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
- const confirmButton = await page.waitForXPath(
834
- '//*[@role="dialog"]//button[text()="OK"]'
835
- );
836
- await confirmButton.click();
837
+ const confirmButton = await page.waitForXPath(
838
+ '//*[@role="dialog"]//button[text()="OK"]'
839
+ );
840
+ await confirmButton.click();
837
841
 
838
- await page.waitForXPath(
839
- `//*[@role="button"][@aria-label="Dismiss this notice"]//*[text()='"${ menuName }" menu has been deleted']`
840
- );
842
+ await page.waitForXPath(
843
+ `//*[@role="button"][@aria-label="Dismiss this notice"]//*[text()='"${ menuName }" menu has been deleted']`
844
+ );
841
845
 
842
- openMenuActionsDropdown();
843
- const deletedTestMenuItem = await getMenuItem( menuName );
844
- expect( deletedTestMenuItem ).toBeNull();
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
- .dispatch( 'core/edit-post' )
91
- .__experimentalUpdateLocalAutosaveInterval( 100000000000 );
92
- window.wp.data
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,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 edit-site-export.zip file', async () => {
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, 'edit-site-export.zip' );
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(),"Other styles")]';
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( number ) {
25
+ async function applyVariation( label ) {
26
26
  await toggleGlobalStyles();
27
27
  await openOtherStyles();
28
- const variations = await getAvailableStyleVariations();
29
- await variations[ number ].click();
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( 1 );
35
+ await applyVariation( 'pink' );
34
36
  }
35
37
 
36
38
  async function applyYellowVariation() {
37
- await applyVariation( 2 );
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[@aria-label="Settings"]//button[.//*[text()="${ _colorType }"]]//*[contains(@class,"component-color-indicator")]/@style, "background: "), ";")`,
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
- afterAll( async () => {
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
 
@@ -1,125 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Copy/cut/paste of whole blocks can copy group onto non textual element (image, spacer) 1`] = `""`;
4
-
5
- exports[`Copy/cut/paste of whole blocks can copy group onto non textual element (image, spacer) 2`] = `
6
- "<!-- wp:paragraph -->
7
- <p></p>
8
- <!-- /wp:paragraph -->
9
-
10
- <!-- wp:group -->
11
- <div class=\\"wp-block-group\\"><!-- wp:paragraph -->
12
- <p>P</p>
13
- <!-- /wp:paragraph --></div>
14
- <!-- /wp:group -->"
15
- `;
16
-
17
- exports[`Copy/cut/paste of whole blocks should copy and paste individual blocks 1`] = `
18
- "<!-- wp:paragraph -->
19
- <p>Here is a unique string so we can test copying.</p>
20
- <!-- /wp:paragraph -->
21
-
22
- <!-- wp:paragraph -->
23
- <p>2</p>
24
- <!-- /wp:paragraph -->"
25
- `;
26
-
27
- exports[`Copy/cut/paste of whole blocks should copy and paste individual blocks 2`] = `
28
- "<!-- wp:paragraph -->
29
- <p>Here is a unique string so we can test copying.</p>
30
- <!-- /wp:paragraph -->
31
-
32
- <!-- wp:paragraph -->
33
- <p>2</p>
34
- <!-- /wp:paragraph -->
35
-
36
- <!-- wp:paragraph -->
37
- <p>Here is a unique string so we can test copying.</p>
38
- <!-- /wp:paragraph -->"
39
- `;
40
-
41
- exports[`Copy/cut/paste of whole blocks should copy blocks when non textual elements are focused (image, spacer) 1`] = `
42
- "<!-- wp:spacer -->
43
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
44
- <!-- /wp:spacer -->"
45
- `;
46
-
47
- exports[`Copy/cut/paste of whole blocks should copy blocks when non textual elements are focused (image, spacer) 2`] = `
48
- "<!-- wp:spacer -->
49
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
50
- <!-- /wp:spacer -->
51
-
52
- <!-- wp:spacer -->
53
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
54
- <!-- /wp:spacer -->"
55
- `;
56
-
57
- exports[`Copy/cut/paste of whole blocks should cut and paste individual blocks 1`] = `
58
- "<!-- wp:paragraph -->
59
- <p>2</p>
60
- <!-- /wp:paragraph -->"
61
- `;
62
-
63
- exports[`Copy/cut/paste of whole blocks should cut and paste individual blocks 2`] = `
64
- "<!-- wp:paragraph -->
65
- <p>2</p>
66
- <!-- /wp:paragraph -->
67
-
68
- <!-- wp:paragraph -->
69
- <p>Yet another unique string.</p>
70
- <!-- /wp:paragraph -->"
71
- `;
72
-
73
- exports[`Copy/cut/paste of whole blocks should handle paste events once 1`] = `""`;
74
-
75
- exports[`Copy/cut/paste of whole blocks should handle paste events once 2`] = `
76
- "<!-- wp:paragraph -->
77
- <p></p>
78
- <!-- /wp:paragraph -->
79
-
80
- <!-- wp:group -->
81
- <div class=\\"wp-block-group\\"><!-- wp:paragraph -->
82
- <p>P</p>
83
- <!-- /wp:paragraph --></div>
84
- <!-- /wp:group -->"
85
- `;
86
-
87
- exports[`Copy/cut/paste of whole blocks should respect inline copy in places like input fields and textareas 1`] = `
88
- "<!-- wp:shortcode -->
89
- [my-shortcode]
90
- <!-- /wp:shortcode -->"
91
- `;
92
-
93
- exports[`Copy/cut/paste of whole blocks should respect inline copy in places like input fields and textareas 2`] = `
94
- "<!-- wp:shortcode -->
95
- [my-shortcode]
96
- <!-- /wp:shortcode -->
97
-
98
- <!-- wp:paragraph -->
99
- <p>Pasted: e]</p>
100
- <!-- /wp:paragraph -->"
101
- `;
102
-
103
- exports[`Copy/cut/paste of whole blocks should respect inline copy when text is selected 1`] = `
104
- "<!-- wp:paragraph -->
105
- <p>First block</p>
106
- <!-- /wp:paragraph -->
107
-
108
- <!-- wp:paragraph -->
109
- <p>Second block</p>
110
- <!-- /wp:paragraph -->"
111
- `;
112
-
113
- exports[`Copy/cut/paste of whole blocks should respect inline copy when text is selected 2`] = `
114
- "<!-- wp:paragraph -->
115
- <p>First block</p>
116
- <!-- /wp:paragraph -->
117
-
118
- <!-- wp:paragraph -->
119
- <p>ck</p>
120
- <!-- /wp:paragraph -->
121
-
122
- <!-- wp:paragraph -->
123
- <p>Second block</p>
124
- <!-- /wp:paragraph -->"
125
- `;