Home > Net >  How to add query param in Cypress (JS)
How to add query param in Cypress (JS)

Time:05-25

I have to ask for help here. I'm still learning Cypress and trying to add query param to each URL and validate that some modal appears on the page when query param is added. So the way it looks:

urls = [ "/en/link1/", "/en/link2/", "/en/link3/", ]

queryParam = [ "?param1", "?param2", "?param3", ]

I need to write code that would do for me

  • /en/link1/?param1
  • /en/link2/?param1
  • /en/link3/?param1
  • checkCondition()
  • /en/link1/?param2
  • /en/link2/?param2
  • /en/link3/?param2
  • checkCondition()

and so on...

Could you please advise me how to do this? I'd rly appreciate any advice/link to material. Thanks a lot and happy coding!

CodePudding user response:

You can use cy.request version taking options as argument: Console Execution of js snippet

  • Related