Let's discuss further about this query
vue-btn isn't triggering on pressing the enter key
I have designed a sign-in page where users can log in by pressing 'Enter' on the keyboard. Now, I aim to perform a unit test that simulates pressing the enter key automatically logs in the user.
The snippet of the test code I'm working with is as follows:
describe('Login.vue', () => {
const vuetify = new Vuetify()
const store = new Vuex.Store({
actions: {
login: jest.fn()
}
})
const wrapper = mount(Login, { stubs: ['router-link', 'router-view'], store, vuetify })
it('logging in via enter key press', async () => {
wrapper.setData({ email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="abded8ced9ebced3cac6dbc7ce85c8c4c6">[email protected]</a>' })
wrapper.setData({ password: 'Passw0rd' })
await wrapper.vm.$nextTick()
wrapper.find('[data-cy="input-password"]').simulate('keypress', {key: 'Enter', keycode: 13})
})
})
Although I have conducted Integration Tests using Cypress successfully, I prefer to finalize unit testing before committing changes to the repository.