Merge branch 'dev' into 7356_e2e
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Alex Moreno 2025-04-08 11:19:33 +00:00
commit d3b413fc25
110 changed files with 2602 additions and 2646 deletions

View File

@ -1,6 +0,0 @@
/dist
/src-capacitor
/src-cordova
/.quasar
/node_modules
.eslintrc.js

View File

@ -1,75 +0,0 @@
export default {
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
// This option interrupts the configuration hierarchy at this file
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
root: true,
parserOptions: {
ecmaVersion: '2021', // Allows for the parsing of modern ECMAScript features
},
env: {
node: true,
browser: true,
'vue/setup-compiler-macros': true,
},
// Rules order is important, please avoid shuffling them
extends: [
// Base ESLint recommended rules
'eslint:recommended',
// Uncomment any of the lines below to choose desired strictness,
// but leave only one uncommented!
// See https://eslint.vuejs.org/rules/#available-rules
// 'plugin:vue/vue3-essential', // Priority A: Essential (Error Prevention)
'plugin:vue/vue3-strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
// https://github.com/prettier/eslint-config-prettier#installation
// usage with Prettier, provided by 'eslint-config-prettier'.
'prettier',
],
plugins: [
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
// required to lint *.vue files
'vue',
// https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674
// Prettier has not been included as plugin to avoid performance impact
// add it as an extension for your IDE
],
globals: {
ga: 'readonly', // Google Analytics
cordova: 'readonly',
__statics: 'readonly',
__QUASAR_SSR__: 'readonly',
__QUASAR_SSR_SERVER__: 'readonly',
__QUASAR_SSR_CLIENT__: 'readonly',
__QUASAR_SSR_PWA__: 'readonly',
process: 'readonly',
Capacitor: 'readonly',
chrome: 'readonly',
},
// add your custom rules here
rules: {
'prefer-promise-reject-errors': 'off',
'no-unused-vars': 'warn',
'vue/no-multiple-template-root': 'off',
// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
overrides: [
{
files: ['test/cypress/**/*.*'],
extends: [
// Add Cypress-specific lint rules, globals and Cypress plugin
// See https://github.com/cypress-io/eslint-plugin-cypress#rules
'plugin:cypress/recommended',
],
},
],
};

3
.eslintrc.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": ["plugin:cypress/recommended"]
}

5
Jenkinsfile vendored
View File

@ -125,8 +125,10 @@ pipeline {
sh "docker-compose ${env.COMPOSE_PARAMS} pull db"
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
def modules = sh(script: 'node test/cypress/docker/find/find.js', returnStdout: true).trim()
echo "E2E MODULES: ${modules}"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh 'sh test/cypress/cypressParallel.sh 2'
sh "sh test/cypress/docker/cypressParallel.sh 1 '${modules}'"
}
}
}
@ -183,3 +185,4 @@ pipeline {
}
}
}

87
eslint.config.js Normal file
View File

@ -0,0 +1,87 @@
import cypress from 'eslint-plugin-cypress';
import eslint from 'eslint-plugin-import';
import globals from 'globals';
import js from '@eslint/js';
import vue from 'eslint-plugin-vue';
export default {
plugins: { vue, eslint, cypress },
languageOptions: {
globals: {
...globals.node,
...globals.browser,
...vue.configs['vue3-strongly-recommended'].globals,
...cypress.environments.globals.globals,
ga: 'readonly',
cordova: 'readonly',
__statics: 'readonly',
__QUASAR_SSR__: 'readonly',
__QUASAR_SSR_SERVER__: 'readonly',
__QUASAR_SSR_CLIENT__: 'readonly',
__QUASAR_SSR_PWA__: 'readonly',
process: 'readonly',
Capacitor: 'readonly',
chrome: 'readonly',
},
ecmaVersion: 2020,
sourceType: 'module',
parserOptions: {
parser: '@babel/eslint-parser',
},
},
rules: {
...vue.rules['flat/strongly-recommended'],
...js.configs.recommended.rules,
semi: 'off',
'generator-star-spacing': 'warn',
'arrow-parens': 'warn',
'no-var': 'error',
'prefer-const': 'error',
'prefer-template': 'warn',
'prefer-destructuring': 'off',
'prefer-spread': 'warn',
'prefer-rest-params': 'warn',
'prefer-object-spread': 'warn',
'prefer-arrow-callback': 'warn',
'prefer-numeric-literals': 'warn',
'prefer-exponentiation-operator': 'warn',
'prefer-regex-literals': 'warn',
'one-var': [
'error',
{
let: 'never',
const: 'never',
},
],
'no-void': 'off',
'prefer-promise-reject-errors': 'error',
'multiline-ternary': 'warn',
'no-restricted-imports': 'warn',
'no-import-assign': 'warn',
'no-duplicate-imports': 'warn',
'no-useless-rename': 'warn',
'eslint/no-named-as-default': 'warn',
'eslint/no-named-as-default-member': 'warn',
'no-unsafe-optional-chaining': 'warn',
'no-undef': 'error',
'no-unused-vars': 'error',
'no-console': 'error',
'no-debugger': 'error',
'no-useless-escape': 'error',
'no-prototype-builtins': 'error',
'no-async-promise-executor': 'error',
'no-irregular-whitespace': 'error',
'no-constant-condition': 'error',
'no-unsafe-finally': 'error',
'no-extend-native': 'error',
},
ignores: [
'/dist',
'/src-capacitor',
'/src-cordova',
'/.quasar',
'/node_modules',
'.eslintrc.js',
],
};

View File

