feat: refs #7220 vnlocation boilerplate
This commit is contained in:
parent
92d3880f24
commit
f831d4746c
|
@ -1,6 +1,6 @@
|
||||||
import { mount } from 'cypress/vue';
|
import { mount } from 'cypress/vue';
|
||||||
import { Quasar } from 'quasar';
|
import { Quasar } from 'quasar';
|
||||||
import Cypress from 'cypress';
|
import { i18n } from 'src/boot/i18n';
|
||||||
// ***********************************************
|
// ***********************************************
|
||||||
// This example commands.js shows you how to
|
// This example commands.js shows you how to
|
||||||
// create various custom commands and overwrite
|
// create various custom commands and overwrite
|
||||||
|
@ -26,12 +26,30 @@ import Cypress from 'cypress';
|
||||||
//
|
//
|
||||||
// -- This will overwrite an existing command --
|
// -- This will overwrite an existing command --
|
||||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||||
|
import { createTestingPinia } from '@pinia/testing';
|
||||||
|
const pinia = createTestingPinia({ createSpy: () => {}, stubActions: false });
|
||||||
|
|
||||||
Cypress.Commands.add('vnMount', (component, options = {}) => {
|
Cypress.Commands.add('vnMount', (component, options = {}) => {
|
||||||
const globalConfig = {
|
const globalConfig = {
|
||||||
global: {
|
global: {
|
||||||
plugins: [Quasar],
|
plugins: [Quasar, i18n, pinia],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
// options.global = options.global || {};
|
||||||
|
// options.global.stubs = options.global.stubs || {};
|
||||||
|
// options.global.stubs.transition = false;
|
||||||
|
// options.global.components = options.global.components || {};
|
||||||
|
// options.global.plugins = options.global.plugins || [];
|
||||||
|
|
||||||
|
// Use store passed in from options, or initialize a new one
|
||||||
|
// const { /* store = getStore(), */ ...mountOptions } = options;
|
||||||
|
|
||||||
|
// Add plugins here
|
||||||
|
// options.global.plugins.push({
|
||||||
|
// install(app) {
|
||||||
|
// app.use(i18n);
|
||||||
|
// },
|
||||||
|
// });
|
||||||
console.info(globalConfig);
|
console.info(globalConfig);
|
||||||
return mount(component, { ...globalConfig, ...options });
|
return mount(component, { ...globalConfig, ...options });
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
|
describe('<VnLocation />', () => {
|
||||||
|
it('renders', () => {
|
||||||
|
// see: https://on.cypress.io/mounting-vue
|
||||||
|
cy.vnMount(VnLocation, {
|
||||||
|
props: {
|
||||||
|
modelValue: 1234,
|
||||||
|
location: {
|
||||||
|
postcode: '46600',
|
||||||
|
city: ' Alz',
|
||||||
|
province: { name: 'as' },
|
||||||
|
country: { name: 'asdq' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue