test(cypress): add network failure regression tests and card fixtures#1428
Open
test(cypress): add network failure regression tests and card fixtures#1428
Conversation
Adds fully mocked network failure tests covering SDK error handling regressions from PRs #1375 (wrong complete value after failure), #1389 (SDK auth header truncation), and #1340 (missing confirm headers). Also adds stripeSpecialCards, givexGiftCardDetails, achBankTransferDetails, and pixTransferDetails fixtures to cards.ts for use by upcoming test PRs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Changed Files
|
Contributor
🔍 Code Review by opencodeStatus: ✅ Approved 📋 SummaryAdds network failure regression tests and new payment method fixtures for Cypress E2E testing.
✅ What's Excellent
🔍 Test Coverage AnalysisPayment Confirm Errors (4 tests):
Payment Methods Errors (2 tests):
Header Regressions (2 tests):
💡 Minor Suggestions (Non-blocking)1. Expiry Input Typing (Lines 69-72, 108-111, 156-159, 224-227) // Current pattern (repeated 4x):
.type(card_exp_month);
.type(card_exp_year);
// Better:
.type(`${card_exp_month}${card_exp_year}`);2. Consider extracting common setup: const fillCardDetails = (card) => {
getIframeBody().find(`[data-testid=${testIds.cardNoInputTestId}]`).type(card.cardNo);
getIframeBody().find(`[data-testid=${testIds.expiryInputTestId}]`).type(`${card.card_exp_month}${card.card_exp_year}`);
getIframeBody().find(`[data-testid=${testIds.cardCVVInputTestId}]`).type(card.cvc);
};🎯 Regression Coverage Verification
All regressions are properly covered with specific assertions. Verificationnpm run re:build # ✅ Passes
npm run test:hooks # ✅ PassesNext Steps
This PR is ready to merge - excellent test coverage for critical error handling paths. Reviewed by opencode AI using hyperswitch-web skill guidelines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Adds fully mocked network failure tests covering SDK error handling regressions from PRs #1375 (wrong complete value after failure), #1389 (SDK auth header truncation), and #1340 (missing confirm headers). Also adds stripeSpecialCards, givexGiftCardDetails, achBankTransferDetails, and pixTransferDetails fixtures to cards.ts for use by upcoming test PRs.
Key Changes
network-failure-e2e-test.cy.ts — 7 new tests covering SDK error handling across three describe blocks
cards.ts — 4 new fixture exports: stripeSpecialCards, givexGiftCardDetails, achBankTransferDetails, pixTransferDetails (used by PRs adding Klarna, ACH, PIX, and Gift Card tests)
Regressions Covered
PR #1375 — Wrong complete value triggered after payment failure; verified submit re-enables after 402/500 confirm response
PR #1389 — SDK authorization header truncation causing silent failures; verified api-key header is present and starts with pk_
PR #1340 — Incorrect headers on confirm call in V2; verified Content-Type: application/json and non-empty api-key
Test Scenarios
Payment Confirm API Errors
Payment Methods API Errors
Header Regression Tests
How did you test it?
All 7 tests run headlessly via cypress run --spec cypress/e2e/network-failure-e2e-test.cy.ts
Checklist
npm run re:build