Skip to content

Commit

Permalink
Fix e2es
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Feb 7, 2022
1 parent 7e41e87 commit dae9fab
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
4 changes: 4 additions & 0 deletions packages/e2e-test-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ Navigates the site editor back

Goes back until it gets to the root

### openColorToolsPanelMenu

Opens the Color tools panel menu provided via block supports.

### openDocumentSettingsSidebar

Clicks on the button in the header which opens Document Settings sidebar when it is closed.
Expand Down
1 change: 1 addition & 0 deletions packages/e2e-test-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export {
} from './observe-focus-loss';
export { openDocumentSettingsSidebar } from './open-document-settings-sidebar';
export { openPublishPanel } from './open-publish-panel';
export { openColorToolsPanelMenu } from './open-color-tools-panel-menu';
export { openTypographyToolsPanelMenu } from './open-typography-tools-panel-menu';
export { trashAllPosts } from './posts';
export { pressKeyTimes } from './press-key-times';
Expand Down
9 changes: 9 additions & 0 deletions packages/e2e-test-utils/src/open-color-tools-panel-menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Opens the Color tools panel menu provided via block supports.
*/
export async function openColorToolsPanelMenu() {
const toggleSelector =
"//div[contains(@class, 'color-block-support-panel')]//button[contains(@class, 'components-dropdown-menu__toggle')]";
const toggle = await page.waitForXPath( toggleSelector );
return toggle.click();
}
10 changes: 2 additions & 8 deletions packages/e2e-tests/specs/editor/blocks/heading.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ import {
clickBlockAppender,
createNewPost,
getEditedPostContent,
openColorToolsPanelMenu,
pressKeyWithModifier,
} from '@wordpress/e2e-test-utils';

const openColorToolsPanelMenu = async () => {
const toggleSelector =
"//div[contains(@class, 'color-block-support-panel')]//button[contains(@class, 'components-dropdown-menu__toggle')]";
const toggle = await page.waitForXPath( toggleSelector );
return toggle.click();
};

describe( 'Heading', () => {
const COLOR_ITEM_SELECTOR =
'.block-editor-panel-color-gradient-settings__item';
'.block-editor-panel-color-gradient-settings__dropdown';
const CUSTOM_COLOR_BUTTON_X_SELECTOR = `.components-color-palette__custom-color`;
const CUSTOM_COLOR_DETAILS_BUTTON_SELECTOR =
'.components-color-picker button[aria-label="Show detailed inputs"]';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import {
clickBlockAppender,
createNewPost,
getEditedPostContent,
openColorToolsPanelMenu,
pressKeyWithModifier,
transformBlockTo,
getEditedPostContent,
} from '@wordpress/e2e-test-utils';

describe( 'Keep styles on block transforms', () => {
Expand All @@ -17,13 +18,11 @@ describe( 'Keep styles on block transforms', () => {
it( 'Should keep colors during a transform', async () => {
await clickBlockAppender();
await page.keyboard.type( '## Heading' );
const [ colorPanelToggle ] = await page.$x(
"//button[./span[contains(text(),'Color')]]"
);
await colorPanelToggle.click();
await openColorToolsPanelMenu();
await page.click( 'button[aria-label="Show Text"]' );

const textColorButton = await page.waitForSelector(
'.block-editor-panel-color-gradient-settings__item'
'.block-editor-panel-color-gradient-settings__dropdown'
);
await textColorButton.click();

Expand Down

0 comments on commit dae9fab

Please sign in to comment.