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

refactor(cypress): move memory cache tests out of payment for misc #6992

Merged
merged 21 commits into from
Jan 24, 2025

Conversation

pixincreate
Copy link
Member

@pixincreate pixincreate commented Jan 6, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR aims at refactoring:

  • cypress-tests folder structure to reduce confusion and chaos in within e2e directory

    • previous:

       .
       └── cypress
           ├── e2e
           │   ├── PaymentMethodListTest
           │   ├── PaymentMethodListUtils
           │   ├── PaymentTest
           │   ├── PaymentUtils
           │   ├── PayoutTest
           │   ├── PayoutUtils
           │   ├── RoutingTest
           │   └── RoutingUtils
           ├── fixtures
           ├── support
           └── utils
    • present:

       .
       └── cypress
           ├── e2e
           │   ├── configs
           │   │   ├── Payment
           │   │   ├── PaymentMethodList
           │   │   ├── Payout
           │   │   └── Routing
           │   └── spec
           │       ├── Misc <- memory cache tests have been moved here
           │       ├── Payment
           │       ├── PaymentMethodList
           │       ├── Payout
           │       └── Routing
           ├── fixtures
           ├── support
           └── utils
  • reduce / remove duplicate commands in memory cache (config calls) by unifying them

    • test(cypress): add test for In Memory Cache #6961 introduces the memory cache test, but does not aim at optimising things. this pr is intended to address that
    • additionally, memory cache test have been moved out of payments service to misc just so that, tests that are independent of business profile, mca, merchant account can be added here in the future
  • new command addition to miscellaneous tests: npm run cypress:misc

  • slight security improvement by forcing the api key to expire within 24 hours

closes #6993

documentation will be updated later

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Too many boiler plates, too many useless code

How did you test it?

# executed below command to cherry-pick cookie changes just so that userlogin work
git cherry-pick -n ..fix-cookie-cypress

# started cypress against stripe
CYPRESS_CONNECTOR=stripe npm run cypress

stripe:
image

memory cache:
image

health check:
image

ci:

image

Checklist

  • I formatted the code npm run format
  • I addressed lints thrown by npm run lint
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@pixincreate pixincreate requested a review from a team as a code owner January 6, 2025 09:12
Copy link

