Skip to content

Commit 9bc2005

Browse files
authored
Fix more e2e test issues (#4592)
* Use more specific selector on product page * Changelog * Use button names for handleCheckout3DSChallenge(); use helper in SCA card test * Ensure we select the color for the variable product * Changelog
1 parent abe8e05 commit 9bc2005

File tree

5 files changed

+12
-23
lines changed

5 files changed

+12
-23
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Tweak - Use more specific selector in express checkout e2e tests
1111
* Fix - Relax customer validation that was preventing payments from the pay for order page
1212
* Fix - Remove connection type requirement from PMC sync migration attempt
13+
* Tweak - Small improvements to e2e tests
1314

1415
= 9.8.0 - 2025-08-11 =
1516
* Add - Adds the current setting value for the Optimized Checkout to the Stripe System Status Report data

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
120120
* Tweak - Use more specific selector in express checkout e2e tests
121121
* Fix - Relax customer validation that was preventing payments from the pay for order page
122122
* Fix - Remove connection type requirement from PMC sync migration attempt
123+
* Tweak - Small improvements to e2e tests
123124

124125
[See changelog for full details across versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

tests/e2e/tests/checkout/blocks/sca-card.spec.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const {
77
setupCart,
88
setupBlocksCheckout,
99
fillCreditCardDetails,
10+
handleCheckout3DSChallenge,
1011
} = payments;
1112

1213
test( 'customer can checkout with a SCA card @smoke @blocks', async ( {
@@ -21,23 +22,7 @@ test( 'customer can checkout with a SCA card @smoke @blocks', async ( {
2122
await fillCreditCardDetails( page, config.get( 'cards.3ds' ) );
2223
await page.locator( 'text=Place order' ).click();
2324

24-
// Wait until the SCA frame is available
25-
while (
26-
! page.frame( {
27-
name: 'stripe-challenge-frame',
28-
} )
29-
) {
30-
await page.waitForTimeout( 1000 );
31-
}
32-
// Not ideal, but the iframe body gets repalced after load, so a waitFor does not work here.
33-
await page.waitForTimeout( 2000 );
34-
35-
await page
36-
.frame( {
37-
name: 'stripe-challenge-frame',
38-
} )
39-
.getByRole( 'button', { name: 'Complete' } )
40-
.click();
25+
await handleCheckout3DSChallenge( page );
4126

4227
await page.waitForURL( '**/checkout/order-received/**' );
4328

tests/e2e/tests/express-checkout/express-checkout.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ test.describe( 'express checkout and variable products', () => {
102102
page,
103103
} ) => {
104104
await page.goto( '/product/hoodie' );
105+
await page
106+
.getByLabel( 'color', { exact: true } )
107+
.selectOption( 'Blue' );
105108
await page.getByLabel( 'Logo', { exact: true } ).selectOption( 'Yes' );
106109
const linkButton = await getLinkButton( page );
107110
await expect( linkButton ).toBeVisible();

tests/e2e/utils/payments.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,11 @@ export async function handleCheckout3DSChallenge( page, action = 'authorize' ) {
677677
outerFrameLocator.locator( '.LightboxModalLoadingIndicator' )
678678
).toBeHidden();
679679

680-
const buttonId =
681-
action === 'authorize'
682-
? '#test-source-authorize-3ds'
683-
: '#test-source-fail-3ds';
684-
await expect( innerFrameLocator.locator( buttonId ) ).toBeVisible();
685-
await innerFrameLocator.locator( buttonId ).click();
680+
const buttonName = action === 'authorize' ? 'Complete' : 'Fail';
681+
await expect(
682+
innerFrameLocator.getByRole( 'button', { name: buttonName } )
683+
).toBeVisible();
684+
await innerFrameLocator.getByRole( 'button', { name: buttonName } ).click();
686685

687686
if ( action === 'fail' ) {
688687
await expect( innerFrameLocator.owner() ).toBeHidden();

0 commit comments

Comments
 (0)