1

Got an issue with the cypress test cannot cover pincode functionality with the cypress test because I tried using cy.type() but got an error. My function to receive this element works when I check him for visibility but when I wanna type the pin code it failed with an error

pinCodeDigit() {return cy.get('[data-testid="pin-digit-0"]');}

How I use this In a test pinCodeDigit().type('1111');

`cy.type() failed because it requires a valid typeable element.

The element typed into was:

<div data-testid="pin-digit-0" class="_digit_1lwa4_26"></div>

A typeable element matches one of the following selectors: a[href] area[href] input select textarea button iframe [tabindex] [contenteditable]`

How can I put Pincode to pin-digit in cypress what method should I choose?

enter image description hereenter image description here

I tried to modify my function like this but nothing helped.

pinCodeDigit() {return cy.get('[data-testid="pin-digit-*"]'); }

Chloe
  • 139
  • 4
junozay
  • 11
  • 2
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Mar 14 '23 at 10:28

1 Answers1

3

It's possible that elements <div data-testid="pin-digit-0"> are only for displaying the digits as you type them, but there is another element in that block that accepts the typed digits.

Try searching for an <input>

cy.get('div[data-testid="check-pin"]`)
  .find('input')
  .type('1111')
user16695029
  • 3,365
  • 5
  • 21