semanticdiff-com bot commented Jan 6, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  cypress-tests/package.json  80% smaller
  cypress-tests/cypress/e2e/spec/Payment/00016-ThreeDSManualCapture.cy.js  76% smaller
  cypress-tests/cypress/e2e/spec/Payment/00027-DynamicFields.cy.js  68% smaller
  cypress-tests/cypress/e2e/configs/Payment/Cybersource.js  67% smaller
  cypress-tests/cypress/e2e/spec/Payment/00003-ConnectorCreate.cy.js  42% smaller
  cypress-tests/cypress/e2e/spec/Payment/00024-ConnectorAgnosticNTID.cy.js  41% smaller
  cypress-tests/cypress/e2e/spec/Payment/00026-BusinessProfileConfigs.cy.js  41% smaller
  cypress-tests/cypress/e2e/spec/Payment/00000-CoreFlows.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00004-NoThreeDSAutoCapture.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00005-ThreeDSAutoCapture.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00006-NoThreeDSManualCapture.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00007-VoidPayment.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00008-SyncPayment.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00009-RefundPayment.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00010-SyncRefund.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00011-CreateSingleuseMandate.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00012-CreateMultiuseMandate.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00013-ListAndRevokeMandate.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00017-BankTransfers.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00018-BankRedirect.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00019-MandatesUsingPMID.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00020-MandatesUsingNTIDProxy.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00021-UPI.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00023-PaymentMethods.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00025-SessionCall.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payment/00028-IncrementalAuth.cy.js  37% smaller
  cypress-tests/cypress/e2e/spec/Payout/00003-CardTest.cy.js  36% smaller
  cypress-tests/cypress/e2e/spec/Payout/00004-BankTransfer.cy.js  36% smaller
  cypress-tests/cypress/e2e/spec/Payout/00005-SavePayout.cy.js  36% smaller
  cypress-tests/cypress/e2e/spec/Routing/00003-Retries.cy.js  35% smaller
  cypress-tests/cypress/e2e/spec/Routing/00001-VolumeBasedRouting.cy.js  25% smaller
  cypress-tests/cypress/e2e/spec/Routing/00002-RuleBasedRouting.cy.js  25% smaller
  cypress-tests/cypress/e2e/spec/Routing/00000-PriorityRouting.cy.js  19% smaller
  cypress-tests/cypress/e2e/spec/PaymentMethodList/00000-PaymentMethodListTests.cy.js  16% smaller
  cypress-tests/cypress/support/commands.js  6% smaller
  cypress-tests/cypress/e2e/configs/Payout/Commons.js  2% smaller
  cypress-tests/cypress/e2e/configs/Payment/Commons.js  1% smaller
  cypress-tests/README.md Unsupported file format
  cypress-tests/cypress/e2e/configs/Payment/Adyen.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/BankOfAmerica.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Bluesnap.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Checkout.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Datatrans.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Deutschebank.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Elavon.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Fiservemea.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Fiuu.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Iatapay.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/ItauBank.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Jpmorgan.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Modifiers.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Nexixpay.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Nmi.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Noon.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Novalnet.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Paybox.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Paypal.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Stripe.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Trustpay.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Utils.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/WellsFargo.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/WorldPay.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Xendit.js  0% smaller
  cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js  0% smaller
  cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.js  0% smaller
  cypress-tests/cypress/e2e/configs/PaymentMethodList/Utils.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payout/Adyen.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payout/AdyenPlatform.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payout/Modifiers.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payout/Utils.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payout/Wise.js  0% smaller
  cypress-tests/cypress/e2e/configs/Routing/Adyen.js  0% smaller
  cypress-tests/cypress/e2e/configs/Routing/Autoretries.js  0% smaller
  cypress-tests/cypress/e2e/configs/Routing/Commons.js  0% smaller
  cypress-tests/cypress/e2e/configs/Routing/Stripe.js  0% smaller
  cypress-tests/cypress/e2e/configs/Routing/Utils.js  0% smaller
  cypress-tests/cypress/e2e/spec/Misc/00000-HealthCheck.cy.js  0% smaller
  cypress-tests/cypress/e2e/spec/Misc/00001-MemoryCacheConfigs.cy.js  0% smaller
  cypress-tests/cypress/e2e/spec/Payment/00001-AccountCreate.cy.js  0% smaller
  cypress-tests/cypress/e2e/spec/Payment/00002-CustomerCreate.cy.js  0% smaller
  cypress-tests/cypress/e2e/spec/Payout/00000-AccountCreate.cy.js  0% smaller
  cypress-tests/cypress/e2e/spec/Payout/00001-CustomerCreate.cy.js  0% smaller
  cypress-tests/cypress/e2e/spec/Payout/00002-ConnectorCreate.cy.js  0% smaller
  cypress-tests/cypress/utils/RequestBodyUtils.js  0% smaller

@pixincreate pixincreate self-assigned this Jan 6, 2025
@pixincreate pixincreate added A-CI-CD Area: Continuous Integration/Deployment S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jan 6, 2025
@pixincreate pixincreate added this to the December 2024 Release milestone Jan 6, 2025
@pixincreate pixincreate force-pushed the refactor-add-memory-cache branch from 0cc9122 to 960f4ef Compare January 6, 2025 09:16
@pixincreate pixincreate linked an issue Jan 6, 2025 that may be closed by this pull request
@pixincreate pixincreate force-pushed the refactor-add-memory-cache branch from 5377539 to 76b0ffa Compare January 7, 2025 09:24
@pixincreate pixincreate requested review from a team as code owners January 7, 2025 09:24
@hyperswitch-bot hyperswitch-bot bot added M-database-changes Metadata: This PR involves database schema changes M-api-contract-changes Metadata: This PR involves API contract changes labels Jan 7, 2025
@pixincreate pixincreate force-pushed the refactor-add-memory-cache branch from 76b0ffa to 08bfd71 Compare January 7, 2025 09:56
@pixincreate pixincreate force-pushed the refactor-add-memory-cache branch from 08bfd71 to c18cdbd Compare January 7, 2025 09:58
@hyperswitch-bot hyperswitch-bot bot removed M-database-changes Metadata: This PR involves database schema changes M-api-contract-changes Metadata: This PR involves API contract changes labels Jan 7, 2025
@pixincreate pixincreate removed request for a team January 7, 2025 09:58
likhinbopanna
likhinbopanna previously approved these changes Jan 13, 2025
…itch into refactor-add-memory-cache

