Skip to content

Commit c3a7f1b

Browse files
authored
Convert the Payment Settings Manual Capture spec to Playwright (#10118)
1 parent ec18d58 commit c3a7f1b

File tree

3 files changed

+62
-66
lines changed

3 files changed

+62
-66
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Significance: patch
2+
Type: dev
3+
Comment: Converted a puppeteer spec to playwright
4+
5+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import { test, expect } from '@playwright/test';
5+
/**
6+
* Internal dependencies
7+
*/
8+
import { useMerchant } from '../../utils/helpers';
9+
import { goToWooPaymentsSettings } from '../../utils/merchant-navigation';
10+
11+
test.describe(
12+
'As a merchant, I should be prompted a confirmation modal when I try to activate the manual capture',
13+
() => {
14+
useMerchant();
15+
16+
test.beforeEach( async ( { page } ) => {
17+
await goToWooPaymentsSettings( page );
18+
await page.getByTestId( 'capture-later-checkbox' ).click();
19+
} );
20+
21+
test( 'should show the confirmation dialog when enabling the manual capture', async ( {
22+
page,
23+
} ) => {
24+
await expect(
25+
page.getByText(
26+
'Payments must be captured within 7 days or the authorization will expire and money will be returned to the shopper'
27+
)
28+
).toBeVisible( {
29+
timeout: 10000,
30+
} );
31+
} );
32+
33+
test( 'should not show the confirmation dialog when disabling the manual capture', async ( {
34+
page,
35+
} ) => {
36+
await page
37+
.getByRole( 'button', { name: 'Enable manual capture' } )
38+
.click();
39+
await page.getByTestId( 'capture-later-checkbox' ).click();
40+
await expect( page.locator( '.wcpay-modal' ) ).not.toBeVisible();
41+
} );
42+
43+
test( 'should show the non-card methods disabled when manual capture is enabled', async ( {
44+
page,
45+
} ) => {
46+
await page
47+
.getByRole( 'button', { name: 'Enable manual capture' } )
48+
.click();
49+
const paymentMethodWarningIconElement = await page
50+
.getByTestId( 'loadable-checkbox-icon-warning' )
51+
.first();
52+
await expect( paymentMethodWarningIconElement ).toHaveText(
53+
/cannot be enabled at checkout/
54+
);
55+
} );
56+
}
57+
);

tests/e2e/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)