cypress-component-testing-examples
cypress-component-testing-examples copied to clipboard
Fixing Vue 2 + Vuetify project by adding custom mount command
👋🏻 the solution for projects that have global plugins for Vue 2 is to create a wrapper component. You'll also notice that the usage of .vue() to get the emitted events is unnecessary and I would discourage that pattern in favor of using cy.spy().as('myFunctionAlias') and asserting the spy was called.
cy.mount(MyComponent, { listeners: { 'action-btn:clicked': cy.spy().as('onActionButtonClicked') } } )
.get('button').click()
.get('@onActionButtonClicked').should('have.been.called')