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

feat(cypress): add multiple creds and flags support #6588

Open
wants to merge 89 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
8dffa26
chore: remove `console.log` from cypress v1
pixincreate Nov 14, 2024
da794b6
chore: lints
pixincreate Nov 14, 2024
8a23016
refactor: modify `getValueByKey` to read nested objects
pixincreate Nov 15, 2024
e5ad96f
feat: allow creation of multiple connectors and profiles
pixincreate Nov 15, 2024
1860630
chore: fix typo
pixincreate Nov 15, 2024
592fb66
refactor: allow setting multiple mca and profiles
pixincreate Nov 15, 2024
1364f32
feat: add flags
pixincreate Nov 15, 2024
aabaf5a
chore: lints
pixincreate Nov 15, 2024
96f1b5c
feat: add `configs` field to every test
pixincreate Nov 16, 2024
e89a777
chore: lints
pixincreate Nov 17, 2024
3ca504f
replace waittime since both the values are same
pixincreate Nov 17, 2024
688d1db
remove redundant code
pixincreate Nov 17, 2024
4c09bf6
refactor: set configs to `null` by default
pixincreate Nov 17, 2024
0cda3e0
fix: configs
pixincreate Nov 17, 2024
4d95c66
fix: configs
pixincreate Nov 17, 2024
5584661
refactro: pass config data in `should_continue_further`
pixincreate Nov 17, 2024
965e33a
refactor: remove redundant setter function and add validations
pixincreate Nov 17, 2024
6ca593d
feat: introduce `execConfig` function
pixincreate Nov 17, 2024
7788703
refactor: call `execConfigs` in `commands.js`
pixincreate Nov 17, 2024
424b822
fix: string it is
pixincreate Nov 18, 2024
99ce4c2
chore: increase timeout to 10 sec
pixincreate Nov 18, 2024
b2abc84
chore: add note for single connectors
pixincreate Nov 18, 2024
5097bde
fix: move `configs` to last of function
pixincreate Nov 18, 2024
d5a2619
fix: add configs to pml connector create call as well
pixincreate Nov 18, 2024
0fef491
refactor: pass profile id in mit mandates as well
pixincreate Nov 18, 2024
12664fb
fix: pml does not require profile id
pixincreate Nov 18, 2024
1a9dfd7
fix: pass `pid` and `mcaid` everywhere
pixincreate Nov 19, 2024
fcac1f5
refactor: pass `configs` in retrieve call for payments and `null` for
pixincreate Nov 19, 2024
770bf53
chore: lints
pixincreate Nov 19, 2024
2b2682c
fix: inconsistencies
pixincreate Nov 22, 2024
d31f9dd
refactor: directly pass `data` instead of splitting in `.cy.js` files
pixincreate Nov 25, 2024
0c2d565
chore: start moving from `snake_case` to `camelCase`
pixincreate Nov 26, 2024
ed990a5
feat: add incremental auth tests
pixincreate Nov 26, 2024
9bed7c2
chore: add bracket spacing config
pixincreate Nov 26, 2024
220c804
chore: address latest changes with my changes
pixincreate Nov 26, 2024
6c2d61e
fix: payouts
pixincreate Nov 26, 2024
e83de57
fix: pass `data` in retrieve and mit calls as well
pixincreate Nov 27, 2024
5e4bca8
refactor: remove unused fields
pixincreate Nov 27, 2024
857ee39
chore: lints
pixincreate Nov 27, 2024
b058cb3
chore: introduce eslint
pixincreate Nov 27, 2024
5434a43
chore: remove duplicate and usused code
pixincreate Nov 27, 2024
8f10947
chore: lints
pixincreate Nov 27, 2024
a9b8985
Merge branch 'main' of github.com:juspay/hyperswitch into multiple-cr…
pixincreate Nov 27, 2024
bba48ab
Merge branch 'main' of github.com:juspay/hyperswitch into multiple-cr…
pixincreate Nov 28, 2024
2f6bb5a
chore: change file name
pixincreate Nov 28, 2024
a4cabc3
chore: lints
pixincreate Nov 28, 2024
09170d0
fix: revert reverted changes
pixincreate Nov 28, 2024
fcdfbe9
chore: address lints
pixincreate Nov 28, 2024
cc5d1bd
chore: introduce husky, eslint for checking on lints and formatting
pixincreate Nov 28, 2024
debc315
chore: remove unused code
pixincreate Nov 28, 2024
2810df2
fix: pre-commit hook
pixincreate Nov 28, 2024
786ac7b
Merge branch 'main' of github.com:juspay/hyperswitch into multiple-cr…
pixincreate Nov 28, 2024
a8c6ecd
refactor: update config tests folder
pixincreate Nov 28, 2024
2f393bf
fix: fix pml utils
pixincreate Nov 28, 2024
c01f574
fix: paybox configs
pixincreate Nov 28, 2024
9878b6f
Merge branch 'main' of github.com:juspay/hyperswitch into multiple-cr…
pixincreate Nov 28, 2024
09c09d0
fix: fixture profile path
pixincreate Nov 28, 2024
00b59d4
chore: skip incremental auth tests (upstream issue)
pixincreate Nov 28, 2024
f9ed423
ci: update creds, add formatter and linter
pixincreate Nov 28, 2024
4f31cf4
fix: path
pixincreate Nov 28, 2024
4953a18
fix: address ci failure
pixincreate Nov 28, 2024
60c6723
fix: address ci failure
pixincreate Nov 28, 2024
2c36ead
ci: fix formatter and linter again
pixincreate Nov 28, 2024
8f69baa
ci: address possible failures
pixincreate Nov 29, 2024
e87c125
ci: address comments
pixincreate Dec 1, 2024
6037840
ci: induce errors for testing
pixincreate Dec 1, 2024
01f41c6
chore: run formatter
pixincreate Dec 1, 2024
e9e14e4
ci: fix
pixincreate Dec 1, 2024
52634a1
ci: restrict checks to prs from same repo
pixincreate Dec 2, 2024
28af1b1
ci: induce formatting errors
pixincreate Dec 2, 2024
0115525
chore(cypress): run formatter and address lints
hyperswitch-bot[bot] Dec 2, 2024
de9db95
Merge branch 'main' of github.com:juspay/hyperswitch into multiple-cr…
pixincreate Dec 2, 2024
89447e5
chore: update deps
pixincreate Dec 2, 2024
20aa1b5
ci: add token and induce formatting errors
pixincreate Dec 2, 2024
02af25d
chore(cypress): run formatter and address lints
hyperswitch-bot[bot] Dec 2, 2024
a053edf
ci: make it job level
pixincreate Dec 2, 2024
40f540f
ci: induce formatting error
pixincreate Dec 2, 2024
0cd8fdc
ci: fix ci
pixincreate Dec 2, 2024
1dcd8e6
chore(cypress): run formatter and address lints
hyperswitch-bot[bot] Dec 2, 2024
2d0bcef
ci: pass configs to getCustomExchange
pixincreate Dec 2, 2024
ee06922
feat: make connector_credential config an object
pixincreate Dec 2, 2024
5c45080
Merge branch 'main' of github.com:juspay/hyperswitch into multiple-cr…
pixincreate Dec 2, 2024
490911c
refactor: do not hard code configs
pixincreate Dec 2, 2024
4d026e8
ci: update trustpay creds
pixincreate Dec 2, 2024
cd0a34c
Revert "refactor: do not hard code configs"
pixincreate Dec 2, 2024
0c42764
ci: fail check for forks if not formatted
pixincreate Dec 2, 2024
d02730f
refactor: do not hard code configs
pixincreate Dec 2, 2024
4cd32e8
ci: remove comment
pixincreate Dec 2, 2024
172a8d1
ci: follow camelCase convention for `shouldContinue`
pixincreate Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion .github/workflows/cypress-tests-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,65 @@ env:
RUST_MIN_STACK: 10485760

