-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(Cypress): Add response handler for Connector Testing #4624
Changes from all commits
c88ed07
f67d1de
ad68c27
46a2801
6a8d4c7
f2224e8
d8951f4
0fa132a
02ed37b
f431bd9
53dd322
c1d894e
f4e21fa
ef8e599
9815bc9
566444b
288ff77
ca93089
271bcf8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json"; | |
import createPaymentBody from "../../fixtures/create-payment-body.json"; | ||
import State from "../../utils/State"; | ||
import getConnectorDetails from "../ConnectorUtils/utils"; | ||
import * as utils from "../ConnectorUtils/utils"; | ||
|
||
let globalState; | ||
|
||
|
@@ -25,10 +26,20 @@ describe("Card - NoThreeDS Manual payment flow test", () => { | |
context("Card - NoThreeDS Manual Full Capture payment flow test", () => { | ||
|
||
context("payment Create and Confirm", () => { | ||
let should_continue = true; // variable that will be used to skip tests if a previous test fails | ||
|
||
beforeEach(function () { | ||
if(!should_continue) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("create-payment-call-test", () => { | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("payment_methods-call-test", () => { | ||
|
@@ -37,19 +48,25 @@ describe("Card - NoThreeDS Manual payment flow test", () => { | |
|
||
it("confirm-call-test", () => { | ||
console.log("confirm -> " + globalState.get("connectorId")); | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
console.log("det -> " + det.card); | ||
cy.confirmCallTest(confirmBody, det, true, globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
console.log("det -> " + data.card); | ||
cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("retrieve-payment-call-test", () => { | ||
cy.retrievePaymentCallTest(globalState); | ||
}); | ||
|
||
it("capture-call-test", () => { | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
console.log("det -> " + det.card); | ||
cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
console.log("det -> " + data.card); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here. |
||
cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("retrieve-payment-call-test", () => { | ||
|
@@ -59,21 +76,35 @@ describe("Card - NoThreeDS Manual payment flow test", () => { | |
}); | ||
|
||
context("Payment Create+Confirm", () => { | ||
let should_continue = true; // variable that will be used to skip tests if a previous test fails | ||
|
||
beforeEach(function () { | ||
if(!should_continue) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("create+confirm-payment-call-test", () => { | ||
console.log("confirm -> " + globalState.get("connectorId")); | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
console.log("det -> " + det.card); | ||
cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "manual", globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
console.log("det -> " + data.card); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here. |
||
cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("retrieve-payment-call-test", () => { | ||
cy.retrievePaymentCallTest(globalState); | ||
}); | ||
|
||
it("capture-call-test", () => { | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
console.log("det -> " + det.card); | ||
cy.captureCallTest(captureBody, 6540, det.paymentSuccessfulStatus, globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["Capture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
console.log("det -> " + data.card); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @prasunna09, You added these log lines, and they are present in all your initial commits. Removing them will take a significant amount of time. We'll address this issue later. For now, could you please approve this so we can proceed with the other changes? We are currently blocked by this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this can be taken up in separate pr |
||
cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("retrieve-payment-call-test", () => { | ||
|
@@ -87,10 +118,20 @@ describe("Card - NoThreeDS Manual payment flow test", () => { | |
context("Card - NoThreeDS Manual Partial Capture payment flow test - Create and Confirm", () => { | ||
|
||
context("payment Create and Payment Confirm", () => { | ||
let should_continue = true; // variable that will be used to skip tests if a previous test fails | ||
|
||
beforeEach(function () { | ||
if(!should_continue) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("create-payment-call-test", () => { | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PaymentIntent"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
cy.createPaymentIntentTest(createPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("payment_methods-call-test", () => { | ||
|
@@ -99,18 +140,24 @@ describe("Card - NoThreeDS Manual payment flow test", () => { | |
|
||
it("confirm-call-test", () => { | ||
console.log("confirm -> " + globalState.get("connectorId")); | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
console.log("det -> " + det.card); | ||
cy.confirmCallTest(confirmBody, det, true, globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
console.log("det -> " + data.card); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here. |
||
cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("retrieve-payment-call-test", () => { | ||
cy.retrievePaymentCallTest(globalState); | ||
}); | ||
|
||
it("capture-call-test", () => { | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
cy.captureCallTest(captureBody, 100, det.paymentSuccessfulStatus, globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("retrieve-payment-call-test", () => { | ||
|
@@ -119,21 +166,35 @@ describe("Card - NoThreeDS Manual payment flow test", () => { | |
}); | ||
|
||
context("payment + Confirm", () => { | ||
let should_continue = true; // variable that will be used to skip tests if a previous test fails | ||
|
||
beforeEach(function () { | ||
if(!should_continue) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("create+confirm-payment-call-test", () => { | ||
console.log("confirm -> " + globalState.get("connectorId")); | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
console.log("det -> " + det.card); | ||
cy.createConfirmPaymentTest(createConfirmPaymentBody, det, "no_three_ds", "manual", globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DSManualCapture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
console.log("det -> " + data.card); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the log |
||
cy.createConfirmPaymentTest(createConfirmPaymentBody, req_data, res_data, "no_three_ds", "manual", globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("retrieve-payment-call-test", () => { | ||
cy.retrievePaymentCallTest(globalState); | ||
}); | ||
|
||
it("capture-call-test", () => { | ||
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["No3DS"]; | ||
console.log("det -> " + det.card); | ||
cy.captureCallTest(captureBody, 5000, det.paymentSuccessfulStatus, globalState); | ||
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["PartialCapture"]; | ||
let req_data = data["Request"]; | ||
let res_data = data["Response"]; | ||
console.log("det -> " + data.card); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here. |
||
cy.captureCallTest(captureBody, req_data, res_data, 100, globalState); | ||
if(should_continue) should_continue = utils.should_continue_further(res_data); | ||
}); | ||
|
||
it("retrieve-payment-call-test", () => { | ||
|
@@ -144,4 +205,4 @@ describe("Card - NoThreeDS Manual payment flow test", () => { | |
|
||
|
||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the logs.