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

6 lines
425 B
TypeScript

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 page.waitForXPath( panelSelector );
};