-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(cypress): Add Tests for Customer Deletion and Psync flows (#7158)
- Loading branch information
1 parent
4693d21
commit 9772cb3
Showing
5 changed files
with
392 additions
and
43 deletions.
There are no files selected for viewing
337 changes: 337 additions & 0 deletions
337
cypress-tests/cypress/e2e/spec/Payment/00026-DeletedCustomerPsyncFlow.cy.js
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,337 @@ | ||
import * as fixtures from "../../../fixtures/imports"; | ||
import State from "../../../utils/State"; | ||
import getConnectorDetails, * as utils from "../../configs/Payment/Utils"; | ||
|
||
let globalState; | ||
|
||
describe("Card - Customer Deletion and Psync", () => { | ||
before("seed global state", () => { | ||
cy.task("getGlobalState").then((state) => { | ||
globalState = new State(state); | ||
}); | ||
}); | ||
|
||
after("flush global state", () => { | ||
cy.task("setGlobalState", globalState.data); | ||
}); | ||
|
||
context("Card - Psync after Customer Deletion for Automatic Capture", () => { | ||
context("No3DS Card - Psync after Customer Deletion ", () => { | ||
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails | ||
|
||
beforeEach(function () { | ||
if (!shouldContinue) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("Create Customer", () => { | ||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); | ||
}); | ||
|
||
it("Create Payment Intent", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["PaymentIntent"]; | ||
|
||
cy.createPaymentIntentTest( | ||
fixtures.createPaymentBody, | ||
data, | ||
"no_three_ds", | ||
"automatic", | ||
globalState | ||
); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Confirm Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["No3DSAutoCapture"]; | ||
|
||
cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["No3DSAutoCapture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
|
||
it("Delete Customer", () => { | ||
cy.customerDeleteCall(globalState); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["No3DSAutoCapture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
}); | ||
|
||
context("3DS Card - Psync after Customer Deletion ", () => { | ||
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails | ||
|
||
beforeEach(function () { | ||
if (!shouldContinue) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
before("seed global state", () => { | ||
cy.task("getGlobalState").then((state) => { | ||
globalState = new State(state); | ||
}); | ||
}); | ||
|
||
afterEach("flush global state", () => { | ||
cy.task("setGlobalState", globalState.data); | ||
}); | ||
|
||
it("Create Customer", () => { | ||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); | ||
}); | ||
|
||
it("Create Payment Intent", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["PaymentIntent"]; | ||
|
||
cy.createPaymentIntentTest( | ||
fixtures.createPaymentBody, | ||
data, | ||
"three_ds", | ||
"automatic", | ||
globalState | ||
); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Confirm Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["3DSAutoCapture"]; | ||
|
||
cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Handle redirection", () => { | ||
const expected_redirection = fixtures.confirmBody["return_url"]; | ||
cy.handleRedirection(globalState, expected_redirection); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["No3DSAutoCapture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
|
||
it("Delete Customer", () => { | ||
cy.customerDeleteCall(globalState); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["No3DSAutoCapture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
}); | ||
}); | ||
|
||
context("Card - Psync after Customer Deletion for Manual Capture", () => { | ||
context("No3DS Card - Psync after Customer Deletion ", () => { | ||
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails | ||
|
||
beforeEach(function () { | ||
if (!shouldContinue) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it("Create Customer", () => { | ||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); | ||
}); | ||
|
||
it("Create Payment Intent", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["PaymentIntent"]; | ||
|
||
cy.createPaymentIntentTest( | ||
fixtures.createPaymentBody, | ||
data, | ||
"no_three_ds", | ||
"manual", | ||
globalState | ||
); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Confirm Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["No3DSManualCapture"]; | ||
|
||
cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["No3DSManualCapture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
|
||
it("Capture Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["Capture"]; | ||
|
||
cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["Capture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
|
||
it("Delete Customer", () => { | ||
cy.customerDeleteCall(globalState); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["No3DSManualCapture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
}); | ||
|
||
context("3DS Card - Psync after Customer Deletion ", () => { | ||
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails | ||
|
||
beforeEach(function () { | ||
if (!shouldContinue) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
before("seed global state", () => { | ||
cy.task("getGlobalState").then((state) => { | ||
globalState = new State(state); | ||
}); | ||
}); | ||
|
||
afterEach("flush global state", () => { | ||
cy.task("setGlobalState", globalState.data); | ||
}); | ||
|
||
it("Create Customer", () => { | ||
cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); | ||
}); | ||
|
||
it("Create Payment Intent", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["PaymentIntent"]; | ||
|
||
cy.createPaymentIntentTest( | ||
fixtures.createPaymentBody, | ||
data, | ||
"three_ds", | ||
"manual", | ||
globalState | ||
); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Confirm Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["3DSManualCapture"]; | ||
|
||
cy.confirmCallTest(fixtures.confirmBody, data, true, globalState); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Handle redirection", () => { | ||
const expected_redirection = fixtures.confirmBody["return_url"]; | ||
cy.handleRedirection(globalState, expected_redirection); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["3DSManualCapture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
|
||
it("Capture Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["Capture"]; | ||
|
||
cy.captureCallTest(fixtures.captureBody, data, 6500, globalState); | ||
|
||
if (shouldContinue) | ||
shouldContinue = utils.should_continue_further(data); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["Capture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
|
||
it("Delete Customer", () => { | ||
cy.customerDeleteCall(globalState); | ||
}); | ||
|
||
it("Retrieve Payment", () => { | ||
const data = getConnectorDetails(globalState.get("connectorId"))[ | ||
"card_pm" | ||
]["3DSManualCapture"]; | ||
|
||
cy.retrievePaymentCallTest(globalState, data); | ||
}); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.