I am trying to follow the following code from the Cypress documentation.
cy.origin(
'supersecurelogons.com',
// Send the args here...
{ args: sentArgs },
// ...and receive them at the other end here!
({ username, password }) => {
cy.visit('/login')
cy.get('input#username').type(username)
cy.get('input#password').type(password)
cy.contains('button', 'Login').click()
}
)
The code that I am using is below. My problem is that both pathname
& search
are undefined, this means that the visit command is failing.
I was wondering what it is that I am doing wrong here, any help gratefully received.
const workaroundUrl = new URL('https://www.validurl.com/pathname?search=true');
const url = { pathname: workaroundUrl.pathname, search: workaroundUrl.search }
cy.origin(workaroundUrl.origin, { args: { url } }, ({ pathname, search }) => {
cy.visit(pathname + search);
});
I am using v10.4.0.