woocommerce/plugins/woocommerce-blocks/tests/utils/find-tools-panel-with-title.ts

11 lines
515 B
TypeScript

/**
* External dependencies
*/
import { canvas } from '@wordpress/e2e-test-utils';
export const findToolsPanelWithTitle = async ( panelTitle: string ) => {
const panelToggleSelector = `//div[contains(@class, "components-tools-panel-header")]//h2[contains(@class, "components-heading") and contains(text(),"${ panelTitle }")]`;
const panelSelector = `${ panelToggleSelector }/ancestor::*[contains(concat(" ", @class, " "), " components-tools-panel ")]`;
return await canvas().waitForXPath( panelSelector );
};