* 'refactor-add-memory-cache' of github.com:juspay/hyperswitch:
  docs(cypress): update file structure (#7016)
  refactor(cypress): verify payment status after payment redirection (#6187)
  chore(version): 2025.01.13.0
likhinbopanna
likhinbopanna previously approved these changes Jan 13, 2025
…d-memory-cache

* 'main' of github.com:juspay/hyperswitch:
  feat(connector): [Deutschebank] Implement Card 3ds (#6844)
  feat(payment_methods_v2): add payment methods list endpoint (#6938)
likhinbopanna
likhinbopanna previously approved these changes Jan 13, 2025
…d-memory-cache

* 'main' of github.com:juspay/hyperswitch: (38 commits)
  fix(cypress): uncaught exceptions thrown by `hyperswitch.io` (#7092)
  ci(workflows): Add code coverage reporting for v2 (#6884)
  chore(version): 2025.01.23.0
  refactor: [CYBERSOURCE, BANKOFAMERICA, WELLSFARGO] Move code to crate hyperswitch_connectors (#6908)
  Documentation edits made through Mintlify web editor
  chore: enable 128-column-tables feature for diesel crate (#6857)
  feat(connector): [ADYEN ] Consume transaction id for PaymentsPreProcessing error (#7061)
  chore(version): 2025.01.22.0
  feat(routing): Integrate global success rates (#6950)
  feat(email): Add mailhog by default in docker-compose for local smtp server (#6869)
  refactor: check allowed payment method types in enabled options (#7019)
  feat(router): add payment method-specific features to connector feature list (#6963)
  Refactor: Customer email and browser Information (#7034)
  feat(connectors): fiuu,novalnet,worldpay - extend NTI flows (#6946)
  fix(cypress): address cybersource redirection inconsistency (#7057)
  chore(version): 2025.01.21.0
  refactor(payment-link): use shouldRemoveBeforeUnloadEvents flag for handling removal of beforeunload events through SDK (#7072)
  refactor(router): refactor ctp flow to fetch mca_id and get the connector creds instead of connector_name (#6859)
  chore(version): 2025.01.20.0
  fix(relay): populate connector metadata in the refunds flow (#7045)
  ...
likhinbopanna
likhinbopanna previously approved these changes Jan 24, 2025
cy.updateConfigs(globalState, key, newValue);
cy.fetchConfigs(globalState, key, newValue);
cy.setConfigs(globalState, key, newValue, "UPDATE");
cy.setConfigs(globalState, key, value, "FETCH");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for newValue variable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, done:

image

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@cf82861). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6992   +/-   ##
=======================================
  Coverage        ?    4.12%           
=======================================
  Files           ?     1010           
  Lines           ?   207403           
  Branches        ?        0           
=======================================
  Hits            ?     8548           
  Misses          ?   198855           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 24, 2025
Merged via the queue into main with commit 4382fc6 Jan 24, 2025
22 of 23 checks passed
@likhinbopanna likhinbopanna deleted the refactor-add-memory-cache branch January 24, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI-CD Area: Continuous Integration/Deployment S-waiting-on-review Status: This PR has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] reduce duplicate code in config in cypress
7 participants