Search code examples
javascripttestingcypresse2e-testingvee-validate

Cypress Error: [vee-validate] Validating a non-existent field: "#8". Use "attach()" first


I have simple test. All it does is providing data in input filed and send them:

  it('Try to change email', () => {

    cy.login({email: Cypress.env('basicemail'), password: Cypress.env('changepassword')})
    cy.wait(2500)
    cy.get('nav > .account-info > div > img').click()
    cy.get('aside > ul > :nth-child(5) > a').click()
    cy.wait(2500)

    cy.get('a').contains('Change email').click()

    cy.get('input[name="newEmail"]').clear().type(Cypress.env('changeemail'))
    cy.get('input[name="newEmailConfirm"]').clear().type(Cypress.env('changeemail'))
    cy.get('input[name="changeEmailPassword"]').clear().type(Cypress.env('changepassword'))

    cy.get('a').contains('Confirm').click()
    cy.get(':nth-child(5) > .settings-modal-wrapper > .button').click()

    // HERE IS ERROR
    cy.get('.modal-description').contains(`Email with confirmation link has been sent to ${Cypress.env('changeemail')}. Please follow instruction from the email.`)

    cy.get('.modal-header > img').click()
    cy.get('aside > ul > :nth-child(7) > a').click()
  })

And after it click the button, I get 3 those error:

Error: [vee-validate] Validating a non-existent field: "#8". Use "attach()" first.

Error: [vee-validate] Validating a non-existent field: "#9". Use "attach()" first.

Error: [vee-validate] Validating a non-existent field: "#10". Use "attach()" first.

Actually, I have no idea, what it means, I was trying to find it out, but there is no info on that.

Here is how it looks like in console:

enter image description here enter image description here


Solution

  • I have solved this problem. Actually it wasn't even about front, but about my API.

    The problem is cypress removes all from localStorage when visits other page, so I had to do some actions to save it in localStorage - login one more time.

    So, be careful with this, problem could be in API, not front.