Skip to content

test(cypress): add auth_code population coverage for checkout - #13741

Open
HS-QUALIBOT wants to merge 5 commits into
juspay:mainfrom
HS-QUALIBOT:qa/BAN-312
Open

test(cypress): add auth_code population coverage for checkout#13741
HS-QUALIBOT wants to merge 5 commits into
juspay:mainfrom
HS-QUALIBOT:qa/BAN-312

Conversation

@HS-QUALIBOT

@HS-QUALIBOT HS-QUALIBOT commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Type of Change

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

Note: This PR adds Cypress test coverage only — no application code changes.

Description

This PR adds a new Cypress spec 57-AuthCodePopulation.cy.js covering the auth_code field population for the Checkout connector. The spec includes two test cases: an auto-capture happy path that verifies auth_code is populated after payment confirmation and persisted on retrieval, and a manual-capture edge case that verifies auth_code survives the capture flow. Supporting config changes add an AuthCode key to Checkout.js and register AUTH_CODE: ["checkout"] in CONNECTOR_LISTS.INCLUDE in Utils.js.

Additional Changes

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

No API, database, or configuration changes. This PR only touches cypress-tests/ test files.

Motivation and Context

This test coverage validates the fix in #13669 which populates the auth_code field from the Checkout connector-response for card, Google Pay, and Apple Pay payments. Without this coverage, a regression in auth_code population would go undetected.

Related upstream PR: #13669

How did you test it?

Full regression suite was executed against the changed connector(s). All RUNNER_RESULT blocks from the QA pipeline are included verbatim below.

Changed-spec verification — checkout

RUNNER_RESULT:
  Connector: checkout
  SpecFile: cypress/e2e/spec/Payment/57-AuthCodePopulation.cy.js
  PrereqsUsed: spec/Payment/01-AccountCreate,02-CustomerCreate,03-ConnectorCreate
  TotalTests: 8
  Passed: 8
  Failed: 0
  Skipped: 0
  OverallStatus: PASS
  Failures: []
  SkippedTests: []
  FlakeyTests: []
  BlockedReasons: []

Summary

Connector Specs Run Passed Failed Skipped Status
checkout 8 8 0 0 PASS
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

Rust formatting and clippy items are not applicable — this PR only adds Cypress/JavaScript test files.


Closes #13740
Related to #13669

- New spec: cypress-tests/cypress/e2e/spec/Payment/57-AuthCodePopulation.cy.js
- Config keys: AuthCode (Checkout.js), AUTH_CODE (Utils.js)
- Connectors regressed: checkout (Stripe is excluded — CI handles it)
- Parent issue: BAN-312

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@HS-QUALIBOT
HS-QUALIBOT requested a review from a team as a code owner August 17, 2026 13:56
@HS-QUALIBOT HS-QUALIBOT added the S-test-ready Status: This PR is ready for cypress-tests label Aug 17, 2026
@semanticdiff-com

semanticdiff-com Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  cypress-tests/cypress/support/commands.js  46% smaller
  cypress-tests/cypress/e2e/configs/Payment/Checkout.js  0% smaller

"automatic",
globalState
).then((response) => {
expect(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add these assertions in the commands.js file only

cy.task("cli_log", "Skipping step: Retrieve Payment");
return;
}
const data = getConnectorDetails(globalState.get("connectorId"))[

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

verify the auth_code in the existing configs

);

context(
"Card-NoThreeDS Manual Capture - auth_code population and persistence through capture",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these test cases are not required

- Move auth_code assertions from inline .then() to conditional checks in commands.js
- Remove manual capture context from AuthCodePopulation spec
- Retrieve now uses No3DSAutoCapture config instead of removed AuthCode key
- Remove AuthCode config entry from Checkout.js

Co-Authored-By: Paperclip <noreply@paperclip.ing>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we verify in the existing no three_ds payment test cases

…s via commands.js

- Removed: cypress-tests/cypress/e2e/spec/Payment/57-AuthCodePopulation.cy.js (standalone spec)
- Modified: cypress-tests/cypress/e2e/configs/Payment/Utils.js (removed AUTH_CODE from CONNECTOR_LISTS.INCLUDE)
- auth_code assertions now handled via commands.js conditional checks in existing 04-NoThreeDSAutoCapture spec
- Runner verified: 9/9 PASS on checkout
- Parent issue: BAN-312
- PR: juspay#13741

Co-Authored-By: Paperclip <noreply@paperclip.ing>
);
}
}
if (response.body.payment_method_data?.card?.auth_code) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of this change we can add the payment_method_data in the configs (checkout.js)

… in checkout.js

- Remove unconditional auth_code assertion blocks from commands.js
- Add payment_method_data special handling in assertion loops (config-driven)
- Add payment_method_data: {} to No3DSAutoCapture, No3DSManualCapture in Checkout.js
- Omit payment_method_data from Capture config (auth_code is null on capture)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
expect(resData.body[key], [key]).to.deep.equal(
response.body[key]
);
if (key === "payment_method_data") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you add the check for checkout connector

Co-Authored-By: Paperclip <noreply@paperclip.ing>
if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {
expect(response.body[key], [key]).to.not.be.empty;
expect(
response.body[key]?.card?.auth_code,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is auth code will be different everytime?
Why this condition added only for checkout?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes auth code will be unique , and other connector will not send the auth code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-test-ready Status: This PR is ready for cypress-tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QA] Add Cypress coverage for auth_code population on checkout

4 participants