1

I currently have an email SMTP server that sends an email, that generates a URL.

I am able to get the contents of the URL from the email, but I want to then visit, or type this URL into the current Cypress address bar. Cypress Runner Log - URL Example

The code I have in Cypress looks like this. CypressExample.js

And the line of code related in the feature file looks like this. CypressExample.feature

When I run the Cypress code is get this error. CypressError

Is there anyway I can use this generated URL and insert it into the Cypress address bar?

Fody
  • 23,754
  • 3
  • 20
  • 37
D0nKEYKon9
  • 47
  • 4
  • try logging in `email.text.links[0].value`. As per your error this is not translating into a valid URL. – Alapan Das Jun 08 '22 at 16:05
  • Can you copy cy.mailosaurGetMessage custom command? Actually log would be more helpful to see what this command yielded exactly. I believe it returns/yields something but not what you want. – MiklosBalazsi Jun 08 '22 at 19:38

1 Answers1

1

The property you need is .href rather than .value

cy.mailosaurGetMessage(serverId, {
  sentTo: testEmail
}).then(email => {
  cy.visit(email.text.links[0].href)
})
Fody
  • 23,754
  • 3
  • 20
  • 37