-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into cypress-automation-sdk
- Loading branch information
Showing
28 changed files
with
486 additions
and
539 deletions.
There are no files selected for viewing
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
81 changes: 81 additions & 0 deletions
81
cypress-tests/cypress/e2e/external-3DS-netcetera-e2e-test.cy.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,81 @@ | ||
import * as testIds from "../../../src/Utilities/TestUtils.bs"; | ||
import { getClientURL, netceteraChallengeTestCard, createPaymentBody, changeObjectKeyValue, connectorProfileIdMapping, connectorEnum } from "../support/utils"; | ||
describe("External 3DS using Netcetera Checks", () => { | ||
let getIframeBody: () => Cypress.Chainable<JQuery<HTMLBodyElement>>; | ||
const publishableKey = Cypress.env('HYPERSWITCH_PUBLISHABLE_KEY') | ||
const secretKey = Cypress.env('HYPERSWITCH_SECRET_KEY') | ||
changeObjectKeyValue(createPaymentBody, "profile_id", connectorProfileIdMapping.get(connectorEnum.NETCETERA)) | ||
changeObjectKeyValue(createPaymentBody, "request_external_three_ds_authentication", true) | ||
changeObjectKeyValue(createPaymentBody, "authentication_type", "three_ds") | ||
let iframeSelector = | ||
"#orca-payment-element-iframeRef-orca-elements-payment-element-payment-element"; | ||
|
||
beforeEach(() => { | ||
getIframeBody = () => cy.iframe(iframeSelector); | ||
cy.createPaymentIntent(secretKey, createPaymentBody).then(() => { | ||
cy.getGlobalState("clientSecret").then((clientSecret) => { | ||
|
||
cy.visit(getClientURL(clientSecret, publishableKey)); | ||
}); | ||
|
||
}) | ||
}); | ||
|
||
|
||
it("title rendered correctly", () => { | ||
cy.contains("Hyperswitch Unified Checkout").should("be.visible"); | ||
}); | ||
|
||
it("orca-payment-element iframe loaded", () => { | ||
cy.get( | ||
"#orca-payment-element-iframeRef-orca-elements-payment-element-payment-element" | ||
) | ||
.should("be.visible") | ||
.its("0.contentDocument") | ||
.its("body"); | ||
}); | ||
|
||
|
||
it('If the user completes the challenge, the payment should be successful.', () => { | ||
getIframeBody().find(`[data-testid=${testIds.addNewCardIcon}]`).click() | ||
getIframeBody().find(`[data-testid=${testIds.cardNoInputTestId}]`).type(netceteraChallengeTestCard) | ||
getIframeBody().find(`[data-testid=${testIds.expiryInputTestId}]`).type("0444") | ||
cy.wait(1000) | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).type("1234") | ||
getIframeBody().get("#submit").click(); | ||
cy.wait(4000) | ||
|
||
cy.nestedIFrame("#threeDsAuthFrame", ($body) => { | ||
cy.wrap($body).find('#otp') | ||
.type('1234') | ||
|
||
cy.wrap($body).find('#sendOtp') | ||
.click() | ||
cy.contains("Thanks for your order!").should("be.visible"); | ||
}) | ||
|
||
}) | ||
|
||
it('If the user closes the challenge, the payment should fail.', () => { | ||
getIframeBody().find(`[data-testid=${testIds.addNewCardIcon}]`).click() | ||
getIframeBody().find(`[data-testid=${testIds.cardNoInputTestId}]`).type(netceteraChallengeTestCard) | ||
getIframeBody().find(`[data-testid=${testIds.expiryInputTestId}]`).type("0444") | ||
cy.wait(1000) | ||
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).type("1234") | ||
getIframeBody().get("#submit").click(); | ||
cy.wait(4000) | ||
|
||
cy.nestedIFrame("#threeDsAuthFrame", ($body) => { | ||
cy.wrap($body) | ||
.find('#cancel') | ||
.click() | ||
cy.contains("Payment Failed!").should("be.visible"); | ||
}) | ||
}) | ||
|
||
|
||
}) | ||
|
||
|
||
|
||
|
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.