This is my first time using Cypress (and first SO post) and I keep running into an error. First, here is my code:
describe('Add new user to existing clinic team', () => {
const serverId = 'e6ar8r9c';
const testEmail = 'something@e6ar8r9c.mailosaur.net'
let confirmationLink
it('signs in as admin', () => {
cy.visit('******')
cy.get('#user_email').type('*******')
cy.get('#user_password').type('******')
cy.get('.button').click()
// show teams roster
cy.get('.hide-for-large > a > .fas').click()
cy.get('.vertical > :nth-child(1) > #programs-menu-btn > .fas').click()
// click into the clinic team
cy.get('table tbody > tr').contains('clinic team test apr 28#4').click()
// click into the user roster for the clinic team
cy.get('ul#program-team-tabs > li#team-icon-li').click()
// enter user email to be added
cy.get('#email').type(testEmail)
cy.get('button.non-button').click()
// get email
cy.mailosaurGetMessage(serverId, {
sentTo: testEmail
}).then(email => {
expect(email.subject).to.equal('Existing user invitation instructions');
cy.log(email.subject)
cy.log(email.html.links[0].href)
confirmationLink = email.html.links[0].href
})
// follow email link
cy.visit(confirmationLink)
})
})
When it logs the email link to the console, it logs the full URL of the link. However, it prints this error: "cy.visit() must be called with a url or an options object containing a url as its 1st argument" as if confirmationLink doesn't contain a URL, which, according to the console log, it does. Why is it not recognizing the URL?