From 1a662b222ba220202180ab6fa34dd60e72fd0068 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 16 Apr 2024 14:13:44 +0200 Subject: [PATCH 1/3] feat(lilium) #7220 VnTitle example --- cypress/support/commands.js | 25 ++++++++++++++++++++ cypress/support/component-index.html | 12 ++++++++++ cypress/support/component.js | 27 ++++++++++++++++++++++ test/cypress/integration/common/VnTitle.js | 15 ++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 cypress/support/commands.js create mode 100644 cypress/support/component-index.html create mode 100644 cypress/support/component.js create mode 100644 test/cypress/integration/common/VnTitle.js diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 000000000..66ea16ef0 --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,25 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add('login', (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) \ No newline at end of file diff --git a/cypress/support/component-index.html b/cypress/support/component-index.html new file mode 100644 index 000000000..ac6e79fd8 --- /dev/null +++ b/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/cypress/support/component.js b/cypress/support/component.js new file mode 100644 index 000000000..b091808fa --- /dev/null +++ b/cypress/support/component.js @@ -0,0 +1,27 @@ +// *********************************************************** +// This example support/component.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') + +import { mount } from 'cypress/vue' + +Cypress.Commands.add('mount', mount) + +// Example use: +// cy.mount(MyComponent) \ No newline at end of file diff --git a/test/cypress/integration/common/VnTitle.js b/test/cypress/integration/common/VnTitle.js new file mode 100644 index 000000000..45a49a698 --- /dev/null +++ b/test/cypress/integration/common/VnTitle.js @@ -0,0 +1,15 @@ +import VnTitle from '@/components/common/VnTitle.vue'; + +describe('', () => { + it('renders', () => { + // see: https://on.cypress.io/mounting-vue + cy.mount(VnTitle,{ + props:{ + url:'url', + title: 'title', + + } + }); + console.log(VnTitle); + }); +}); From 4d9fcbe23ff488d480254d0b4800df2c5d8ea47b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 16 Apr 2024 14:12:02 +0200 Subject: [PATCH 2/3] feat(lilium) #7220 config --- cypress.config.js | 7 +++++++ vite.config.js | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 vite.config.js diff --git a/cypress.config.js b/cypress.config.js index e2046d6c4..2388d293a 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -20,4 +20,11 @@ module.exports = defineConfig({ // implement node event listeners here }, }, + + component: { + devServer: { + framework: 'vue', + bundler: 'vite', + }, + }, }); diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 000000000..69726edd9 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,14 @@ +import { fileURLToPath, URL } from 'url'; + +import { defineConfig } from 'vite'; +import vue from '@vitejs/plugin-vue'; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [vue()], + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)), + }, + }, +}); From 112f33fb1b55a674eac479fe5187fb3fa0a2eda4 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 28 May 2024 11:38:09 +0200 Subject: [PATCH 3/3] updates --- cypress.config.js | 1 + src/components/CreateBankEntityForm.vue | 4 ++-- src/components/FormModel.vue | 4 ++-- src/components/FormModelPopup.vue | 2 +- test/cypress/components/CreateBankEntityForm.spec.js | 8 ++++++++ test/cypress/components/VnSelect.spec.js | 8 ++++++++ .../common/VnTitle.js => components/VnTitle.spec.js} | 11 +++++------ vite.config.js | 2 +- 8 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 test/cypress/components/CreateBankEntityForm.spec.js create mode 100644 test/cypress/components/VnSelect.spec.js rename test/cypress/{integration/common/VnTitle.js => components/VnTitle.spec.js} (56%) diff --git a/cypress.config.js b/cypress.config.js index 2388d293a..251b18758 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -22,6 +22,7 @@ module.exports = defineConfig({ }, component: { + specPattern: 'test/cypress/components/*.spec.js', devServer: { framework: 'vue', bundler: 'vite', diff --git a/src/components/CreateBankEntityForm.vue b/src/components/CreateBankEntityForm.vue index b2c5226e6..038a8f2df 100644 --- a/src/components/CreateBankEntityForm.vue +++ b/src/components/CreateBankEntityForm.vue @@ -4,8 +4,8 @@ import { useI18n } from 'vue-i18n'; import VnInput from 'src/components/common/VnInput.vue'; import VnSelect from 'src/components/common/VnSelect.vue'; -import FetchData from 'components/FetchData.vue'; -import VnRow from 'components/ui/VnRow.vue'; +import FetchData from 'src/components/FetchData.vue'; +import VnRow from 'src/components/ui/VnRow.vue'; import FormModelPopup from './FormModelPopup.vue'; defineProps({ showEntityField: { type: Boolean, default: true } }); diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 2c2acb61c..b8e97bf36 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -5,10 +5,10 @@ import { onBeforeRouteLeave } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { useQuasar } from 'quasar'; import { useState } from 'src/composables/useState'; -import { useStateStore } from 'stores/useStateStore'; +import { useStateStore } from 'src/stores/useStateStore'; import { useValidator } from 'src/composables/useValidator'; import useNotify from 'src/composables/useNotify.js'; -import SkeletonForm from 'components/ui/SkeletonForm.vue'; +import SkeletonForm from 'src/components/ui/SkeletonForm.vue'; import VnConfirm from './ui/VnConfirm.vue'; import { tMobile } from 'src/composables/tMobile'; diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index 25213a8b7..0ce702ff7 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -2,7 +2,7 @@ import { ref, computed } from 'vue'; import { useI18n } from 'vue-i18n'; -import FormModel from 'components/FormModel.vue'; +import FormModel from 'src/components/FormModel.vue'; const emit = defineEmits(['onDataSaved']); diff --git a/test/cypress/components/CreateBankEntityForm.spec.js b/test/cypress/components/CreateBankEntityForm.spec.js new file mode 100644 index 000000000..0248c9546 --- /dev/null +++ b/test/cypress/components/CreateBankEntityForm.spec.js @@ -0,0 +1,8 @@ +import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue'; + +describe('', () => { + it('renders', () => { + // see: https://on.cypress.io/mounting-vue + cy.mount(CreateBankEntityForm); + }); +}); diff --git a/test/cypress/components/VnSelect.spec.js b/test/cypress/components/VnSelect.spec.js new file mode 100644 index 000000000..ec0eebec9 --- /dev/null +++ b/test/cypress/components/VnSelect.spec.js @@ -0,0 +1,8 @@ +import VnSelect from 'src/components/common/VnSelect.vue'; + +describe('', () => { + it('renders', () => { + // see: https://on.cypress.io/mounting-vue + cy.mount(VnSelect); + }); +}); diff --git a/test/cypress/integration/common/VnTitle.js b/test/cypress/components/VnTitle.spec.js similarity index 56% rename from test/cypress/integration/common/VnTitle.js rename to test/cypress/components/VnTitle.spec.js index 45a49a698..72154348e 100644 --- a/test/cypress/integration/common/VnTitle.js +++ b/test/cypress/components/VnTitle.spec.js @@ -1,14 +1,13 @@ -import VnTitle from '@/components/common/VnTitle.vue'; +import VnTitle from 'src/components/common/VnTitle.vue'; describe('', () => { it('renders', () => { // see: https://on.cypress.io/mounting-vue - cy.mount(VnTitle,{ - props:{ - url:'url', + cy.mount(VnTitle, { + props: { + url: 'url', title: 'title', - - } + }, }); console.log(VnTitle); }); diff --git a/vite.config.js b/vite.config.js index 69726edd9..be4fba284 100644 --- a/vite.config.js +++ b/vite.config.js @@ -8,7 +8,7 @@ export default defineConfig({ plugins: [vue()], resolve: { alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), + src: fileURLToPath(new URL('./src', import.meta.url)), }, }, });