From 0ebe9328451f246ba54c13c374079c7a65b44755 Mon Sep 17 00:00:00 2001 From: Susritha <106534816+susrithasabbini@users.noreply.github.com> Date: Tue, 28 Jan 2025 11:53:17 +0530 Subject: [PATCH] test: Cypress test cases running (#130) --- .../hyperswitch-app/templates/misc/README.md | 42 +++++++++++++++++++ .../cypress_hyperswitch_control_center.sh | 5 +++ .../templates/misc/cypress_router.sh | 12 ++++++ .../templates/misc/cypress_web.sh | 8 ++++ 4 files changed, 67 insertions(+) create mode 100644 charts/incubator/hyperswitch-app/templates/misc/README.md create mode 100644 charts/incubator/hyperswitch-app/templates/misc/cypress_hyperswitch_control_center.sh create mode 100644 charts/incubator/hyperswitch-app/templates/misc/cypress_router.sh create mode 100644 charts/incubator/hyperswitch-app/templates/misc/cypress_web.sh diff --git a/charts/incubator/hyperswitch-app/templates/misc/README.md b/charts/incubator/hyperswitch-app/templates/misc/README.md new file mode 100644 index 0000000..49afac9 --- /dev/null +++ b/charts/incubator/hyperswitch-app/templates/misc/README.md @@ -0,0 +1,42 @@ +# To Run the CYPRESS test cases + +Run all the services of the hyperswitch-helm repository as mentioned in the `README.md` file of the repository. + +## In `hyperswitch-control-center` + +1. Run the following command to start the hyperswitch control center test cases: +```sh cypress_hyperswitch_control_center.sh``` + +## In `hyperswitch-web` + +1. `git clone https://github.com/juspay/hyperswitch-web.git` + +2. `cd hyperswitch-web` + +3. In the `cypress-tests/cypress.env.json` file update the keys correctly + +4. In the `cypress-tests/cypress/support/utils.ts` update the profileId + +5. In the `Hyperswitch-React-Demo-App/.env` update the profileId, keys, server and client urls + +6. Make sure you have cypress installed in the system `npm install cypress --save-dev` + +7. Run the following command to start the hyperswitch web test cases: +```sh cypress_web.sh``` + +## In `hyperswitch` + +1. `git clone https://github.com/juspay/hyperswitch` + +2. `cd hyperswitch` + +3. Have the `creds.json` file in the `hyperswitch/cypress-tests` directory + +4. Make sure you replace the the command in cypress_router.sh with the correct domain name of the postgresql service in the hyperswitch namespace. +``psql --host=your-hypers-v1-postgresql-0-domain --username=hyperswitch --dbname=hyperswitch --command "\copy cards_info FROM '../.github/data/cards_info.csv' DELIMITER ',' CSV HEADER;"`` + +5. Password +`ZGJwYXNzd29yZDEx` + +6. Run the following command to start the hyperswitch test cases: +```sh cypress_router.sh``` \ No newline at end of file diff --git a/charts/incubator/hyperswitch-app/templates/misc/cypress_hyperswitch_control_center.sh b/charts/incubator/hyperswitch-app/templates/misc/cypress_hyperswitch_control_center.sh new file mode 100644 index 0000000..9f82cdc --- /dev/null +++ b/charts/incubator/hyperswitch-app/templates/misc/cypress_hyperswitch_control_center.sh @@ -0,0 +1,5 @@ +git clone https://github.com/juspay/hyperswitch-control-center +cd hyperswitch-control-center + +npm install +npx cypress run \ No newline at end of file diff --git a/charts/incubator/hyperswitch-app/templates/misc/cypress_router.sh b/charts/incubator/hyperswitch-app/templates/misc/cypress_router.sh new file mode 100644 index 0000000..f094e89 --- /dev/null +++ b/charts/incubator/hyperswitch-app/templates/misc/cypress_router.sh @@ -0,0 +1,12 @@ +cd cypress-tests + +npm ci +psql --host=your-hypers-v1-postgresql-0-domain --username=hyperswitch --dbname=hyperswitch --command "\copy cards_info FROM '../.github/data/cards_info.csv' DELIMITER ',' CSV HEADER;" + +export CYPRESS_CONNECTOR="stripe" +export CYPRESS_BASEURL="localhost:8080" +export DEBUG=cypress:cli +export CYPRESS_ADMINAPIKEY="test_admin" +export CYPRESS_CONNECTOR_AUTH_FILE_PATH="creds.json" + +npm run cypress:ci \ No newline at end of file diff --git a/charts/incubator/hyperswitch-app/templates/misc/cypress_web.sh b/charts/incubator/hyperswitch-app/templates/misc/cypress_web.sh new file mode 100644 index 0000000..6398555 --- /dev/null +++ b/charts/incubator/hyperswitch-app/templates/misc/cypress_web.sh @@ -0,0 +1,8 @@ +npm install + +cd Hyperswitch-React-Demo-App +npm start & +cd .. +cd cypress-tests + +npm test \ No newline at end of file