I have a function that defines what market we should show to the user depending on their location.
We have different cypress tests for each market. In my cypress tests, I want to invoke the function that defines the market by passing a variable. So essentially:
const getMarket = (cypressParam: string) => {
console.log(cypressParam); <--- undefined
if (window.location.hostname === 'localhost' && cypressParam === "UK") {
return "UK";
}
...
But how do I do this in my cypress tests? How do I pass a param to the below?
cy.stub(utils, 'getMarket').withArgs('UK');
The param is undefined