test(cypress): add auth_code population coverage for checkout - #13741
test(cypress): add auth_code population coverage for checkout#13741HS-QUALIBOT wants to merge 5 commits into
Conversation
- 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>
Changed Files
|
| "automatic", | ||
| globalState | ||
| ).then((response) => { | ||
| expect( |
There was a problem hiding this comment.
Add these assertions in the commands.js file only
| cy.task("cli_log", "Skipping step: Retrieve Payment"); | ||
| return; | ||
| } | ||
| const data = getConnectorDetails(globalState.get("connectorId"))[ |
There was a problem hiding this comment.
verify the auth_code in the existing configs
| ); | ||
|
|
||
| context( | ||
| "Card-NoThreeDS Manual Capture - auth_code population and persistence through capture", |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Is auth code will be different everytime?
Why this condition added only for checkout?
There was a problem hiding this comment.
Yes auth code will be unique , and other connector will not send the auth code
Type of Change
Description
This PR adds a new Cypress spec
57-AuthCodePopulation.cy.jscovering theauth_codefield population for the Checkout connector. The spec includes two test cases: an auto-capture happy path that verifiesauth_codeis populated after payment confirmation and persisted on retrieval, and a manual-capture edge case that verifiesauth_codesurvives the capture flow. Supporting config changes add anAuthCodekey toCheckout.jsand registerAUTH_CODE: ["checkout"]inCONNECTOR_LISTS.INCLUDEinUtils.js.Additional Changes
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_codefield from the Checkout connector-response for card, Google Pay, and Apple Pay payments. Without this coverage, a regression inauth_codepopulation would go undetected.Related upstream PR: #13669
How did you test it?
Full regression suite was executed against the changed connector(s). All
RUNNER_RESULTblocks from the QA pipeline are included verbatim below.Changed-spec verification —
checkoutSummary
Checklist
cargo +nightly fmt --allcargo clippyCloses #13740
Related to #13669