jobs:
formatter:
pixincreate marked this conversation as resolved.
Show resolved Hide resolved
name: Run formatter on Cypress tests and address lints
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Generate a token
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.HYPERSWITCH_BOT_APP_ID }}
private-key: ${{ secrets.HYPERSWITCH_BOT_APP_PRIVATE_KEY }}

- name: Checkout repository with token
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.generate_token.outputs.token }}

- name: Checkout repository for fork
if: ${{ github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install Cypress and dependencies
run: |
npm ci --prefix ./cypress-tests

- name: Check formatting for forked pull requests
if: ${{ github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
shell: bash
run: |
npm run format:check --prefix cypress-tests
npm run lint --prefix cypress-tests

- name: Check formatting
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
shell: bash
run: |
npm run format --prefix cypress-tests
npm run lint --prefix cypress-tests -- --fix

if ! git diff --exit-code --quiet -- cypress-tests; then
echo "::notice::Cypress formatting and lint check failed"

git config --local user.name 'hyperswitch-bot[bot]'
git config --local user.email '148525504+hyperswitch-bot[bot]@users.noreply.github.com'
pixincreate marked this conversation as resolved.
Show resolved Hide resolved

git add cypress-tests
git commit --message 'chore(cypress): run formatter and address lints'
git push
pixincreate marked this conversation as resolved.
Show resolved Hide resolved
fi

runner:
name: Run Cypress tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -69,7 +128,7 @@ jobs:
CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}
CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}}
DESTINATION_FILE_NAME: "creds.json.gpg"
S3_SOURCE_FILE_NAME: "5a3f7679-445e-4621-86c5-39bd8d26b7c5.json.gpg"
S3_SOURCE_FILE_NAME: "c5701d35-aede-4d85-a866-0da4721acf30.json.gpg"
shell: bash
run: |
mkdir -p ".github/secrets" ".github/test"
Expand Down
1 change: 1 addition & 0 deletions cypress-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
creds.json
reports
run_all.sh
Expand Down
9 changes: 9 additions & 0 deletions cypress-tests/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bracketSpacing": true,
"endOfLine": "auto",
"printWidth": 80,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}
6 changes: 0 additions & 6 deletions cypress-tests/.prettierrc.json

