Skip to content

Commit

Permalink
Convert the Payment Settings Manual Capture spec to Playwright (#10118)
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaeldcom authored Jan 9, 2025
1 parent ec18d58 commit c3a7f1b
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Converted a puppeteer spec to playwright


Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* External dependencies
*/
import { test, expect } from '@playwright/test';
/**
* Internal dependencies
*/
import { useMerchant } from '../../utils/helpers';
import { goToWooPaymentsSettings } from '../../utils/merchant-navigation';

test.describe(
'As a merchant, I should be prompted a confirmation modal when I try to activate the manual capture',
() => {
useMerchant();

test.beforeEach( async ( { page } ) => {
await goToWooPaymentsSettings( page );
await page.getByTestId( 'capture-later-checkbox' ).click();
} );

test( 'should show the confirmation dialog when enabling the manual capture', async ( {
page,
} ) => {
await expect(
page.getByText(
'Payments must be captured within 7 days or the authorization will expire and money will be returned to the shopper'
)
).toBeVisible( {
timeout: 10000,
} );
} );

test( 'should not show the confirmation dialog when disabling the manual capture', async ( {
page,
} ) => {
await page
.getByRole( 'button', { name: 'Enable manual capture' } )
.click();
await page.getByTestId( 'capture-later-checkbox' ).click();
await expect( page.locator( '.wcpay-modal' ) ).not.toBeVisible();
} );

test( 'should show the non-card methods disabled when manual capture is enabled', async ( {
page,
} ) => {
await page
.getByRole( 'button', { name: 'Enable manual capture' } )
.click();
const paymentMethodWarningIconElement = await page
.getByTestId( 'loadable-checkbox-icon-warning' )
.first();
await expect( paymentMethodWarningIconElement ).toHaveText(
/cannot be enabled at checkout/
);
} );
}
);

This file was deleted.

0 comments on commit c3a7f1b

Please sign in to comment.