refined-shampoo-94690
08/02/2022, 2:09 PMcy.origin . My use case would be to iterate through several URLs in a JSON, visit each site and do the tests.
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?