@ -9,7 +9,8 @@
"type": "module",
"scripts": {
"resetDatabase": "cd ../salix && gulp docker",
"lint": "eslint --ext .js,.vue ./",
"lint": "eslint \"**/*.{vue,js}\" ",
"lint:fix": "eslint \"**/*.{vue,js}\" --fix ",
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
"test:e2e": "cypress open",
"test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run",
@ -31,38 +32,47 @@
"axios": "^1.4.0",
"chromium": "^3.0.3",
"croppie": "^2.6.5",
"es-module-lexer": "^1.6.0",
"fast-glob": "^3.3.3",
"moment": "^2.30.1",
"pinia": "^2.1.3",
"quasar": "^2.17.7",
"validator": "^13.9.0",
"vue": "^3.5.13",
"vue-i18n": "^9.3.0",
"vue-i18n": "^9.4.0",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.20.0",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@intlify/unplugin-vue-i18n": "^0.8.2",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.20.0",
"@intlify/unplugin-vue-i18n": "^4.0.0",
"@pinia/testing": "^0.1.2",
"@quasar/app-vite": "^2.0.8",
"@quasar/quasar-app-extension-qcalendar": "^4.0.2",
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
"@vue/compiler-sfc": "^3.5.13",
"@vue/test-utils": "^2.4.4",
"autoprefixer": "^10.4.14",
"cypress": "^14.1.0",
"cypress-mochawesome-reporter": "^3.8.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-vue": "^9.32.0",
"globals": "^16.0.0",
"husky": "^8.0.0",
"junit-merge": "^2.0.0",
"mocha": "^11.1.0",
"postcss": "^8.4.23",
"prettier": "^3.4.2",
"sass": "^1.83.4",
"vitepress": "^1.6.3",
"vitest": "^0.34.0",
"vitest": "^3.0.3",
"xunit-viewer": "^10.6.1"
},
"engines": {

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,7 @@ export default configure(function (/* ctx */) {
build: {
target: {
browser: ['es2022', 'edge88', 'firefox78', 'chrome87', 'safari13.1'],
node: 'node18',
node: 'node20',
},
vueRouterMode: 'hash', // available values: 'hash', 'history'
@ -92,6 +92,7 @@ export default configure(function (/* ctx */) {
vitePlugins: [
[
VueI18nPlugin({
strictMessage: false,
runtimeOnly: false,
include: [
path.resolve(__dirname, './src/i18n/locale/**'),

View File

@ -0,0 +1,227 @@
/* eslint-disable */
/**
* THIS FILE IS GENERATED AUTOMATICALLY.
* 1. DO NOT edit this file directly as it won't do anything.
* 2. EDIT the original quasar.config file INSTEAD.
* 3. DO NOT git commit this file. It should be ignored.
*
* This file is still here because there was an error in
* the original quasar.config file and this allows you to
* investigate the Node.js stack error.
*
* After you fix the original file, this file will be
* deleted automatically.
**/
// quasar.config.js
import { configure } from "quasar/wrappers";
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
import path from "path";
var __quasar_inject_dirname__ = "/home/jsegarra/Projects/salix-front";
var target = `http://${process.env.CI ? "back" : "localhost"}:3000`;
var quasar_config_default = configure(function() {
return {
eslint: {
// fix: true,
// include = [],
// exclude = [],
// rawOptions = {},
warnings: true,
errors: true
},
// https://v2.quasar.dev/quasar-cli/prefetch-feature
// preFetch: true,
// app boot file (/src/boot)
// --> boot files are part of "main.js"
// https://v2.quasar.dev/quasar-cli/boot-files
boot: ["i18n", "axios", "vnDate", "validations", "quasar", "quasar.defaults"],
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
css: ["app.scss"],
// https://github.com/quasarframework/quasar/tree/dev/extras
extras: [
// 'ionicons-v4',
// 'mdi-v5',
// 'fontawesome-v6',
// 'eva-icons',
// 'themify',
// 'line-awesome',
// 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
"roboto-font",
"material-icons-outlined",
"material-symbols-outlined"
],
// Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#build
build: {
target: {
browser: ["es2022", "edge88", "firefox78", "chrome87", "safari13.1"],
node: "node20"
},
vueRouterMode: "hash",
// available values: 'hash', 'history'
// vueRouterBase,
// vueDevtools,
// vueOptionsAPI: false,
// rebuildCache: true, // rebuilds Vite/linter/etc cache on startup
// publicPath: '/',
// analyze: true,
// env: {},
rawDefine: {
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
},
// ignorePublicFolder: true,
// minify: false,
// polyfillModulePreload: true,
// distDir
extendViteConf(viteConf) {
delete viteConf.build.polyfillModulePreload;
viteConf.build.modulePreload = {
polyfill: false
};
},
// viteVuePluginOptions: {},
alias: {
composables: path.join(__quasar_inject_dirname__, "./src/composables"),
filters: path.join(__quasar_inject_dirname__, "./src/filters")
},
vitePlugins: [
[
VueI18nPlugin({
strictMessage: false,
runtimeOnly: false,
include: [
path.resolve(__quasar_inject_dirname__, "./src/i18n/locale/**"),
path.resolve(__quasar_inject_dirname__, "./src/pages/**/locale/**")
]
})
]
]
},
// Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#devServer
devServer: {
server: {
type: "http"
},
proxy: {
"/api": {
target,
logLevel: "debug",
changeOrigin: true,
secure: false
}
},
open: false,
allowedHosts: [
"front",
// Agrega este nombre de host
"localhost"
// Opcional, para pruebas locales
]
},
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework
framework: {
config: {
config: {
dark: "auto"
}
},
lang: "en-GB",
// iconSet: 'material-icons', // Quasar icon set
// lang: 'en-US', // Quasar language pack
// For special cases outside of where the auto-import strategy can have an impact
// (like functional components as one of the examples),
// you can manually specify Quasar components/directives to be available everywhere:
//
// components: [],
// directives: [],
// Quasar plugins
plugins: ["Notify", "Dialog"],
all: "auto",
autoImportComponentCase: "pascal"
},
// animations: 'all', // --- includes all animations
// https://v2.quasar.dev/options/animations
animations: [],
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#property-sourcefiles
// sourceFiles: {
// rootComponent: 'src/App.vue',
// router: 'src/router/index',
// store: 'src/store/index',
// registerServiceWorker: 'src-pwa/register-service-worker',
// serviceWorker: 'src-pwa/custom-service-worker',
// pwaManifestFile: 'src-pwa/manifest.json',
// electronMain: 'src-electron/electron-main',
// electronPreload: 'src-electron/electron-preload'
// },
// https://v2.quasar.dev/quasar-cli/developing-ssr/configuring-ssr
ssr: {
// ssrPwaHtmlFilename: 'offline.html', // do NOT use index.html as name!
// will mess up SSR
// extendSSRWebserverConf (esbuildConf) {},
// extendPackageJson (json) {},
pwa: false,
// manualStoreHydration: true,
// manualPostHydrationTrigger: true,
prodPort: 3e3,
// The default port that the production server should use
// (gets superseded if process.env.PORT is specified at runtime)
middlewares: [
"render"
// keep this as last one
]
},
// https://v2.quasar.dev/quasar-cli/developing-pwa/configuring-pwa
pwa: {
workboxMode: "generateSW",
// or 'injectManifest'
injectPwaMetaTags: true,
swFilename: "sw.js",
manifestFilename: "manifest.json",
useCredentialsForManifestTag: false
// useFilenameHashes: true,
// extendGenerateSWOptions (cfg) {}
// extendInjectManifestOptions (cfg) {},
// extendManifestJson (json) {}
// extendPWACustomSWConf (esbuildConf) {}
},
// Full list of options: https://v2.quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova
cordova: {
// noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing
},
// Full list of options: https://v2.quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor
capacitor: {
hideSplashscreen: true
},
// Full list of options: https://v2.quasar.dev/quasar-cli/developing-electron-apps/configuring-electron
electron: {
// extendElectronMainConf (esbuildConf)
// extendElectronPreloadConf (esbuildConf)
inspectPort: 5858,
bundler: "packager",
// 'packager' or 'builder'
packager: {
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options
// OS X / Mac App Store
// appBundleId: '',
// appCategoryType: '',
// osxSign: '',
// protocol: 'myapp://path',
// Windows only
// win32metadata: { ... }
},
builder: {
// https://www.electron.build/configuration/configuration
appId: "salix-frontend"
}
},
// Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-browser-extensions/configuring-bex
bex: {
contentScripts: ["my-content-script"]
// extendBexScriptsConf (esbuildConf) {}
// extendBexManifestJson (json) {}
}
};
});
export {
quasar_config_default as default
};

View File

@ -9,6 +9,30 @@ vi.mock('src/composables/useSession', () => ({
}),
}));
// Mock axios
vi.mock('axios', () => ({
default: {
create: vi.fn(() => ({
interceptors: {
request: { use: vi.fn() },
response: { use: vi.fn() },
},
})),
interceptors: {
request: { use: vi.fn() },
response: { use: vi.fn() },
},
defaults: {
baseURL: '',
},
},
}));
vi.mock('src/router', () => ({
Router: {
push: vi.fn(),
},
}));
vi.mock('src/stores/useStateQueryStore', () => ({
useStateQueryStore: () => ({
add: () => vi.fn(),
@ -29,7 +53,7 @@ describe('Axios boot', () => {
'Accept-Language': 'en-US',
Authorization: 'DEFAULT_TOKEN',
},
})
}),
);
});
});

View File

@ -1,3 +1,4 @@
/* eslint-disable eslint/export */
export * from './defaults/qTable';
export * from './defaults/qInput';
export * from './defaults/qSelect';

View File

@ -19,6 +19,7 @@ import { useQuasar, date } from 'quasar';
import { useStateStore } from 'stores/useStateStore';
import { useFilterParams } from 'src/composables/useFilterParams';
import { dashIfEmpty, toDate } from 'src/filters';
import { useTableHeight } from './filters/useTableHeight';
import CrudModel from 'src/components/CrudModel.vue';
import FormModelPopup from 'components/FormModelPopup.vue';
@ -117,7 +118,7 @@ const $props = defineProps({
},
tableHeight: {
type: String,
default: '90vh',
default: undefined,
},
footer: {
type: Boolean,
@ -166,6 +167,7 @@ const tableRef = ref();
const params = ref(useFilterParams($attrs['data-key']).params);
const orders = ref(useFilterParams($attrs['data-key']).orders);
const app = inject('app');
const tableHeight = useTableHeight();
const editingRow = ref(null);
const editingField = ref(null);
@ -678,7 +680,7 @@ const rowCtrlClickFunction = computed(() => {
table-header-class="bg-header"
card-container-class="grid-three"
flat
:style="isTableMode && `max-height: ${tableHeight}`"
:style="isTableMode && `max-height: ${$props.tableHeight || tableHeight}`"
:virtual-scroll="isTableMode"
@virtual-scroll="handleScroll"
@row-click="(event, row) => handleRowClick(event, row)"

View File

@ -1,8 +1,7 @@
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
import { createWrapper } from 'app/test/vitest/helper';
import VnVisibleColumn from '../VnVisibleColumn.vue';
import { axios } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
describe('VnVisibleColumns', () => {
let wrapper;
let vm;

View File

@ -0,0 +1,18 @@
import { onMounted, nextTick, ref } from 'vue';
export function useTableHeight() {
const tableHeight = ref('90vh');
onMounted(async () => {
await nextTick();
let height = 100;
Array.from(document.querySelectorAll('[role="toolbar"]'))
.filter((element) => window.getComputedStyle(element).display !== 'none')
.forEach(() => {
height -= 10;
});
tableHeight.value = `${height}vh`;
});
return tableHeight;
}

View File

@ -1,4 +1,6 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import CrudModel from 'components/CrudModel.vue';
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';

View File

@ -1,4 +1,5 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import EditForm from 'components/EditTableCellValueForm.vue';
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';

View File

@ -1,4 +1,6 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import FilterItemForm from 'src/components/FilterItemForm.vue';
import { vi, beforeAll, describe, expect, it } from 'vitest';
@ -38,9 +40,9 @@ describe('FilterItemForm', () => {
{ relation: 'producer', scope: { fields: ['name'] } },
{ relation: 'ink', scope: { fields: ['name'] } },
],
where: {"name":{"like":"%bolas de madera%"}},
where: { name: { like: '%bolas de madera%' } },
};
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
params: { filter: JSON.stringify(expectedFilter) },
});
@ -79,4 +81,4 @@ describe('FilterItemForm', () => {
vm.selectItem({ id: 12345 });
expect(wrapper.emitted('itemSelected')[0]).toEqual([12345]);
});
});
});

View File

@ -1,5 +1,7 @@
import { describe, expect, it, beforeAll, vi, afterAll } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import FormModel from 'src/components/FormModel.vue';
describe('FormModel', () => {

View File

@ -1,6 +1,7 @@
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import Leftmenu from 'components/LeftMenu.vue';
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
import { default as axios } from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import LeftMenu from 'components/LeftMenu.vue';
import * as vueRouter from 'vue-router';
import { useNavigationStore } from 'src/stores/useNavigationStore';
@ -101,7 +102,7 @@ function mount(source = 'main') {
vi.spyOn(axios, 'get').mockResolvedValue({
data: [],
});
const wrapper = createWrapper(Leftmenu, {
const wrapper = createWrapper(LeftMenu, {
propsData: {
source,
},
@ -164,7 +165,7 @@ describe('getRoutes', () => {
});
});
describe('Leftmenu as card', () => {
describe('LeftMenu as card', () => {
beforeAll(() => {
vm = mount('card').vm;
});
@ -173,7 +174,7 @@ describe('Leftmenu as card', () => {
vm.getRoutes();
});
});
describe('Leftmenu as main', () => {
describe('LeftMenu as main', () => {
beforeEach(() => {
vm = mount().vm;
});

View File

@ -60,7 +60,7 @@ async function confirm() {
v-model="address"
is-outlined
autofocus
data-cy="SendEmailNotifiactionDialogInput"
data-cy="SendEmailNotificationDialogInput"
/>
</QCardSection>
<QCardActions align="right">

View File

@ -219,6 +219,7 @@ function filterByRecord(modelLog) {
}
async function applyFilter(params = {}) {
paginate.value.arrayData.resetPagination();
paginate.value.arrayData.applyFilter({
filter: {},
params: { originFk: route.params.id, ...params },

View File

@ -10,6 +10,7 @@ import { useFilterParams } from 'src/composables/useFilterParams';
import FetchData from '../FetchData.vue';
import { useValidator } from 'src/composables/useValidator';
import { useCapitalize } from 'src/composables/useCapitalize';
import VnAvatar from '../ui/VnAvatar.vue';
const $props = defineProps({
dataKey: {
@ -99,7 +100,6 @@ function getActions() {
:columns="columns"
:redirect="false"
:hiddenTags="['originFk', 'creationDate']"
:exprBuilder
search-url="logs"
:showTagChips="false"
>

View File

@ -1,4 +1,5 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
import { vi, beforeEach, afterEach, beforeAll, describe, expect, it } from 'vitest';
import { Notify } from 'quasar';

View File

@ -1,4 +1,5 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
import VnDms from 'src/components/common/VnDms.vue';
@ -40,7 +41,10 @@ describe('VnDms', () => {
companyFk: 2,
dmsTypeFk: 3,
description: 'This is a test description',
files: { name: 'example.txt', content: new Blob(['file content'], { type: 'text/plain' })},
files: {
name: 'example.txt',
content: new Blob(['file content'], { type: 'text/plain' }),
},
};
const expectedBody = {
@ -59,7 +63,7 @@ describe('VnDms', () => {
url: '/test',
formInitialData: { id: 1, reference: 'test' },
model: 'Worker',
}
},
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
@ -98,7 +102,7 @@ describe('VnDms', () => {
expect(vm.getUrl()).toBe('/test');
});
it('should returns url dms/"props.formInitialData.id"/updateFile when prop url is null', async () => {
it('should returns url dms/"props.formInitialData.id"/updateFile when prop url is null', async () => {
await wrapper.setProps({ url: null });
expect(vm.getUrl()).toBe('dms/1/updateFile');
});
@ -113,7 +117,9 @@ describe('VnDms', () => {
describe('save', () => {
it('should save data correctly', async () => {
await vm.save();
expect(postMock).toHaveBeenCalledWith(vm.getUrl(), expect.any(FormData), { params: expectedBody });
expect(postMock).toHaveBeenCalledWith(vm.getUrl(), expect.any(FormData), {
params: expectedBody,
});
expect(wrapper.emitted('onDataSaved')).toBeTruthy();
});
});
@ -127,8 +133,8 @@ describe('VnDms', () => {
warehouseFk: 2,
companyFk: 3,
dmsTypeFk: 2,
description: 'This is a test description'
}
description: 'This is a test description',
};
await wrapper.setProps({ formInitialData: testData });
vm.defaultData();
@ -137,10 +143,10 @@ describe('VnDms', () => {
it('should add reference with "route.params.id" to dms if formInitialData is null', async () => {
await wrapper.setProps({ formInitialData: null });
vm.route.params.id= '111';
vm.route.params.id = '111';
vm.defaultData();
expect(vm.dms.reference).toBe('111');
});
});
});
});

View File

@ -1,4 +1,6 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import VnDmsList from 'src/components/common/VnDmsList.vue';
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import VnLog from 'src/components/common/VnLog.vue';
describe('VnLog', () => {

View File

@ -1,5 +1,6 @@
import { describe, it, expect, vi, afterEach, beforeEach, afterAll } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import VnNotes from 'src/components/ui/VnNotes.vue';
describe('VnNotes', () => {

View File

@ -177,6 +177,8 @@ async function fetch() {
.value {
color: var(--vn-text-color);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.header {
@ -208,27 +210,21 @@ async function fetch() {
}
.vn-card-group {
display: flex;
flex-direction: column;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 16px;
}
.vn-card-content {
display: flex;
flex-direction: column;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
> div {
max-height: 70px;
}
}
@media (min-width: 1010px) {
.vn-card-group {
flex-direction: row;
}
.vn-card-content {
flex: 1;
}
}
</style>
<style lang="scss" scoped>
.summaryHeader .vn-label-value {

View File

@ -252,6 +252,10 @@ const toModule = computed(() => {
content: ':';
}
}
&.ellipsis > .value {
text-overflow: ellipsis;
white-space: pre;
}
.value {
color: var(--vn-text-color);
font-size: 14px;

View File

@ -1,5 +1,7 @@
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import CardSummary from 'src/components/ui/CardSummary.vue';
import * as vueRouter from 'vue-router';

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
describe('VnPaginate', () => {

View File

@ -1,5 +1,5 @@
import { describe, it, expect, beforeAll, vi } from 'vitest';
import { axios } from 'app/test/vitest/helper';
import axios from 'axios';
import parsePhone from 'src/filters/parsePhone';
describe('parsePhone filter', () => {

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import VnSms from 'src/components/ui/VnSms.vue';
describe('VnSms', () => {

View File

@ -1,5 +1,5 @@
import { vi, describe, expect, it, beforeAll, afterAll } from 'vitest';
import { axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { downloadFile } from 'src/composables/downloadFile';
import { useSession } from 'src/composables/useSession';
const session = useSession();

View File

@ -1,5 +1,7 @@
import { vi, describe, expect, it, beforeAll, afterAll } from 'vitest';
import { axios, flushPromises } from 'app/test/vitest/helper';
import axios from 'axios';
import { flushPromises } from '@vue/test-utils';
import { useAcl } from 'src/composables/useAcl';
describe('useAcl', () => {

View File

@ -1,15 +1,39 @@
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
import { axios, flushPromises } from 'app/test/vitest/helper';
import { default as axios } from 'axios';
import { useArrayData } from 'composables/useArrayData';
import { useRouter } from 'vue-router';
import * as vueRouter from 'vue-router';
import { setActivePinia, createPinia } from 'pinia';
describe('useArrayData', () => {
const filter = '{"limit":20,"skip":0}';
const params = { supplierFk: 2 };
beforeEach(() => {
vi.spyOn(useRouter(), 'replace');
vi.spyOn(useRouter(), 'push');
setActivePinia(createPinia());
// Mock route
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
path: 'mockSection/list',
matched: [],
query: {},
params: {},
meta: { moduleName: 'mockName' },
});
// Mock router
vi.spyOn(vueRouter, 'useRouter').mockReturnValue({
push: vi.fn(),
replace: vi.fn(),
currentRoute: {
value: {
path: 'mockSection/list',
params: { id: 1 },
meta: { moduleName: 'mockName' },
matched: [{ path: 'mockName/:id' }],
},
},
});
});
afterEach(() => {
@ -17,103 +41,69 @@ describe('useArrayData', () => {
});
it('should fetch and replace url with new params', async () => {
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
vi.spyOn(axios, 'get').mockResolvedValueOnce({ data: [] });
const arrayData = useArrayData('ArrayData', { url: 'mockUrl' });
const arrayData = useArrayData('ArrayData', {
url: 'mockUrl',
searchUrl: 'params',
});
arrayData.store.userParams = params;
arrayData.fetch({});
await arrayData.fetch({});
await flushPromises();
const routerReplace = useRouter().replace.mock.calls[0][0];
expect(axios.get.mock.calls[0][1].params).toEqual({
filter,
supplierFk: 2,
expect(axios.get).toHaveBeenCalledWith('mockUrl', {
signal: expect.any(Object),
params: {
filter,
supplierFk: 2,
},
});
expect(routerReplace.path).toEqual('mockSection/list');
expect(routerReplace.path).toBe('mockSection/list');
expect(JSON.parse(routerReplace.query.params)).toEqual(
expect.objectContaining(params),
);
});
it('should get data and send new URL without keeping parameters, if there is only one record', async () => {
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }] });
it('should redirect to detail when single record is returned with navigation', async () => {
vi.spyOn(axios, 'get').mockResolvedValueOnce({
data: [{ id: 1 }],
});
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', navigate: {} });
const arrayData = useArrayData('ArrayData', {
url: 'mockUrl',
navigate: {},
});
arrayData.store.userParams = params;
arrayData.fetch({});
await arrayData.fetch({});
await flushPromises();
const routerPush = useRouter().push.mock.calls[0][0];
expect(axios.get.mock.calls[0][1].params).toEqual({
filter,
supplierFk: 2,
});
expect(routerPush.path).toEqual('mockName/1');
expect(routerPush.path).toBe('mockName/1');
expect(routerPush.query).toBeUndefined();
});
it('should get data and send new URL keeping parameters, if you have more than one record', async () => {
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }, { id: 2 }] });
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
matched: [],
query: {},
params: {},
meta: { moduleName: 'mockName' },
path: 'mockName/1',
});
vi.spyOn(vueRouter, 'useRouter').mockReturnValue({
push: vi.fn(),
replace: vi.fn(),
currentRoute: {
value: {
params: {
id: 1,
},
meta: { moduleName: 'mockName' },
matched: [{ path: 'mockName/:id' }],
},
},
});
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', navigate: {} });
arrayData.store.userParams = params;
arrayData.fetch({});
await flushPromises();
const routerPush = useRouter().push.mock.calls[0][0];
expect(axios.get.mock.calls[0][1].params).toEqual({
filter,
supplierFk: 2,
});
expect(routerPush.path).toEqual('mockName/');
expect(routerPush.query.params).toBeDefined();
});
it('should return one record', async () => {
vi.spyOn(axios, 'get').mockReturnValueOnce({
it('should return one record when oneRecord is true', async () => {
vi.spyOn(axios, 'get').mockResolvedValueOnce({
data: [
{ id: 1, name: 'Entity 1' },
{ id: 2, name: 'Entity 2' },
],
});
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', oneRecord: true });
const arrayData = useArrayData('ArrayData', {
url: 'mockUrl',
oneRecord: true,
});
await arrayData.fetch({});
expect(arrayData.store.data).toEqual({ id: 1, name: 'Entity 1' });
});
it('should handle empty data gracefully if has to return one record', async () => {
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', oneRecord: true });
await arrayData.fetch({});
expect(arrayData.store.data).toBeUndefined();
expect(arrayData.store.data).toEqual({
id: 1,
name: 'Entity 1',
});
});
});

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it } from 'vitest';
import { axios, flushPromises } from 'app/test/vitest/helper';
import axios from 'axios';
import { flushPromises } from '@vue/test-utils';
import { useRole } from 'composables/useRole';
const role = useRole();

View File

@ -1,5 +1,5 @@
import { vi, describe, expect, it, beforeAll, beforeEach } from 'vitest';
import { axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { useSession } from 'composables/useSession';
import { useState } from 'composables/useState';

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it } from 'vitest';
import { axios, flushPromises } from 'app/test/vitest/helper';
import axios from 'axios';
import { flushPromises } from '@vue/test-utils';
import { useTokenConfig } from 'composables/useTokenConfig';
const tokenConfig = useTokenConfig();

View File

@ -5,12 +5,11 @@ import { useArrayDataStore } from 'stores/useArrayDataStore';
import { buildFilter } from 'filters/filterPanel';
import { isDialogOpened } from 'src/filters';
const arrayDataStore = useArrayDataStore();
export function useArrayData(key, userOptions) {
key ??= useRoute().meta.moduleName;
if (!key) throw new Error('ArrayData: A key is required to use this composable');
const arrayDataStore = useArrayDataStore(); // Move inside function
if (!arrayDataStore.get(key)) arrayDataStore.set(key);

View File

@ -13,7 +13,7 @@ export function useRole() {
name: data.user.name,
nickname: data.user.nickname,
lang: data.user.lang || 'es',
departmentFk: data.user.worker.department.departmentFk,
departmentFk: data.user?.worker?.department?.departmentFk,
};
state.setUser(userData);
state.setRoles(roles);

View File

@ -60,7 +60,7 @@ export function useSession() {
const { data: isValidToken } = await axios.get('VnUsers/validateToken');
if (isValidToken)
destroyTokenPromises = Object.entries(tokens).map(([key, url]) =>
destroyToken(url, storage, key)
destroyToken(url, storage, key),
);
}
} finally {

View File

@ -340,3 +340,6 @@ input::-webkit-inner-spin-button {
.containerShrinked {
width: 70%;
}
.q-item__section--main ~ .q-item__section--side {
padding-inline: 0;
}

View File

@ -6,7 +6,7 @@ import AccountSummary from './AccountSummary.vue';
<QPopupProxy style="max-width: 10px">
<AccountDescriptor
v-if="$attrs.id"
v-bind="$attrs.id"
v-bind="$attrs"
:summary="AccountSummary"
:proxy-render="true"
/>

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
describe('ClaimDescriptorMenu', () => {

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import ClaimLines from '/src/pages/Claim/Card/ClaimLines.vue';
describe('ClaimLines', () => {

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import ClaimLinesImport from 'pages/Claim/Card/ClaimLinesImport.vue';
describe('ClaimLinesImport', () => {

View File

@ -1,7 +1,7 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import ClaimPhoto from 'pages/Claim/Card/ClaimPhoto.vue';
describe('ClaimPhoto', () => {
let vm;
@ -61,7 +61,7 @@ describe('ClaimPhoto', () => {
title: 'This file will be deleted',
icon: 'delete',
data: { index: 1 },
promise: vm.deleteDms
promise: vm.deleteDms,
},
})
);

View File

@ -104,8 +104,11 @@ const sumRisk = ({ clientRisks }) => {
:value="entity.email"
class="ellipsis"
copy
><template #value> <VnLinkMail :email="entity.email" /> </template
></VnLv>
>
<template #value>
<VnLinkMail :email="entity.email" />
</template>
</VnLv>
<VnLv :label="t('globals.department')">
<template #value>
<span class="link" v-text="entity.department?.name" />

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import CustomerPayments from 'src/pages/Customer/Payments/CustomerPayments.vue';
describe('CustomerPayments', () => {

View File

@ -70,8 +70,8 @@ onMounted(async () => {
:url="`#/entry/${entityId}/basic-data`"
:text="t('globals.summary.basicData')"
/>
<div class="card-group">
<div class="card-content">
<div class="vn-card-group">
<div class="vn-card-content">
<VnLv
:label="t('entry.summary.commission')"
:value="entry?.commission"
@ -93,7 +93,7 @@ onMounted(async () => {
:value="entry?.invoiceNumber"
/>
</div>
<div class="card-content">
<div class="vn-card-content">
<VnCheckbox
:label="t('entry.list.tableVisibleColumns.isOrdered')"
v-model="entry.isOrdered"
@ -130,8 +130,8 @@ onMounted(async () => {
:url="`#/travel/${entry.travel.id}/summary`"
:text="t('Travel')"
/>
<div class="card-group">
<div class="card-content">
<div class="vn-card-group">
<div class="vn-card-content">
<VnLv :label="t('entry.summary.travelReference')">
<template #value>
<span class="link">
@ -161,7 +161,7 @@ onMounted(async () => {
:value="entry.travel.warehouseIn?.name"
/>
</div>
<div class="card-content">
<div class="vn-card-content">
<VnLv :label="t('travel.awbFk')" :value="entry.travel.awbFk" />
<VnCheckbox
:label="t('entry.summary.travelDelivered')"
@ -193,31 +193,6 @@ onMounted(async () => {
</template>
</CardSummary>
</template>
<style lang="scss" scoped>
.card-group {
display: flex;
flex-direction: column;
}
.card-content {
display: flex;
flex-direction: column;
text-overflow: ellipsis;
> div {
max-height: 24px;
}
}
@media (min-width: 1010px) {
.card-group {
flex-direction: row;
}
.card-content {
flex: 1;
margin-right: 16px;
}
}
</style>
<i18n>
es:
Travel: Envío

View File

@ -22,7 +22,7 @@ const routes = reactive({
getSupplier: (id) => {
return { name: 'SupplierCard', params: { id } };
},
getTickets: (id) => {
getInvoices: (id) => {
return {
name: 'InvoiceInList',
query: {
@ -131,11 +131,11 @@ async function setInvoiceCorrection(id) {
</QBtn>
<QBtn
size="md"
icon="vn:ticket"
icon="vn:invoice-in"
color="primary"
:to="routes.getTickets(entity.supplierFk)"
:to="routes.getInvoices(entity.supplierFk)"
>
<QTooltip>{{ t('globals.ticketList') }}</QTooltip>
<QTooltip>{{ t('invoiceIn.descriptor.invoices') }}</QTooltip>
</QBtn>
<QBtn
v-if="

View File

@ -15,6 +15,7 @@ invoiceIn:
amount: Amount
descriptor:
ticketList: Ticket list
invoices: Supplier invoices
descriptorMenu:
book: Book
unbook: Unbook

View File

@ -14,7 +14,7 @@ invoiceIn:
awb: AWB
amount: Importe
descriptor:
ticketList: Listado de tickets
invoices: Facturas de proveedor
descriptorMenu:
book: Contabilizar
unbook: Descontabilizar

View File

@ -7,7 +7,7 @@ import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { QCheckbox } from 'quasar';
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
import { useArrayData } from 'composables/useArrayData';
import { useValidator } from 'src/composables/useValidator';
@ -250,10 +250,9 @@ onMounted(async () => {
</QItemSection>
</QItem>
<!-- Tags filter -->
<QItem class="row items-center">
<QItemLabel>
{{ t('params.tags') }}
</QItemLabel>
<QItemLabel header>
{{ t('params.tags') }}
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
@ -261,7 +260,7 @@ onMounted(async () => {
color="primary"
@click="tagValues.push({})"
/>
</QItem>
</QItemLabel>
<QItem
v-for="(tag, index) in tagValues"
:key="index"
@ -269,6 +268,7 @@ onMounted(async () => {
>
<QItemSection class="col">
<VnSelect
class="full-width"
:label="t('params.tag')"
v-model="tag.selectedTag"
:options="tagOptions"
@ -316,25 +316,19 @@ onMounted(async () => {
/>
</QItem>
<!-- Filter fields -->
<QItem class="row items-center">
<QItemLabel>
{{ t('More fields') }}
</QItemLabel>
<QItemLabel header
>{{ t('More fields') }}
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="fieldFiltersValues.push({})"
/>
</QItem>
<QItem
v-for="(fieldFilter, index) in fieldFiltersValues"
:key="index"
class="row items-center"
>
/></QItemLabel>
<QItem v-for="(fieldFilter, index) in fieldFiltersValues" :key="index">
<QItemSection class="col">
<VnSelect
class="full-width"
:label="t('params.tag')"
:model-value="fieldFilter.selectedField"
:options="moreFields"
@ -355,7 +349,7 @@ onMounted(async () => {
/>
</QItemSection>
<QItemSection class="col">
<QCheckbox
<VnCheckbox
v-if="fieldFilter.selectedField?.type === 'boolean'"
v-model="fieldFilter.value"
:label="t('params.value')"
@ -370,13 +364,14 @@ onMounted(async () => {
@keydown.enter="applyFieldFilters(params, searchFn)"
/>
</QItemSection>
<QIcon
name="delete"
class="fill-icon-on-hover q-ml-xs"
size="sm"
color="primary"
@click="removeFieldFilter(index, params, searchFn)"
/>
<QItemSection side
><QIcon
name="delete"
class="fill-icon-on-hover q-ml-xs"
size="sm"
color="primary"
@click="removeFieldFilter(index, params, searchFn)"
/></QItemSection>
</QItem>
<QItem>
<QItemSection>

View File

@ -1,6 +1,7 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import { createWrapper } from 'app/test/vitest/helper';
import Login from 'pages/Login/LoginMain.vue';
import axios from 'axios';
describe('Login', () => {
let vm;

View File

@ -198,7 +198,7 @@ const getLocale = (label) => {
<QItemSection>
<VnSelect
dense
rounded
filled
:label="t('globals.params.packing')"
v-model="params.packing"
url="ItemPackingTypes"

View File

@ -46,7 +46,6 @@ const columns = computed(() => [
},
isId: true,
columnFilter: false,
width: '25px',
},
{
name: 'workerFk',
@ -142,7 +141,6 @@ const columns = computed(() => [
label: 'm3',
cardVisible: true,
columnClass: 'shrink',
width: '50px',
},
{
name: 'started',
@ -150,7 +148,6 @@ const columns = computed(() => [
component: 'time',
columnFilter: false,
format: ({ started }) => toHour(started),
width: '50px',
},
{
name: 'finished',
@ -158,7 +155,6 @@ const columns = computed(() => [
component: 'time',
columnFilter: false,
format: ({ finished }) => toHour(finished),
width: '50px',
},
{
align: 'right',

View File

@ -46,7 +46,6 @@ const columns = computed(() => [
condition: () => true,
},
columnFilter: false,
width: '25px',
},
{
align: 'left',
@ -57,7 +56,6 @@ const columns = computed(() => [
cardVisible: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
columnFilter: false,
width: '100px',
},
{
label: t('globals.agency'),
@ -100,7 +98,6 @@ const columns = computed(() => [
cardVisible: true,
columnFilter: false,
format: ({ started }) => toHour(started),
width: '50px',
},
{
align: 'center',
@ -109,7 +106,6 @@ const columns = computed(() => [
cardVisible: true,
columnFilter: false,
format: ({ finished }) => toHour(finished),
width: '50px',
},
{
align: 'left',

View File

@ -99,6 +99,7 @@ const columns = computed(() => [
align: 'left',
label: t('globals.quantity'),
name: 'quantity',
class: 'shrink',
format: (row) => toCurrency(row.quantity),
},
{
@ -791,7 +792,7 @@ watch(
{{ row?.item?.subName.toUpperCase() }}
</div>
</div>
<FetchedTags v-if="row.item" :item="row.item" :max-length="6" />
<FetchedTags v-if="row.item" :item="row.item" :columns="6" :max-length="6" />
<QPopupProxy v-if="row.id && isTicketEditable">
<VnInput
v-model="row.concept"

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import TicketBoxing from 'pages/Ticket/Card/TicketBoxing.vue';
// #4836 - Investigate how to test q-drawer outside
@ -21,7 +22,11 @@ describe('TicketBoxing', () => {
min: 1,
max: 2,
};
const videoList = ['2022-01-01T01-01-00.mp4', '2022-02-02T02-02-00.mp4', '2022-03-03T03-03-00.mp4'];
const videoList = [
'2022-01-01T01-01-00.mp4',
'2022-02-02T02-02-00.mp4',
'2022-03-03T03-03-00.mp4',
];
vi.spyOn(axios, 'get').mockResolvedValue({ data: videoList });
vi.spyOn(vm.quasar, 'notify');
@ -44,7 +49,9 @@ describe('TicketBoxing', () => {
await vm.getVideoList(expeditionId, timed);
expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining({ type: 'negative' }));
expect(vm.quasar.notify).toHaveBeenCalledWith(
expect.objectContaining({ type: 'negative' })
);
});
});
});

View File

@ -113,7 +113,7 @@ const columns = computed(() => [
},
{
align: 'left',
name: 'shipped',
name: 'shippedDate',
cardVisible: true,
label: t('ticketList.shipped'),
columnFilter: {
@ -123,7 +123,7 @@ const columns = computed(() => [
},
{
align: 'left',
name: 'shipped',
name: 'shippedHour',
component: 'time',
columnFilter: false,
label: t('ticketList.hour'),

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import TicketAdvance from 'pages/Ticket/TicketAdvance.vue';
import { Notify } from 'quasar';
import { nextTick } from 'vue';

View File

@ -205,6 +205,7 @@ ticketList:
toLines: Go to lines
addressNickname: Address nickname
ref: Reference
hour: Hour
rounding: Rounding
noVerifiedData: No verified data
purchaseRequest: Purchase request

View File

@ -1,5 +1,6 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import WagonCreate from 'pages/Wagon/WagonCreate.vue';
describe('WagonCreate', () => {

View File

@ -116,7 +116,7 @@ const handlePhotoUpdated = (evt = false) => {
<template #body="{ entity }">
<VnLv :label="t('globals.user')" :value="entity.user?.name" />
<VnLv
class="ellipsis-text"
class="ellipsis"
:label="t('globals.params.email')"
:value="entity.user?.emailUser?.email"
copy

View File

@ -102,8 +102,8 @@ async function fetchDocuware() {
Value: ['PDA'],
},
{
DBName: 'FILENAME',
Value: [`${row.deviceProductionFk}-pda`],
DBName: 'OBSERVACIONES',
Value: [row.deviceProductionFk],
},
],
});

View File

@ -91,7 +91,7 @@ onBeforeMount(async () => {
</template>
</VnLv>
</div>
<div class="vn-card-content">
<div class="vn-card-content" v-if="advancedSummary">
<VnLv
:label="t('worker.summary.fiDueDate')"
:value="toDate(advancedSummary.fiDueDate)"
@ -132,6 +132,7 @@ onBeforeMount(async () => {
<VnTitle :text="t('worker.summary.userData')" />
<VnLv :label="t('globals.name')" :value="worker?.user?.nickname" />
<VnLv
class="ellipsis"
:label="t('globals.params.email')"
:value="worker.user?.emailUser?.email"
copy

View File

@ -75,13 +75,13 @@ onMounted(async () => {
<template #body="{ entity: zone }">
<QCard class="vn-one">
<VnTitle :url="zoneUrl + `basic-data`" :text="t('summary.basicData')" />
<div class="card-group">
<div class="card-content">
<div class="vn-card-group">
<div class="vn-card-content">
<VnLv :label="t('list.agency')" :value="zone.agencyMode?.name" />
<VnLv :label="t('list.price')" :value="toCurrency(zone.price)" />
<VnLv :label="t('zone.bonus')" :value="toCurrency(zone.bonus)" />
</div>
<div class="card-content">
<div class="vn-card-content">
<VnLv
:label="t('summary.closeHour')"
:value="toTimeFormat(zone.hour)"
@ -98,7 +98,7 @@ onMounted(async () => {
</div>
</div>
</QCard>
<QCard class="vn-one">
<QCard class="vn-max">
<VnTitle :url="zoneUrl + `warehouses`" :text="t('list.warehouse')" />
<QTable
:columns="columns"
@ -109,15 +109,3 @@ onMounted(async () => {
</template>
</CardSummary>
</template>
<style lang="scss" scoped>
.card-group {
display: flex;
flex-direction: column;
}
.card-content {
display: flex;
flex-direction: column;
}
</style>

View File

@ -0,0 +1,95 @@
import { describe, expect, it, beforeEach } from 'vitest';
import { setActivePinia, createPinia } from 'pinia';
import { useArrayDataStore } from '../useArrayDataStore';
describe('useArrayDataStore', () => {
beforeEach(() => {
setActivePinia(createPinia());
});
it('should get undefined for non-existent key', () => {
const store = useArrayDataStore();
expect(store.get('nonExistent')).toBeUndefined();
});
it('should set default state for new key', () => {
const store = useArrayDataStore();
store.set('test');
const state = store.get('test');
expect(state).toMatchObject({
filter: {},
userFilter: {},
userParams: {},
url: '',
limit: 20,
skip: 0,
order: '',
isLoading: false,
userParamsChanged: false,
exprBuilder: null,
searchUrl: 'params',
navigate: null,
page: 1,
mapKey: 'id',
oneRecord: false,
});
});
it('should clear state for specific key', () => {
const store = useArrayDataStore();
store.set('test');
store.clear('test');
expect(store.get('test')).toBeUndefined();
});
it('should reset all properties when no options provided', () => {
const store = useArrayDataStore();
store.set('test');
const state = store.get('test');
state.limit = 50;
state.page = 3;
store.reset('test');
expect(store.get('test').limit).toBe(20);
expect(store.get('test').page).toBe(1);
});
it('should reset only specified properties', () => {
const store = useArrayDataStore();
store.set('test');
const state = store.get('test');
state.limit = 50;
state.page = 3;
state.url = 'test-url';
store.reset('test', ['limit', 'page']);
expect(state.limit).toBe(20);
expect(state.page).toBe(1);
expect(state.url).toBe('test-url');
});
it('should reset nested properties', () => {
const store = useArrayDataStore();
store.set('test');
const state = store.get('test');
state.filter.skip = 10;
store.reset('test', ['filter.skip']);
expect(state.filter.skip).toBe(0);
});
it('should reset pagination properties', () => {
const store = useArrayDataStore();
store.set('test');
const state = store.get('test');
state.skip = 20;
state.filter.skip = 20;
state.page = 3;
store.resetPagination('test');
expect(state.skip).toBe(0);
expect(state.filter.skip).toBe(0);
expect(state.page).toBe(1);
});
});

View File

@ -1,15 +1,17 @@
import { setActivePinia, createPinia } from 'pinia';
import { describe, beforeEach, afterEach, it, expect, vi, beforeAll } from 'vitest';
import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
import { useNavigationStore } from '../useNavigationStore';
import axios from 'axios';
import { default as axios } from 'axios';
let store;
vi.mock('src/router/modules', () => [
{ name: 'Item', meta: {} },
{ name: 'Shelving', meta: {} },
{ name: 'Order', meta: {} },
]);
vi.mock('src/router/modules', () => ({
default: [
{ name: 'Item', meta: {} },
{ name: 'Shelving', meta: {} },
{ name: 'Order', meta: {} },
],
}));
vi.mock('src/filters', () => ({
toLowerCamel: vi.fn((name) => name.toLowerCase()),

View File

@ -1,15 +0,0 @@
#!/bin/bash
find 'test/cypress/integration' \
-mindepth 1 \
-maxdepth 1 \
-type d | \
xargs -P "$1" -I {} sh -c '
echo "🔷 {}" &&
xvfb-run -a cypress run \
--headless \
--spec "{}" \
--quiet \
> /dev/null
'
wait

View File

@ -0,0 +1,20 @@
#!/bin/bash
echo $2
if [ -z "$2" ]; then
TEST_DIRS=$(find 'test/cypress/integration' -mindepth 1 -maxdepth 1 -type d)
else
TEST_DIRS=$2
fi
echo $TEST_DIRS x$1
echo "$TEST_DIRS" | xargs -P "$1" -I {} sh -c '
echo "🔷 {}" &&
xvfb-run -a cypress run \
--headless \
--spec "{}" \
--quiet \
> /dev/null
'
wait

View File

@ -0,0 +1,52 @@
import fs from 'fs';
import { parse } from 'es-module-lexer';
import { parse as vueParse } from '@vue/compiler-sfc';
import glob from 'fast-glob';
import { resolveImportPath, toRelative } from './resolve-import-path.js';
const ROUTER_MODULES = 'src/router/modules/';
const files = await glob(['src/**/*.{vue,js,ts}'], { absolute: true });
const vueFiles = new Map();
export async function findImports(targetFile, visited = new Set(), identation = '') {
if (visited.has(targetFile)) return []; // Avoid infinite loops
visited.add(targetFile);
const usageFiles = files
.filter((file) => {
let content = fs.readFileSync(file, 'utf8');
if (file.endsWith('.vue')) {
if (vueFiles.has(file)) {
content = vueFiles.get(file);
} else {
const { descriptor } = vueParse(content);
content = descriptor?.scriptSetup?.content ?? '';
vueFiles.set(file, content);
}
}
if (!content.trim()) return false;
return parse(content)[0].some((imp) => {
if (!imp?.n) return false;
return resolveImportPath(imp.n, targetFile) === targetFile;
});
})
.map((file) => toRelative(file));
let fullTree = [...usageFiles];
for (const file of usageFiles) {
if (file.startsWith(ROUTER_MODULES)) {
continue;
}
fullTree = [
...fullTree,
...(await findImports(file, visited, identation + ' ')),
];
}
return getUniques(fullTree); // Remove duplicates
}
function getUniques(array) {
return Array.from(new Set(array));
}

View File

@ -0,0 +1,36 @@
import { execSync } from 'child_process';
import { findImports } from './find-imports.js';
import { getModules } from './get-modules.js';
const E2E_PATH = 'test/cypress/integration';
const FINDED_PATHS = ['src', E2E_PATH];
function getGitDiff(options) {
const TARGET_BRANCH = options[2] || 'dev';
const diff = execSync(`git diff --name-only origin/${TARGET_BRANCH}`, {
encoding: 'utf-8',
});
return diff.split('\n');
}
async function getChangedModules() {
let changedModules = new Set();
const changes = getGitDiff(process.argv);
for (const change of changes) {
if (!change) continue;
if (!FINDED_PATHS.some((prefix) => change.startsWith(prefix))) return '';
const changedArray = [
...changedModules,
...new Set(getModules(await findImports(change))),
];
if (change.startsWith(E2E_PATH)) changedArray.push(change);
changedModules = new Set(changedArray);
}
return [...changedModules].join('\n');
}
getChangedModules()
.then((modules) => console.log(modules)) // is return
.catch((e) => {
console.error(e);
process.exit(1);
});

View File

@ -0,0 +1,13 @@
export function getModules(files) {
const CYPRESS_PREFIX = 'test/cypress/integration/';
const CYPRESS_SUFIX = '/**/*.spec.js';
const modules = [];
for (const file of files) {
if (file.startsWith('src/page')) {
modules.push(
CYPRESS_PREFIX + file.split('/')[2].toLowerCase() + CYPRESS_SUFIX,
);
}
}
return modules;
}

View File

@ -0,0 +1,34 @@
import fs from 'fs';
import path from 'path';
const rootDir = process.cwd();
const config = JSON.parse(fs.readFileSync('jsconfig.json', 'utf-8'));
const { paths, baseUrl } = config.compilerOptions;
function resolveImportPath(importPath, fileBase) {
if (!importPath) return null;
importPath = jsConfigPaths(importPath);
const fileDir = path.dirname(fileBase);
if (importPath.startsWith('.') || importPath.startsWith('/')) {
return path.relative(rootDir, path.resolve(fileDir, importPath));
}
return importPath;
}
function toRelative(file) {
return path.relative(rootDir, file);
}
function jsConfigPaths(importPath) {
for (const [aliasPattern, [target]] of Object.entries(paths)) {
const alias = aliasPattern.replace('/*', '');
const targetBase = target.replace('/*', '');
if (importPath.startsWith(alias)) {
const rest = importPath.slice(alias.length);
return path.resolve(baseUrl, targetBase + rest);
}
}
return importPath;
}
export { resolveImportPath, toRelative };

View File

@ -35,6 +35,8 @@ docker build -f ./docs/Dockerfile.dev -t lilium-dev .
# END IMAGES
docker-compose -p e2e --project-directory . -f test/cypress/docker-compose.yml up -d
files=$(node test/cypress/docker/find/find.js)
echo $files
docker run -it --rm \
-v "$(pwd)":/app \
@ -42,6 +44,6 @@ docker run -it --rm \
-e CI \
-e TZ \
lilium-dev \
bash -c 'sh test/cypress/cypressParallel.sh 2'
bash -c "sh test/cypress/docker/cypressParallel.sh 2 '$files'"
cleanup

View File

@ -13,7 +13,7 @@ describe('InvoiceInDescriptor', () => {
cy.validateCheckbox(checkbox, false);
});
it.skip('should delete the invoice properly', () => {
it('should delete the invoice properly', () => {
cy.visit('/#/invoice-in/2/summary');
cy.selectDescriptorOption(2);
cy.clickConfirm();
@ -40,7 +40,7 @@ describe('InvoiceInDescriptor', () => {
cy.visit('/#/invoice-in/6/summary');
cy.selectDescriptorOption(5);
cy.dataCy('SendEmailNotifiactionDialogInput_input').type(
cy.dataCy('SendEmailNotificationDialogInput_input').type(
'{selectall}jorgito@gmail.mx',
);
cy.clickConfirm();

Some files were not shown because too many files have changed in this diff Show More