hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

ci(cypress): fix Nuvei cypress test cases

Open ashx98 opened this issue 2 months ago • 2 comments

Type of Change

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

Description

Description

This PR fixes failing Nuvei connector Cypress tests by implementing proper 3DS redirect handling, adding required billing information, and optimizing timing configurations.

Changes

1. 3DS Redirect Handler (redirectionHandler.js)

Implemented Nuvei-specific 2-step authentication flow:

  • Step 1: Click "Success authentication" button (#btn1/#btn5)
  • Step 2: Wait for and click "Redirect" button to return to merchant
  • Uses element visibility checks with timeouts instead of arbitrary waits
  • Handles cross-origin redirects with cy.origin()
  • Follows same pattern as existing connectors (paysafe, airwallex, adyen)

2. Nuvei Configuration (Nuvei.js)

  • Billing Address: Added for manual capture flows (prevents authorization failures)
  • Timing Delays: 5s for capture/refund operations, 3s for void
  • Validation: Removed strict payment_method_data validation (Nuvei returns dynamic metadata)
  • Payment Methods: Omitted iDEAL and EPS (not implemented in connector)

3. Bank Redirect Test Handling (00018-BankRedirect.cy.js)

  • Added conditional skip for iDEAL and EPS tests when connector is Nuvei
  • Prevents test failures for unimplemented payment methods
  • Maintains test coverage for supported methods (Giropay, Sofort, Przelewy24)

Additional Changes

  • [x] This PR modifies test configuration files
  • [ ] This PR modifies the API contract
  • [ ] This PR modifies the database schema
  • [ ] This PR modifies application configuration/environment variables

Motivation and Context

Nuvei Cypress Tests were failing.

How did you test it?

image

Some Manual Capture Edge Cases:** May experience intermittent failures due to Nuvei sandbox sync issues

image Later fixed the Bank redirect tests failures by skipping tests for EPS and IDEAL as they are not implemented from the connector end.

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

ashx98 avatar Oct 17 '25 09:10 ashx98

Review changes with  SemanticDiff

Changed Files
File Status
  cypress-tests/cypress/support/redirectionHandler.js  5% smaller
  cypress-tests/cypress/e2e/configs/Payment/Nuvei.js  0% smaller

semanticdiff-com[bot] avatar Oct 17 '25 09:10 semanticdiff-com[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :warning: Please upload report for BASE (main@0a4b7ce). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9908   +/-   ##
=======================================
  Coverage        ?    3.89%           
=======================================
  Files           ?     1224           
  Lines           ?   303260           
  Branches        ?        0           
=======================================
  Hits            ?    11804           
  Misses          ?   291456           
  Partials        ?        0           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Oct 24 '25 12:10 codecov[bot]

Nuvei supports mandates right ? But why the mandates test cases are skipping ? can you please debug and fix it really works

likhinbopanna avatar Nov 07 '25 13:11 likhinbopanna