2019-08-27 12:22:24 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
const flows = require( './flows' );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Click a tab (on post type edit screen).
|
|
|
|
*
|
|
|
|
* @param {string} tabName Tab label.
|
|
|
|
*/
|
|
|
|
const clickTab = async ( tabName ) => {
|
|
|
|
await expect( page ).toClick( '.wc-tabs > li > a', { text: tabName } );
|
|
|
|
};
|
|
|
|
|
2019-08-30 11:03:57 +00:00
|
|
|
/**
|
|
|
|
* Save changes on a WooCommerce settings page.
|
|
|
|
*/
|
|
|
|
const settingsPageSaveChanges = async () => {
|
|
|
|
await page.focus( 'button.woocommerce-save-button' );
|
|
|
|
await Promise.all( [
|
|
|
|
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
|
|
|
|
page.click( 'button.woocommerce-save-button' ),
|
|
|
|
] );
|
|
|
|
};
|
|
|
|
|
2019-08-27 12:22:24 +00:00
|
|
|
/**
|
|
|
|
* Wait for UI blocking to end.
|
|
|
|
*/
|
|
|
|
const uiUnblocked = async () => {
|
|
|
|
await page.waitForFunction( () => ! Boolean( document.querySelector( '.blockUI' ) ) );
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
...flows,
|
|
|
|
clickTab,
|
2019-08-30 11:03:57 +00:00
|
|
|
settingsPageSaveChanges,
|
2019-08-27 12:22:24 +00:00
|
|
|
uiUnblocked,
|
|
|
|
};
|