This file was deleted.

14 changes: 7 additions & 7 deletions cypress-tests/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
const { defineConfig } = require("cypress");
const fs = require("fs-extra");
const path = require("path");
import { defineConfig } from "cypress";
import "cypress-mochawesome-reporter/plugin.js";

let globalState;

// Fetch from environment variable
const connectorId = process.env.CYPRESS_CONNECTOR || "service";
const screenshotsFolderName = `screenshots/${connectorId}`;
const reportName = process.env.REPORT_NAME || `${connectorId}_report`;

module.exports = defineConfig({
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
require("cypress-mochawesome-reporter/plugin")(on);

setupNodeEvents(on) {
on("task", {
setGlobalState: (val) => {
return (globalState = val || {});
Expand All @@ -21,7 +19,9 @@ module.exports = defineConfig({
return globalState || {};
},
cli_log: (message) => {
// eslint-disable-next-line no-console
console.log("Logging console message from task");
// eslint-disable-next-line no-console
console.log(message);
return null;
},
Expand Down
1 change: 0 additions & 1 deletion cypress-tests/cypress.env.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// creating payment with currency as EUR and no billing address
it("create-payment-call-test", () => {
let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];
let req_data = data["RequestCurrencyEUR"];
let res_data = data["Response"];
const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];

const newData = {
...data,
Request: data.RequestCurrencyEUR,
RequestCurrencyEUR: undefined, // we do not need this anymore
};

cy.createPaymentIntentTest(
create_payment_body_with_currency("EUR"),
req_data,
res_data,
newData,
"no_three_ds",
"automatic",
globalState
Expand All @@ -83,7 +86,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should only have ideal with stripe
it("payment-method-list-call-test", () => {
let data =
const data =
getConnectorDetails("stripe")["pm_list"]["PmListResponse"][
"PmListWithStripeForIdeal"
];
Expand Down Expand Up @@ -147,14 +150,17 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// creating payment with currency as INR and no billing address
it("create-payment-call-test", () => {
let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];
let req_data = data["RequestCurrencyINR"];
let res_data = data["Response"];
const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];

const newData = {
...data,
Request: data.RequestCurrencyINR,
RequestCurrencyINR: undefined, // we do not need this anymore
};

cy.createPaymentIntentTest(
create_payment_body_with_currency("INR"),
req_data,
res_data,
newData,
"no_three_ds",
"automatic",
globalState
Expand All @@ -163,7 +169,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should only have ideal with stripe
it("payment-method-list-call-test", () => {
let data =
const data =
getConnectorDetails("stripe")["pm_list"]["PmListResponse"][
"PmListNull"
];
Expand Down Expand Up @@ -227,14 +233,17 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// creating payment with currency as USD and billing address as US
it("create-payment-call-test", () => {
let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];
let req_data = data["RequestCurrencyUSD"];
let res_data = data["Response"];
const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];

const newData = {
...data,
Request: data.RequestCurrencyUSD,
RequestCurrencyUSD: undefined, // we do not need this anymore
};

cy.createPaymentIntentTest(
create_payment_body_with_currency("USD"),
req_data,
res_data,
newData,
"no_three_ds",
"automatic",
globalState
Expand All @@ -243,7 +252,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should only have credit with Stripe and Cybersource
it("payment-method-list-call-test", () => {
let data =
const data =
getConnectorDetails("stripe")["pm_list"]["PmListResponse"][
"PmListWithCreditTwoConnector"
];
Expand Down Expand Up @@ -307,14 +316,17 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// creating payment with currency as EUR and billing address as US
it("create-payment-call-test", () => {
let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];
let req_data = data["RequestCurrencyEUR"];
let res_data = data["Response"];
const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];

const newData = {
...data,
Request: data.RequestCurrencyEUR,
RequestCurrencyEUR: undefined, // we do not need this anymore
};

cy.createPaymentIntentTest(
create_payment_body_with_currency_country("EUR", "US", "US"),
req_data,
res_data,
newData,
"no_three_ds",
"automatic",
globalState
Expand All @@ -323,7 +335,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which shouldn't have anything
it("payment-method-list-call-test", () => {
let data =
const data =
getConnectorDetails("stripe")["pm_list"]["PmListResponse"][
"PmListNull"
];
Expand Down Expand Up @@ -389,14 +401,17 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// creating payment with currency as USD and billing address as IN
it("create-payment-call-test", () => {
let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];
let req_data = data["RequestCurrencyUSD"];
let res_data = data["Response"];
const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];

const newData = {
...data,
Request: data.RequestCurrencyUSD,
RequestCurrencyUSD: undefined, // we do not need this anymore
};

cy.createPaymentIntentTest(
create_payment_body_with_currency_country("USD", "IN", "IN"),
req_data,
res_data,
newData,
"no_three_ds",
"automatic",
globalState
Expand All @@ -405,7 +420,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should have credit with stripe and cybersource and no ideal
it("payment-method-list-call-test", () => {
let data =
const data =
getConnectorDetails("stripe")["pm_list"]["PmListResponse"][
"PmListWithCreditTwoConnector"
];
Expand Down Expand Up @@ -470,14 +485,17 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// creating payment with currency as USD and billing address as IN
it("create-payment-call-test", () => {
let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];
let req_data = data["RequestCurrencyUSD"];
let res_data = data["Response"];
const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];

const newData = {
...data,
Request: data.RequestCurrencyUSD,
RequestCurrencyUSD: undefined, // we do not need this anymore
};

cy.createPaymentIntentTest(
create_payment_body_with_currency("USD"),
req_data,
res_data,
newData,
"no_three_ds",
"automatic",
globalState
Expand All @@ -486,7 +504,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should have credit with stripe and cybersource and no ideal
it("payment-method-list-call-test", () => {
let data =
const data =
getConnectorDetails("stripe")["pm_list"]["PmListResponse"][
"PmListWithCreditTwoConnector"
];
Expand Down Expand Up @@ -550,14 +568,17 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// creating payment with currency as EUR and no billing address
it("create-payment-call-test", () => {
let data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];
let req_data = data["RequestCurrencyEUR"];
let res_data = data["Response"];
const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];

const newData = {
...data,
Request: data.RequestCurrencyEUR,
RequestCurrencyEUR: undefined, // we do not need this anymore
};

cy.createPaymentIntentTest(
create_payment_body_with_currency_country("EUR", "NL", "US"),
req_data,
res_data,
newData,
"no_three_ds",
"automatic",
globalState
Expand All @@ -566,7 +587,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {

// payment method list which should only have ideal with stripe
it("payment-method-list-call-test", () => {
let data =
const data =
getConnectorDetails("stripe")["pm_list"]["PmListResponse"][
"PmListWithStripeForIdeal"
];
Expand Down
9 changes: 0 additions & 9 deletions cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
import State from "../../utils/State";

const globalState = new State({
connectorId: Cypress.env("CONNECTOR"),
baseUrl: Cypress.env("BASEURL"),
adminApiKey: Cypress.env("ADMINAPIKEY"),
connectorAuthFilePath: Cypress.env("CONNECTOR_AUTH_FILE_PATH"),
});

export const card_credit_enabled = [
{
payment_method: "card",
Expand Down
8 changes: 0 additions & 8 deletions cypress-tests/cypress/e2e/PaymentMethodListUtils/Stripe.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
const successfulNo3DSCardDetails = {
card_number: "4242424242424242",
card_exp_month: "10",
card_exp_year: "50",
card_holder_name: "morino",
card_cvc: "737",
};

export const connectorDetails = {
pm_list: {
PaymentIntent: {
Expand Down
Loading
Loading