Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix E2E shopper tests around 3DS and UPE settings #8123

Merged
merged 9 commits into from
Feb 5, 2024
4 changes: 4 additions & 0 deletions changelog/fix-e2e-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Fix for E2E shopper tests around 3DS and UPE settings
2 changes: 2 additions & 0 deletions tests/e2e/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"addressfirstline": "Rue de l’Étuve, 1000",
"addresssecondline": "billing-be",
"city": "Bruxelles",
"postcode": "1000",
"phone": "123456789",
"email": "[email protected]"
},
Expand All @@ -95,6 +96,7 @@
"addressfirstline": "Petuelring 130",
"addresssecondline": "billing-de",
"city": "München",
"postcode": "80809",
"state": "DE-BY",
"phone": "123456789",
"email": "[email protected]"
Expand Down
12 changes: 11 additions & 1 deletion tests/e2e/utils/flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,17 @@ export const merchantWCP = {
button.click()
);
}
await page.$eval( paymentMethod, ( method ) => method.click() );
// Check if paymentMethod is an XPath
if ( paymentMethod.startsWith( '//' ) ) {
// Find the element using XPath and click it
const elements = await page.$x( paymentMethod );
if ( elements.length > 0 ) {
await elements[ 0 ].click();
}
} else {
// If it's a CSS selector, use $eval
await page.$eval( paymentMethod, ( method ) => method.click() );
}
await expect( page ).toClick( 'button', {
text: 'Remove',
} );
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/utils/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export async function confirmCardAuthentication(
);
let challengeFrame = await challengeFrameHandle.contentFrame();
// 3DS 1 cards have another iframe enclosing the authorize form
if ( cardType.toUpperCase() === '3DS' ) {
if ( cardType.toUpperCase() === '3DS1' ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bborman22 I haven't checked Stripe test cards, if there are any specific ones which are triggering 3DS1 check, but AFAIK there is no code which would trigger 3DS1 check here.

For the context: So this might a dead code now. I did so in #8121 to trick linter, otherwise it would complain on unused cardType argument :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I tested all the cards we have defined and none triggered the 3DS1 flow, so I removed card type for this function entirely as it doesn't seem we need to look for 3DS1 any more.

const acsFrameHandle = await challengeFrame.waitForSelector(
'iframe[name="acsFrame"]'
);
Expand Down
Loading