Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E: fix merchant-orders-full-refund missing order amount #8319

Merged
Merged
19 changes: 9 additions & 10 deletions tests/e2e/specs/wcpay/merchant/merchant-orders-full-refund.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,23 @@ describe( 'Order > Full refund', () => {
await expect( page ).toMatch( 'Order received' );

// Get the order ID so we can open it in the merchant view
const orderIdField = await page.$(
'.woocommerce-order-overview__order.order > strong'
);
const ORDER_RECEIVED_ID_SELECTOR =
'.woocommerce-order-overview__order.order > strong';
const orderIdField = await page.$( ORDER_RECEIVED_ID_SELECTOR );
orderId = await orderIdField.evaluate( ( el ) => el.innerText );

// Get the order total so we can verify the refund amount
const ORDER_RECEIVED_AMOUNT_SELECTOR =
'.woocommerce-order-overview__total .woocommerce-Price-amount';
const orderTotalField = await page.$( ORDER_RECEIVED_AMOUNT_SELECTOR );
orderAmount = await orderTotalField.evaluate( ( el ) => el.innerText );

// Login and open the order
await merchant.login();
await merchant.goToOrder( orderId );

// We need to remove any listeners on the `dialog` event otherwise we can't catch the dialog below
await page.removeAllListeners( 'dialog' );

// Get the order price
const priceElement = await page.$( '.woocommerce-Price-amount' );
orderAmount = await page.evaluate(
( el ) => el.textContent,
priceElement
);
} );

afterAll( async () => {
Expand Down
Loading