I am trying to set up Cypress Component Testing for vuetify components. However, I do not get it working.
I narrowed it down to the most simple case with a static button. However I am getting Cannot read properties of undefined (reading 'props')
.
My Setup
// TestButton.vue
<template>
<v-btn>TestButton</v-btn>
</template>
// TestButton.cy.js
import TestButton from './TestButton.vue'
describe('<TestButton />', () => {
it('renders', () => {
cy.mount(TestButton)
})
})
//support/component.js - according https://docs.cypress.io/guides/component-testing/vue/examples#Replicating-the-expected-Component-Hierarchy
import './commands'
import Vuetify from 'vuetify/lib'
import { VApp } from 'vuetify'
import { mount } from 'cypress/vue2'
import { h } from 'vue'
const vuetifyOptions = {}
Cypress.Commands.add('mount', (component, ...args) => {
args.global = args.global || {}
args.global.plugins = args.global.plugins || []
args.global.plugins.push(new Vuetify(vuetifyOptions))
return mount(() => {
return h(VApp, {}, component)
}, ...args)
})
The example on cypress did not work for me, however I found a different setup. The below
support/component.js
works for me