Skip to content

refactor(cypress): update skip logic and test flow for cypress incremental auth tests #8594

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

Merged
merged 11 commits into from
Jul 11, 2025

Conversation

arindam-sahoo
Copy link
Contributor

@arindam-sahoo arindam-sahoo commented Jul 9, 2025

Type of Change

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

Description

This PR introduces a set of improvements and refactors in the Cypress test suite specifically for Incremental Authorization test cases.


✅ Key Changes:

  1. Connector Inclusion List for Incremental Auth

    • Introduced a new list INCREMENTAL_AUTH in Utils.js under CONNECTOR_LISTS.INCLUDE.
    • This inclusion list determines which connectors support Incremental Authorization and should execute related tests.
  2. Dynamic Skipping of Tests Based on Connector Support

    • Refactored the test flow to dynamically skip() test blocks at runtime if the connector isn't included in INCREMENTAL_AUTH.
    • Prevents false negatives and unwanted test runs on unsupported connectors (like CyberSource with known MULTIPLE_CONNECTORS issues).
  3. Refactored before and after Hooks

    • Replaced arrow functions with regular functions in before() hooks to correctly utilize this.skip().
    • Ensured proper state flushing with afterEach instead of after.
  4. Improved Capture Test for Incremental Auth

    • Modified the capture test logic to simulate an incremented capture amount.
    • Prevents test result from falling into partially_captured due to stale previously_authorized_amount.
  5. Enhanced Assertions for Incremental Auth Response

    • Added deep assertions for previously_authorized_amount from incremental_authorizations to validate correctness of incremental logic.
    • Ensures the captured amount matches the expected post-incremented value.

🧪 Test Impact:

  • Only connectors in INCREMENTAL_AUTH list will now run Incremental Authorization tests.
  • Currently includes: cybersource (commented out due to known issue), paypal, and archipel (handled in related PR ci(cypress): fix archipel cypress test cases #8189).
  • Other connectors will auto-skip these tests, improving CI stability and relevance.

💡 Reference

Followed the pattern used in working test files like 00020-MandatesUsingNTIDProxy.cy.js, which implement this.skip() with proper connector inclusion checks.

Additional Changes

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

Motivation and Context

The test suite for Incremental Auth (00029-IncrementalAuth.cy.js) was being entirely skipped due to usage of describe.skip and context handling.

How did you test it?

Cybersource (Skipped) ArchiPEL
image image

Sanity

Stripe Adyen Bluesnap Bank of America
image image image image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

Copy link

semanticdiff-com bot commented Jul 9, 2025

@arindam-sahoo arindam-sahoo self-assigned this Jul 9, 2025
@arindam-sahoo arindam-sahoo added the A-CI-CD Area: Continuous Integration/Deployment label Jul 9, 2025
@arindam-sahoo arindam-sahoo added this to the Jul milestone Jul 9, 2025
@arindam-sahoo arindam-sahoo marked this pull request as ready for review July 9, 2025 18:33
@arindam-sahoo arindam-sahoo requested a review from a team as a code owner July 9, 2025 18:33
@@ -388,6 +388,7 @@ export const CONNECTOR_LISTS = {
// Inclusion lists (only run for these connectors)
INCLUDE: {
MANDATES_USING_NTID_PROXY: ["cybersource"],
INCREMENTAL_AUTH: ["cybersource"],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added INCREMENTAL_AUTH as a new list of connectors that supports Incremental Authorization.

In this PR, I am just creating the include list, so I'm not adding all the supporting connectors, but as of my knowledge, it should be archipel(which is addressed in my next PR #8189 ), cybersource and paypal (which will be merged soon after this PR I guess).

Comment on lines +3984 to +3987
.to.equal(
response.body.incremental_authorizations[key]
.previously_authorized_amount
).and.not.be.null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before After
Image Image

Comment on lines -23 to -27
beforeEach(function () {
if (!shouldContinue || connector !== "cybersource") {
this.skip();
}
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the Inclusion List in the Utils.js, so its not needed here.

Comment on lines 88 to 93
const newData = {
...data,
Request: { amount_to_capture: data.Request.amount_to_capture + 1000 },
};

cy.captureCallTest(fixtures.captureBody, newData, globalState);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was capturing the previously_authorized_amount, which resulted the terminal payment status to be partially_captured. Therefore, there were two options, either add a custom response assertion in the Capture config of the connector, or just update the value in the cypress test case itself, because it will be only the case for Incremental Auth only. So, found it more relevant to do it over here. However, the increased amount has been hard-coded to 1000.

@@ -388,6 +388,9 @@ export const CONNECTOR_LISTS = {
// Inclusion lists (only run for these connectors)
INCLUDE: {
MANDATES_USING_NTID_PROXY: ["cybersource"],
INCREMENTAL_AUTH: [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added INCREMENTAL_AUTH as a new list of connectors that supports Incremental Authorization.

In this PR, I am just creating the include list, so I'm not adding all the supporting connectors, but as of my knowledge, it should be archipel(which is addressed in my next PR #8189 ), cybersource and paypal (which will be merged soon after this PR I guess).

@@ -388,6 +388,9 @@ export const CONNECTOR_LISTS = {
// Inclusion lists (only run for these connectors)
INCLUDE: {
MANDATES_USING_NTID_PROXY: ["cybersource"],
INCREMENTAL_AUTH: [
// "cybersource" // issues with MULTIPLE_CONNECTORS handling
Copy link
Contributor Author

@arindam-sahoo arindam-sahoo Jul 10, 2025

Choose a reason for hiding this comment

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

Currently, I am thinking to comment out cybersource, so that the incremental auth tests skip for it, because it seems there are some issues handling MULTIPLE_CONNECTORS in cybersource, which is resulting in test cases failure for cybersource and hence it will block all the PRs, and prevent them from getting merged.

@arindam-sahoo arindam-sahoo changed the title refactor(cypress): refactor skip logic and test flow for cypress incremental auth tests refactor(cypress): update skip logic and test flow for cypress incremental auth tests Jul 10, 2025
likhinbopanna
likhinbopanna previously approved these changes Jul 10, 2025
Gnanasundari24
Gnanasundari24 previously approved these changes Jul 10, 2025
pixincreate
pixincreate previously approved these changes Jul 10, 2025
@arindam-sahoo arindam-sahoo dismissed stale reviews from pixincreate and Gnanasundari24 via 974e991 July 10, 2025 07:23
@Gnanasundari24 Gnanasundari24 enabled auto-merge July 10, 2025 11:32
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 11, 2025
Merged via the queue into main with commit 3c49871 Jul 11, 2025
14 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the chore/incremental-auth-cy branch July 11, 2025 02:04
pixincreate added a commit that referenced this pull request Jul 11, 2025
…ayload-webhooks

* 'main' of github.com:juspay/hyperswitch:
  feat(payments): propagate additional payment method data for apple pay during MIT (#7170)
  feat(core): Hyperswitch <|> UCS integration v2 (#8439)
  feat(connector): [payload] add webhook support (#8558)
  ci(cypress): Added Dlocal Connector Test (#8362)
  feat(connector): [AIRWALLEX] - Added Paypal, Trustly, Klarna , Atome, Blik Payment Methods (#8475)
  refactor(cypress): update skip logic and test flow for cypress incremental auth tests (#8594)
  chore(version): 2025.07.11.0
  chore: address Rust 1.88.0 clippy lints (#8607)
  chore(version): 2025.07.10.0
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(cypress): cypress tests for incremental auth getting skipped for all connectors
4 participants