[CYPRESS_FRAMEWORK] Pass custom-headers before making a request
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
functionor aconstat 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
requestthat is made in theCypress.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.
Hi @pixincreate , I would like to work on this issue. Please assign it to me.
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!
/assign
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.
hello @pixincreate @neerajkumar-n @gorakhnathy7 I am working on this can you please assign this issue to me