feat(tests): add vue flow mount command

This commit is contained in:
braks
2022-10-07 22:55:38 +02:00
committed by Braks
parent 8928eb899b
commit dc30ef4805
+23
View File
@@ -24,6 +24,26 @@ import './commands'
// require('./commands')
import { mount } from 'cypress/vue'
import { VueFlow } from '@braks/vue-flow'
import type { FlowProps } from '@braks/vue-flow'
const mountVueFlow = (props?: FlowProps, attrs?: Record<string, any>) => {
cy.mount(VueFlow, {
props: {
id: 'test',
fitViewOnInit: true,
...props,
},
attrs: {
key: 'flowy',
style: {
height: '100vh',
width: '100vw',
},
...attrs,
},
})
}
// Augment the Cypress namespace to include type definitions for
// your custom command.
@@ -33,11 +53,14 @@ declare global {
namespace Cypress {
interface Chainable {
mount: typeof mount
vueFlow: typeof mountVueFlow
}
}
}
Cypress.Commands.add('mount', mount)
Cypress.Commands.add('vueFlow', mountVueFlow)
// Example use:
// cy.mount(MyComponent)