Skip to content

Commit

Permalink
Merge branch 'develop' into update/deprecating-sofort-from-checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
gpressutto5 authored Jan 23, 2025
2 parents 3b255e1 + 5a68b21 commit bade6cc
Show file tree
Hide file tree
Showing 23 changed files with 809 additions and 889 deletions.
64 changes: 15 additions & 49 deletions assets/images/payment-methods/bancontact.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions assets/images/payment-methods/ideal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Convert shopper-multi-currency-widget spec from Puppeteer to Playwright
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Migrate shopper subscription free-trial purchase E2E test to Playwright
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Migrate shopper subscriptions - No signup fee E2E test to Playwright
5 changes: 5 additions & 0 deletions changelog/dev-9961-convert-merchant-orders-full-refund-spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Convert merchant-orders-full-refund spec from Puppeteer to Playwright


4 changes: 4 additions & 0 deletions changelog/dev-9963-e2e-convert-order-partial-refund-spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Convert merchant-orders-partial-refund spec from Puppeteer to Playwright.
4 changes: 4 additions & 0 deletions changelog/fix-pms-logos
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix incorrect payment method logos used on WooPayment Settings
119 changes: 119 additions & 0 deletions tests/e2e-pw/specs/merchant/merchant-orders-full-refund.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/**
* External dependencies
*/
import { test, expect, Page } from '@playwright/test';

/**
* Internal dependencies
*/
import { getMerchant, getShopper } from '../../utils/helpers';
import {
deactivateMulticurrency,
isMulticurrencyEnabled,
} from '../../utils/merchant';
import * as shopper from '../../utils/shopper';
import { goToOrder, goToPaymentDetails } from '../../utils/merchant-navigation';

test.describe( 'WooCommerce Payments - Full Refund', () => {
let merchantPage: Page;
let shopperPage: Page;
let orderId: string;
let orderAmount: string;

test.beforeAll( async ( { browser } ) => {
merchantPage = ( await getMerchant( browser ) ).merchantPage;
shopperPage = ( await getShopper( browser ) ).shopperPage;

// Disable multi-currency in the merchant settings. This step is important because local environment setups
// might have multi-currency enabled. We need to ensure a consistent environment for the test.
if ( await isMulticurrencyEnabled( merchantPage ) ) {
await deactivateMulticurrency( merchantPage );
}
} );

test( 'should process a full refund for an order', async () => {
// Place an order to refund later and get the order ID so we can open it in the merchant view
orderId = await shopper.placeOrderWithCurrency( shopperPage, 'USD' );

// Get the order total so we can verify the refund amount
orderAmount = await shopperPage
.locator(
'.woocommerce-order-overview__total .woocommerce-Price-amount'
)
.textContent();

// Open the order
await goToOrder( merchantPage, orderId );

// Click refund button
await merchantPage
.getByRole( 'button', {
name: 'Refund',
} )
.click();

// Fill refund details
await merchantPage.getByLabel( 'Refund amount' ).fill( orderAmount );
// await merchantPage.fill( '.refund_line_total', orderAmount );
await merchantPage
.getByLabel( 'Reason for refund' )
.fill( 'No longer wanted' );

const refundButton = await merchantPage.getByRole( 'button', {
name: `Refund ${ orderAmount } via WooPayments`,
} );

await expect( refundButton ).toBeVisible();

// TODO: This visual regression test is not flaky, but we should revisit the approach.
// await expect( merchantPage ).toHaveScreenshot();

// Click refund and handle confirmation dialog
merchantPage.on( 'dialog', ( dialog ) => dialog.accept() );
await refundButton.click();

// Wait for refund to process
await merchantPage.waitForLoadState( 'networkidle' );

// Verify refund details
await expect(
merchantPage.getByRole( 'cell', {
name: `-${ orderAmount }`,
} )
).toHaveCount( 2 );
await expect(
merchantPage.getByText(
`A refund of ${ orderAmount } was successfully processed using WooPayments. Reason: No longer wanted`
)
).toBeVisible();

// TODO: This visual regression test is not flaky, but we should revisit the approach.
// await expect( merchantPage ).toHaveScreenshot();
} );

test( 'should be able to view a refunded transaction', async () => {
// Get and navigate to payment details
const paymentIntentId = await merchantPage
.locator( '#order_data' )
.getByRole( 'link', {
name: /pi_/,
} )
.innerText();

await goToPaymentDetails( merchantPage, paymentIntentId );

// Verify timeline events
await expect(
merchantPage.getByText(
`A payment of ${ orderAmount } was successfully refunded.`
)
).toBeVisible();

await expect(
merchantPage.getByText( 'Payment status changed to Refunded.' )
).toBeVisible();

// TODO: This visual regression test is not flaky, but we should revisit the approach.
// await expect( merchantPage ).toHaveScreenshot();
} );
} );
Loading

0 comments on commit bade6cc

Please sign in to comment.