-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert the Payment Settings Manual Capture spec to Playwright (#10118)
- Loading branch information
1 parent
ec18d58
commit c3a7f1b
Showing
3 changed files
with
62 additions
and
66 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
changelog/dev-9967-convert-merchant-payment-settings-manual-capture-spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
57 changes: 57 additions & 0 deletions
57
tests/e2e-pw/specs/merchant/merchant-payment-settings-manual-capture.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ | ||
); | ||
} ); | ||
} | ||
); |
66 changes: 0 additions & 66 deletions
66
tests/e2e/specs/wcpay/merchant/merchant-payment-settings-manual-capture.spec.js
This file was deleted.
Oops, something went wrong.