I am trying to write a tests using Cypress.I have extracted some common steps to not repeat myself in the tests.I have done it like this:
Directory Tree
├── LoginForm
│ ├── helpers
│ │ └── fillLoginForm.js
│ └── redirection.spec.js
fillLoginForm content
export default () => {
return new Promise((resolve, reject) => {
let submitForm = () => {
cy.get('[data-test=btn]').click()
}
cy.get('[data-test=id_field]').type(id, {force:true}).then(() => {
cy.wait(500)
resolve({submitForm})
})
})
}
redirection.spec content
describe('Test', () => {
it('Test', () => {
cy.visit('page')
fillLoginForm().then(({ submitForm }) => {
submitForm()
},reject)
})
})
Test run output
I find it strange because the test is working on Chrome 69.But when i run it in Electron 59 it does not work.
Why triggering does not work from imported function but when i copy paste the code to the scope of the test it is working?

Aucun commentaire:
Enregistrer un commentaire