hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

[CYPRESS_FRAMEWORK] Pass custom-headers before making a request

Open pixincreate opened this issue 1 year ago • 2 comments

Description:

Cypress is the testing framework that Hyperswitch is using to run automated tests. Having good grip on Javascript to work on Cypress is a must. There are cases where one would have to pass additional headers when making a request. Cypress lacks that feature and the task is to add support for that.

Getting started:

Go through the README for guidelines on file structure, formatting and instructions on how to set up and run Cypress.

In short:

cd cypress-tests
npm ci

Possible implementation:

The main intention here is to have the optimal and efficient solution. An in-efficient solution can give an idea about implementing more optimal solution as well.

  • Introduce a new optional environment variable to State in order to read additional headers
  • Create a function or a const at the top of commands that reads the cypress environment variable, something like below:
    onst customHeaders = {
    // passed in Cypress.env, say `customHeader="x-merchant-id": merchant_id,`
    globalState.get(customHeader)
    ;
    
  • In every request that is made in the Cypress.Commands.add(), pass ...customHeaders,
  • This can be optimized by intercepting the request before it is made by leveraging cy.intercept() in e2e

Additional info:

  • Language: Javascript
  • Difficulty: Medium

Submission Process:

  • Ask the maintainers for assignment of the issue, you can request for assignment by commenting on the issue itself.
  • Once assigned, submit a pull request (PR).
  • Maintainers will review and provide feedback, if any.
  • Maintainers can unassign issues due to inactivity, read more here.

Refer here for Terms and conditions for the contest.

pixincreate avatar Sep 16 '24 16:09 pixincreate

Hi @pixincreate , I would like to work on this issue. Please assign it to me.

Ankesh2004 avatar Oct 01 '24 16:10 Ankesh2004

Thanks for your contribution @Ankesh2004! Just a quick note: please wait until your first two PRs are merged into the main branch before assigning a third one. This helps us keep track of changes and ensures everything is in order.

Looking forward to seeing your next PR once those are merged!

pixincreate avatar Oct 01 '24 17:10 pixincreate

/assign

absolutechy avatar Oct 11 '24 05:10 absolutechy

Hey @absolutechy

Kindly let us know, if you're still working on the issue? If you have any questions or need assistance, feel free to reach out in the community.

gorakhnathy7 avatar Oct 24 '24 06:10 gorakhnathy7

hello @pixincreate @neerajkumar-n @gorakhnathy7 I am working on this can you please assign this issue to me

PhantomInTheWire avatar Aug 31 '25 06:08 PhantomInTheWire