2

Currently I have my Cypress code writing out an email verification code to the log.

Cypress Runner Log

Dev Tools Console

I need to take the six numbers from this value, to be inserted into a text field as a string.

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

I cannot pass the object into 'type' because it can only be a string or number.

Is there a way to take out the number element from the log to be used in the placeholderText part of the code I currently have?

kegne
  • 583
  • 1
  • 8
D0nKEYKon9
  • 47
  • 4

1 Answers1

3

It looks like email.text.codes[0] yields an object with one key (of value). So I think we'll just need to access that value field.

cy.get('foo')
  .type(email.text.codes[0].value);
agoff
  • 5,818
  • 1
  • 7
  • 20