mirror of
https://gh.wpcy.net/https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2026-05-01 04:52:18 +08:00
39 lines
747 B
TypeScript
39 lines
747 B
TypeScript
/**
|
|
* External dependencies
|
|
*/
|
|
import {
|
|
Product as ProductBase,
|
|
expect,
|
|
} from '@inpsyde/playwright-utils/build';
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
import { PayPalUiClassic } from './paypal-ui-classic';
|
|
|
|
export class Product extends ProductBase {
|
|
payPalUi: PayPalUiClassic;
|
|
|
|
constructor( { page, payPalUi } ) {
|
|
super( { page } );
|
|
this.payPalUi = payPalUi;
|
|
}
|
|
|
|
// Locators
|
|
|
|
// Actions
|
|
|
|
addToCart = async ( productSlug: string ) => {
|
|
await this.visit( productSlug );
|
|
await this.addToCartButton().click();
|
|
};
|
|
|
|
makeOrder = async ( data: WooCommerce.ShopOrder ) => {
|
|
await this.visit( data.products[ 0 ].slug );
|
|
await this.payPalUi.makePayment( {
|
|
merchant: data.merchant,
|
|
payment: data.payment,
|
|
} );
|
|
};
|
|
|
|
// Assertions
|
|
}
|