woocommerce-paypal-payments/tests/qa-legacy-ui/utils/admin/pay-later.ts
Misha Utkin 9f1445265d
Migrate tests for legacy UI
- Tests migration
- Tests correction
- Folder structure and file naming fixes
2025-04-30 06:48:12 +02:00

46 lines
975 B
TypeScript

/**
* Internal dependencies
*/
import { PcpSettingsPage } from './pcp-settings-page';
import urls from '../urls';
export class PayLater extends PcpSettingsPage {
url = urls.pcp.payLater;
// Locators
enableGatewayCheckbox = () =>
this.page.locator( '#ppcp-pay_later_button_enabled' );
enablePayLaterMessagingCheckbox = () =>
this.page.locator( '#ppcp-pay_later_messaging_enabled' );
cartPageInPayLaterButtonLocations = () =>
this.page
.locator(
'#field-pay_later_button_locations .select2-selection__choice[title="Cart"]'
)
.locator( '.select2-selection__choice__remove' );
// Actions
/**
* Bulk update of Pay Later tab settings
*
* @param data
*/
setup = async ( data? ) => {
if ( ! data ) {
return;
}
await this.visit();
if ( data.enableGateway !== undefined ) {
await this.enableGatewayCheckbox().setChecked( data.enableGateway );
}
// Add other settings here
await this.saveChanges();
};
// Assertions
}