https://cypress.io logo
Hey guys, I've been banging my head in the wall wi...
# e2e-testing
r
Hey guys, I've been banging my head in the wall with
cy.origin
. My use case would be to iterate through several URLs in a JSON, visit each site and do the tests.
Copy code
const clients = {
    "urls": [
        {
            "siteurl": "http://google.com,
            "subpage": "/"
        },
        {
            "siteurl": "http://youtube.com,
            "subpage": "/"
        }
    ]
  };

  // cy.visit('/')
  it('tests', () => {
    clients.urls.forEach( client => {
  
      cy.origin(client.siteurl, () => {
        cy.visit(client.subpage);
        cy.get("body");  
      })

    });
  });
According to the Docs, you cannot directly pass variables into the
cy.origin
but is there any way of passing a url to it?