cy.type() can only accept a string or number. You passed in: 'undefined'
See original GitHub issueCurrent behavior:
When I try to get data form a Json file, this message shown. The question: Can I get text from a Json file?
Desired behavior:
I Need to insert this data (that the Json file have) in the text area
Steps to reproduce: (app code and test code)
Test
beforeEach(() => {
cy.server()
cy.fixture("licencia.json").then((data) => {
cy.route('GET', 'licencia.json', data)
})
it.only('POST - Add License', function () {
cy.get('[id=operations-License-Post]').children('div').click()
.get('button').contains('Try it out').click()
cy.get('textarea').clear()
.get('textarea').type(this.data)
** Json Example/format**
{
"nombres": "Pulga",
"apellido": "Rodriguez",
"tipoDocumento": "NOT_DEFINED",
"fechaNacimiento": "1986-08-10T17:40:08.484Z",
"nroLicencia": "32001001",
"cuil": "20320010013",
"domicilio": "25 de mayo 1350",
"nacionalidad": "Argentino",
"sexo": "Masculino",
"grupoFactor": "0+",
"nroTramite": "251350",
"numeroInsumo": "string 1",
"fechaOtorgamiento": "2019-07-26T17:40:08.484Z",
"fechaRenovacion": "2019-07-26T17:40:08.484Z",
"fechaVencimiento": "2019-07-26T17:40:08.484Z",
"categoria": "A",
"clase": "1",
"restricciones": "ninguna",
"observaciones": "cinco",
"centroEmisor": "Las Talitas",
"donante": true,
"firmante": "Leito",
"estado": "Vigente"
}```
<!-- Issues without reproducible steps WILL BE CLOSED -->
<!-- You can fork https://github.com/cypress-io/cypress-test-tiny repo, set up a failing test, then tell us the repo/branch to try. -->
### Versions
<!-- Cypress, operating system, browser -->
win10
Chrome v75
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
CypressError: `cy.type()` can only accept a string or number ...
It's caused by sending undefined as a parameter to cy.type() , the error message does not lie (most likely anyway). I assume you...
Read more >cypress-io/cypress - Gitter
CypressError : cy.type() can only accept a String or Number. You passed in: 'undefined'. my code is the follwing: describe('Loops between given users', ......
Read more >type - Cypress Documentation
The text to be typed into the DOM element. Text passed to .type() may include any of the special character sequences below. These...
Read more >CypressError: `cy.type()` can only accept a string or number ...
Coding example for the question Docker and Cypress - CypressError: `cy.type()` can only accept a string or number. You passed in: `undefined`-docker.
Read more >Cypress Type Command - ProgramsBuzz
Text(String). Here comes the text to be typed into the DOM element. These characters will pass along the correct keyCode, key, and which...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
see https://github.com/cypress-io/cypress/issues/4287
so the JSON from the fixture is automatically parsed and converted into an object, right? You probably want to type it as text. This should do the trick