woocommerce-paypal-payments/tests/qa-legacy-ui/utils/frontend/order-received.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

47 lines
1 KiB
TypeScript

/**
* External dependencies
*/
import {
OrderReceived as OrderReceivedBase,
expect,
} from '@inpsyde/playwright-utils/build';
/**
* Internal dependencies
*/
import { PayPalUI } from './paypal-ui';
export class OrderReceived extends OrderReceivedBase {
ppui: PayPalUI;
constructor( { page, ppui } ) {
super( { page } );
this.ppui = ppui;
}
// Locators
seeOXXOVoucherButton_1 = () =>
this.page.getByRole( 'link', { name: 'See OXXO voucher' } ).first();
seeOXXOVoucherButton_2 = () =>
this.page.getByRole( 'link', { name: 'See OXXO voucher' } ).last();
// Actions
/**
* Asserts that
* - Order Received heading is visible
* - Expected payment method is displayed
* - Other optional payment details
*
* @param order
*/
assertOrderDetails = async ( order: WooCommerce.ShopOrder ) => {
await super.assertOrderDetails( order );
if ( order.payment.dataFundingSource === 'oxxo' ) {
await expect( this.seeOXXOVoucherButton_1() ).toBeVisible();
await expect( this.seeOXXOVoucherButton_2() ).toBeVisible();
}
};
// Assertions
}