PandaMastr
PandaMastr

Reputation: 695

Cypress insert wrong data from JSON

I am experiencing quite an odd issue regarding Cypress testing . Everything is running smoothly in my test suites , but sometimes I am facing a weird behavior . When a I fetch a input field and insert something in it like :

cy.get('#input-column-start-date-0').type(testdata.customer.date.insert.first)

JSON test data :

 "testdata" : { 
    "customer" : {
      "date" : {
       "insert" : {
        "first" : "18-02-2020"
        ...
          }
        }
      }
    }

But the oddest thing is that sometimes Cypress is able to fill in the correct string and sometimes it skips some of the letters The result is like : "18-2-020"

So I ask myself am I doing something wrong ? Did I skipped something from Cypress documentation ? I just wonder , because this issue is really annoying . I would be very happy if someone give me a hand and resolve my issue here . Thanks .

Upvotes: 1

Views: 310

Answers (1)

user14783414
user14783414

Reputation:

Did you try increasing the delay option (delay after each keypress), which defaults to 10ms

cy.get('#input-column-start-date-0')
  .type(testdata.customer.date.insert.first, { delay: 100 })

Upvotes: 1

Related Questions