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) #8342

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { merchant, shopper, uiUnblocked } = require( '@woocommerce/e2e-utils' );

const orderIdSelector = '.woocommerce-order-overview__order.order > strong';
const orderStatusDropdownSelector = 'select[name="order_status"]';
const cancelModalSelector = 'div.cancel-confirmation-modal';
const cancelModalSelector = 'div.wcpay-confirmation-modal';
const refundModalSelector = 'div.refund-confirmation-modal';
const refundCancelSelector =
'.refund-confirmation-modal .wcpay-confirmation-modal__footer .is-secondary';
Expand Down Expand Up @@ -99,6 +99,8 @@ describe( 'Order > Status Change', () => {
// Click on Cancel order.
await expect( page ).toClick( 'button', { text: 'Cancel order' } );

await page.waitForNavigation( { waitUntil: 'networkidle0' } );

// Verify the order status is set to cancel.
const selectedOrderStatus = await page.$(
selectedOrderStatusSelector
Expand Down
Loading