1
I’m having a hard time understanding how form testing works with using Cypress.
I would like to test if the page form https://drbarakat.curseria.com/e-book
is redirecting to the page https://drbarakat.curseria.com/e-book/obrigado
.
So far, I was able to run the test, but I suspect that instead of giving Ubmit, Cypress simply "forces" a redirect, because when arriving at the second page (https://drbarakat.curseria.com/e-book/obrigado
) appears the following error:
chainers.split is not a Function
My test code so far is like this :
// <reference types="cypress" />
context('Actions', () => {
beforeEach(() => {
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
cy.visit('https://drbarakat.curseria.com/e-book', { force: true })
})
it('.submit() - submit a form', () => {
// https://on.cypress.io/submit
cy.get('#_form_95_')
.find('input[name="fullname"]').type('teste')
cy.get('#_form_95_')
.find('input[name="email"]').type('[email protected]')
cy.get('#_form_95_').submit()
.next().should(cy.visit('https://drbarakat.curseria.com/e-book/obrigado'))
})
})
Is he actually doing Ubmit successfully or is he simply forcing a redirect? I’ve never done any tests like this before.