Merge branch 'dev' into formModel_mapper
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-02-21 13:18:52 +00:00
commit f494021dc8
60 changed files with 877 additions and 190 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
node_modules

90
Jenkinsfile vendored
View File

@ -1,6 +1,7 @@
#!/usr/bin/env groovy
def PROTECTED_BRANCH
def IS_LATEST
def BRANCH_ENV = [
test: 'test',
@ -10,16 +11,18 @@ def BRANCH_ENV = [
node {
stage('Setup') {
env.FRONT_REPLICAS = 1
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
PROTECTED_BRANCH = [
'dev',
'test',
'master',
'main',
'beta'
].contains(env.BRANCH_NAME)
IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME)
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
@ -58,6 +61,19 @@ pipeline {
PROJECT_NAME = 'lilium'
}
stages {
stage('Version') {
when {
expression { PROTECTED_BRANCH }
}
steps {
script {
def packageJson = readJSON file: 'package.json'
def version = "${packageJson.version}-build${env.BUILD_ID}"
writeFile(file: 'VERSION.txt', text: version)
echo "VERSION: ${version}"
}
}
}
stage('Install') {
environment {
NODE_ENV = ""
@ -71,17 +87,48 @@ pipeline {
expression { !PROTECTED_BRANCH }
}
environment {
NODE_ENV = ""
NODE_ENV = ''
CI = 'true'
TZ = 'Europe/Madrid'
}
steps {
sh 'pnpm run test:unit:ci'
}
post {
always {
junit(
testResults: 'junitresults.xml',
allowEmptyResults: true
)
parallel {
stage('Unit') {
steps {
sh 'pnpm run test:unit:ci'
}
post {
always {
junit(
testResults: 'junit/vitest.xml',
allowEmptyResults: true
)
}
}
}
stage('E2E') {
environment {
CREDENTIALS = credentials('docker-registry')
COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}"
COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ."
}
steps {
script {
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
sh 'cypress run --browser chromium'
}
}
}
post {
always {
sh "docker-compose ${env.COMPOSE_PARAMS} down"
junit(
testResults: 'junit/e2e.xml',
allowEmptyResults: true
)
}
}
}
}
}
@ -91,25 +138,30 @@ pipeline {
}
environment {
CREDENTIALS = credentials('docker-registry')
VERSION = readFile 'VERSION.txt'
}
steps {
sh 'quasar build'
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
sh 'quasar build'
def baseImage = "salix-frontend:${env.VERSION}"
def image = docker.build(baseImage, ".")
docker.withRegistry("https://${env.REGISTRY}", 'docker-registry') {
image.push()
image.push(env.BRANCH_NAME)
if (IS_LATEST) image.push('latest')
}
}
dockerBuild()
}
}
stage('Deploy') {
when {
expression { PROTECTED_BRANCH }
}
environment {
VERSION = readFile 'VERSION.txt'
}
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
}
withKubeConfig([
serverUrl: "$KUBERNETES_API",
credentialsId: 'kubernetes',

View File

@ -3,10 +3,39 @@ import { defineConfig } from 'cypress';
// https://docs.cypress.io/app/references/configuration
// https://www.npmjs.com/package/cypress-mochawesome-reporter
let urlHost,
reporter,
reporterOptions;
if (process.env.CI) {
urlHost = 'front';
reporter = 'junit';
reporterOptions = {
mochaFile: 'junit/e2e.xml',
toConsole: false,
};
} else {
urlHost = 'localhost';
reporter = 'cypress-mochawesome-reporter';
reporterOptions = {
charts: true,
reportPageTitle: 'Cypress Inline Reporter',
reportFilename: '[status]_[datetime]-report',
embeddedScreenshots: true,
reportDir: 'test/cypress/reports',
inlineAssets: true,
};
}
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:9000/',
experimentalStudio: true,
baseUrl: `http://${urlHost}:9000`,
experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios
defaultCommandTimeout: 10000,
trashAssetsBeforeRuns: false,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
supportFile: 'test/cypress/support/index.js',
@ -14,29 +43,35 @@ export default defineConfig({
downloadsFolder: 'test/cypress/downloads',
video: false,
specPattern: 'test/cypress/integration/**/*.spec.js',
experimentalRunAllSpecs: false,
watchForFileChanges: false,
reporter: 'cypress-mochawesome-reporter',
reporterOptions: {
charts: true,
reportPageTitle: 'Cypress Inline Reporter',
reportFilename: '[status]_[datetime]-report',
embeddedScreenshots: true,
reportDir: 'test/cypress/reports',
inlineAssets: true,
},
experimentalRunAllSpecs: true,
watchForFileChanges: true,
reporter,
reporterOptions,
component: {
componentFolder: 'src',
testFiles: '**/*.spec.js',
supportFile: 'test/cypress/support/unit.js',
},
},/*
setupNodeEvents: async (on, config) => {
const plugin = await import('cypress-mochawesome-reporter/plugin');
plugin.default(on);
const fs = await import('fs');
on('task', {
deleteFile(filePath) {
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
return true;
}
return false;
},
});
return config;
},
},*/
viewportWidth: 1280,
viewportHeight: 720,
},
experimentalMemoryManagement: true,
defaultCommandTimeout: 10000,
numTestsKeptInMemory: 2,
});

View File

@ -1,7 +0,0 @@
version: '3.7'
services:
main:
image: registry.verdnatura.es/salix-frontend:${VERSION:?}
build:
context: .
dockerfile: ./Dockerfile

45
docs/Dockerfile.dev Normal file
View File

@ -0,0 +1,45 @@
FROM debian:12.9-slim
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg2 \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& npm install -g corepack@0.31.0 \
&& corepack enable pnpm \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
apt-utils \
chromium \
libasound2 \
libgbm-dev \
libgtk-3-0 \
libgtk2.0-0 \
libnotify-dev \
libnss3 \
libxss1 \
libxtst6 \
xauth \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -r -g 1000 app \
&& useradd -r -u 1000 -g app -m -d /home/app app
USER app
ENV SHELL=bash
ENV PNPM_HOME="/home/app/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN pnpm setup \
&& pnpm install --global cypress@13.6.6 \
&& cypress install
WORKDIR /app

View File

@ -1,6 +1,6 @@
export default [
{
path: '/api',
rule: { target: 'http://0.0.0.0:3000' },
rule: { target: 'http://127.0.0.1:3000' },
},
];

View File

@ -11,6 +11,7 @@
import { configure } from 'quasar/wrappers';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import path from 'path';
const target = `http://${process.env.CI ? 'back' : 'localhost'}:3000`;
export default configure(function (/* ctx */) {
return {
@ -108,13 +109,17 @@ export default configure(function (/* ctx */) {
},
proxy: {
'/api': {
target: 'http://0.0.0.0:3000',
target: 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

View File

@ -85,7 +85,15 @@ const refresh = () => window.location.reload();
</QTooltip>
<PinnedModules ref="pinnedModulesRef" />
</QBtn>
<QBtn class="q-pa-none" rounded dense flat no-wrap id="user">
<QBtn
class="q-pa-none"
rounded
dense
flat
no-wrap
id="user"
data-cy="userPanel_btn"
>
<VnAvatar
:worker-id="user.id"
:title="user.name"

View File

@ -152,7 +152,7 @@ const onTabPressed = async () => {
};
</script>
<template>
<div v-if="showFilter" class="full-width flex-center" style="overflow: hidden">
<div v-if="showFilter" class="full-width" style="overflow: hidden">
<VnColumn
:column="$props.column"
default="input"

View File

@ -23,6 +23,10 @@ const $props = defineProps({
type: Boolean,
default: false,
},
align: {
type: String,
default: 'end',
},
});
const hover = ref();
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
@ -46,16 +50,27 @@ async function orderBy(name, direction) {
}
defineExpose({ orderBy });
function textAlignToFlex(textAlign) {
return `justify-content: ${
{
'text-center': 'center',
'text-left': 'start',
'text-right': 'end',
}[textAlign] || 'start'
};`;
}
</script>
<template>
<div
@mouseenter="hover = true"
@mouseleave="hover = false"
@click="orderBy(name, model?.direction)"
class="row items-center no-wrap cursor-pointer title"
class="items-center no-wrap cursor-pointer title"
:style="textAlignToFlex(align)"
>
<span :title="label">{{ label }}</span>
<sup v-if="name && model?.index">
<div v-if="name && model?.index">
<QChip
:label="!vertical ? model?.index : ''"
:icon="
@ -92,20 +107,16 @@ defineExpose({ orderBy });
/>
</div>
</QChip>
</sup>
</div>
</div>
</template>
<style lang="scss" scoped>
.title {
display: flex;
justify-content: center;
align-items: center;
height: 30px;
width: 100%;
color: var(--vn-label-color);
}
sup {
vertical-align: super; /* Valor predeterminado */
/* También puedes usar otros valores como "baseline", "top", "text-top", etc. */
white-space: nowrap;
}
</style>

View File

@ -519,7 +519,7 @@ function getToggleIcon(value) {
}
function formatColumnValue(col, row, dashIfEmpty) {
if (col?.format) {
if (col?.format || row[col?.name + 'TextValue']) {
if (selectRegex.test(col?.component) && row[col?.name + 'TextValue']) {
return dashIfEmpty(row[col?.name + 'TextValue']);
} else {
@ -551,9 +551,8 @@ function formatColumnValue(col, row, dashIfEmpty) {
return dashIfEmpty(row[urlRelation][col?.attrs.optionLabel ?? 'name']);
}
if (typeof row[urlRelation] == 'string') return dashIfEmpty(row[urlRelation]);
} else {
return dashIfEmpty(row[col?.name]);
}
return dashIfEmpty(row[col?.name]);
}
function cardClick(_, row) {
if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` });
@ -648,15 +647,14 @@ function cardClick(_, row) {
v-bind:class="col.headerClass"
class="body-cell"
:style="col?.width ? `max-width: ${col?.width}` : ''"
style="padding: inherit"
>
<div
class="no-padding"
:style="
withFilters && $props.columnSearch ? 'height: 75px' : ''
"
:style="[
withFilters && $props.columnSearch ? 'height: 75px' : '',
]"
>
<div class="text-center" style="height: 30px">
<div style="height: 30px">
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
<VnTableOrder
v-model="orders[col.orderBy ?? col.name]"
@ -664,6 +662,7 @@ function cardClick(_, row) {
:label="col?.labelAbbreviation ?? col?.label"
:data-key="$attrs['data-key']"
:search-url="searchUrl"
:align="getColAlign(col)"
/>
</div>
<VnFilter
@ -1045,8 +1044,8 @@ es:
}
.body-cell {
padding-left: 2px !important;
padding-right: 2px !important;
padding-left: 4px !important;
padding-right: 4px !important;
position: relative;
}
.bg-chip-secondary {

View File

@ -48,7 +48,8 @@ function toValueAttrs(attrs) {
<span
v-for="toComponent of componentArray"
:key="toComponent.name"
class="column flex-center fit"
class="column fit"
:class="toComponent?.component == 'checkbox' ? 'flex-center' : ''"
>
<component
v-if="toComponent?.component"

View File

@ -107,6 +107,7 @@ const manageDate = (date) => {
@click="isPopupOpen = !isPopupOpen"
@keydown="isPopupOpen = false"
hide-bottom-space
:data-cy="$attrs.dataCy ?? $attrs.label + '_inputDate'"
>
<template #append>
<QIcon

View File

@ -1,14 +1,14 @@
export function getColAlign(col) {
let align;
switch (col.component) {
case 'time':
case 'date':
case 'select':
align = 'left';
break;
case 'number':
align = 'right';
break;
case 'time':
case 'date':
case 'checkbox':
align = 'center';
break;

View File

@ -3,6 +3,8 @@ import { useI18n } from 'vue-i18n';
export default function (value, options = {}) {
if (!value) return;
if (!isValidDate(value)) return null;
if (!options.dateStyle && !options.timeStyle) {
options.day = '2-digit';
options.month = '2-digit';
@ -10,7 +12,12 @@ export default function (value, options = {}) {
}
const { locale } = useI18n();
const date = new Date(value);
const newDate = new Date(value);
return new Intl.DateTimeFormat(locale.value, options).format(date);
return new Intl.DateTimeFormat(locale.value, options).format(newDate);
}
// handle 0000-00-00
function isValidDate(date) {
const parsedDate = new Date(date);
return parsedDate instanceof Date && !isNaN(parsedDate.getTime());
}

View File

@ -16,7 +16,6 @@ import ItemDescriptor from 'src/pages/Item/Card/ItemDescriptor.vue';
import axios from 'axios';
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
import { checkEntryLock } from 'src/composables/checkEntryLock';
import SkeletonDescriptor from 'src/components/ui/SkeletonDescriptor.vue';
const $props = defineProps({
id: {
@ -103,7 +102,7 @@ const columns = [
name: 'itemFk',
component: 'number',
isEditable: false,
width: '40px',
width: '35px',
},
{
labelAbbreviation: '',
@ -111,7 +110,7 @@ const columns = [
name: 'hex',
columnSearch: false,
isEditable: false,
width: '5px',
width: '9px',
component: 'select',
attrs: {
url: 'Inks',
@ -181,6 +180,7 @@ const columns = [
url: 'packagings',
fields: ['id'],
optionLabel: 'id',
optionValue: 'id',
},
create: true,
width: '40px',
@ -192,7 +192,7 @@ const columns = [
component: 'number',
create: true,
width: '35px',
format: (row, dashIfEmpty) => parseFloat(row['weight']).toFixed(1),
format: (row) => parseFloat(row['weight']).toFixed(1),
},
{
labelAbbreviation: 'P',
@ -330,6 +330,25 @@ const columns = [
create: true,
format: (row) => parseFloat(row['price3']).toFixed(2),
},
{
align: 'center',
labelAbbreviation: 'CM',
label: t('Check min price'),
toolTip: t('Check min price'),
name: 'hasMinPrice',
attrs: {
toggleIndeterminate: false,
},
component: 'checkbox',
cellEvent: {
'update:modelValue': async (value, oldValue, row) => {
await axios.patch(`Items/${row['itemFk']}`, {
hasMinPrice: value,
});
},
},
width: '25px',
},
{
align: 'center',
labelAbbreviation: 'Min.',
@ -350,25 +369,6 @@ const columns = [
},
format: (row) => parseFloat(row['minPrice']).toFixed(2),
},
{
align: 'center',
labelAbbreviation: 'CM',
label: t('Check min price'),
toolTip: t('Check min price'),
name: 'hasMinPrice',
attrs: {
toggleIndeterminate: false,
},
component: 'checkbox',
cellEvent: {
'update:modelValue': async (value, oldValue, row) => {
await axios.patch(`Items/${row['itemFk']}`, {
hasMinPrice: value,
});
},
},
width: '25px',
},
{
align: 'center',
labelAbbreviation: t('P.Sen'),
@ -378,6 +378,9 @@ const columns = [
component: 'number',
isEditable: false,
width: '40px',
style: () => {
return { color: 'var(--vn-label-color)' };
},
},
{
align: 'center',
@ -417,6 +420,9 @@ const columns = [
component: 'input',
isEditable: false,
width: '35px',
style: () => {
return { color: 'var(--vn-label-color)' };
},
},
];
@ -644,8 +650,8 @@ onMounted(() => {
:is-editable="editableMode"
:without-header="!editableMode"
:with-filters="editableMode"
:right-search="false"
:right-search-icon="false"
:right-search="true"
:right-search-icon="true"
:row-click="false"
:columns="columns"
:beforeSaveFn="beforeSave"

View File

@ -199,7 +199,6 @@ const columns = computed(() => [
optionValue: 'code',
optionLabel: 'description',
},
cardVisible: true,
width: '65px',
format: (row, dashIfEmpty) => dashIfEmpty(row.entryTypeDescription),
},

View File

@ -57,7 +57,7 @@ const columns = computed(() => [
create: true,
component: 'number',
summation: true,
width: '60px',
width: '50px',
},
{
align: 'center',
@ -286,7 +286,7 @@ function round(value) {
justify-content: center;
}
.column {
min-width: 30%;
min-width: 40%;
margin-top: 5%;
display: flex;
flex-direction: column;

View File

@ -101,7 +101,8 @@ const columns = [
</template>
<style lang="css" scoped>
.container {
max-width: 50vw;
max-width: 100%;
width: 50%;
overflow: auto;
justify-content: center;
align-items: center;
@ -109,9 +110,6 @@ const columns = [
background-color: var(--vn-section-color);
padding: 2%;
}
.container > div > div > .q-table__top.relative-position.row.items-center {
background-color: red !important;
}
</style>
<i18n>
es:

View File

@ -163,10 +163,14 @@ const showExportationLetter = () => {
<QMenu anchor="top end" self="top start">
<QList>
<QItem v-ripple clickable @click="showSendInvoiceDialog('pdf')">
<QItemSection>{{ t('Send PDF') }}</QItemSection>
<QItemSection data-cy="InvoiceOutDescriptorMenuSendPdfOption">
{{ t('Send PDF') }}
</QItemSection>
</QItem>
<QItem v-ripple clickable @click="showSendInvoiceDialog('csv')">
<QItemSection>{{ t('Send CSV') }}</QItemSection>
<QItemSection data-cy="InvoiceOutDescriptorMenuSendCsvOption">
{{ t('Send CSV') }}
</QItemSection>
</QItem>
</QList>
</QMenu>

View File

@ -21,7 +21,6 @@ import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const tableRef = ref();
const invoiceOutSerialsOptions = ref([]);
const customerOptions = ref([]);
const selectedRows = ref([]);
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
@ -368,7 +367,6 @@ watchEffect(selectedRows);
url="InvoiceOutSerials"
v-model="data.serial"
:label="t('invoiceOutModule.serial')"
:options="invoiceOutSerialsOptions"
option-label="description"
option-value="code"
option-filter

View File

@ -24,6 +24,7 @@ invoiceOut:
min: Min
max: Max
hasPdf: Has PDF
search: Contains
card:
issued: Issued
customerCard: Customer card

View File

@ -24,6 +24,7 @@ invoiceOut:
min: Min
max: Max
hasPdf: Tiene PDF
search: Contiene
card:
issued: Fecha emisión
customerCard: Ficha del cliente

View File

@ -8,6 +8,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import { useArrayData } from 'src/composables/useArrayData';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
const { t } = useI18n();
const props = defineProps({
@ -52,7 +53,7 @@ onMounted(async () => {
name: key,
value,
selectedField: { name: key, label: t(`params.${key}`) },
})
}),
);
}
exprBuilder('state', arrayData.store?.userParams?.state);
@ -157,6 +158,32 @@ onMounted(async () => {
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
v-model="params.from"
:label="t('params.from')"
is-outlined
/>
</QItemSection>
<QItemSection>
<VnInputDate
v-model="params.to"
:label="t('params.to')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.daysOnward')"
v-model="params.daysOnward"
lazy-rules
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
@ -175,11 +202,10 @@ onMounted(async () => {
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.daysOnward')"
v-model="params.daysOnward"
lazy-rules
is-outlined
<QCheckbox
:label="t('params.mine')"
v-model="params.mine"
:toggle-indeterminate="false"
/>
</QItemSection>
</QItem>

View File

@ -280,7 +280,7 @@ const openTicketsDialog = (id) => {
</QCardSection>
<QCardSection class="q-pt-none">
<VnInputDate
:label="t('route.Stating date')"
:label="t('route.Starting date')"
v-model="startingDate"
autofocus
/>
@ -335,6 +335,7 @@ const openTicketsDialog = (id) => {
<QBtn
icon="vn:clone"
color="primary"
flat
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="confirmationDialog = true"
@ -344,6 +345,7 @@ const openTicketsDialog = (id) => {
<QBtn
icon="cloud_download"
color="primary"
flat
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="showRouteReport"
@ -353,6 +355,7 @@ const openTicketsDialog = (id) => {
<QBtn
icon="check"
color="primary"
flat
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="markAsServed()"

View File

@ -3,6 +3,7 @@ import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnTable from 'components/VnTable/VnTable.vue';
import { dashIfEmpty } from 'src/filters';
const tableRef = ref();
const { t } = useI18n();
const route = useRoute();
@ -44,9 +45,12 @@ const columns = [
create: true,
component: 'select',
attrs: {
url: 'centers',
url: 'medicalCenters',
fields: ['id', 'name'],
},
format: (row, dashIfEmpty) => {
return dashIfEmpty(row.center?.name);
},
},
{
align: 'left',

View File

@ -1,3 +1,7 @@
reports/*
videos/*
screenshots/*
downloads/*
downloads/*
storage/*
reports/*
docker/logs/*

View File

@ -0,0 +1,149 @@
{
"db": {
"connector": "memory",
"timezone": "local"
},
"vn": {
"connector": "vn-mysql",
"database": "vn",
"debug": false,
"host": "db",
"port": "3306",
"username": "root",
"password": "root",
"connectionLimit": 100,
"queueLimit": 100,
"multipleStatements": true,
"legacyUtcDateProcessing": false,
"timezone": "local",
"connectTimeout": 40000,
"acquireTimeout": 90000,
"waitForConnections": true,
"maxIdleTime": 60000,
"idleTimeout": 60000
},
"osticket": {
"connector": "memory",
"timezone": "local"
},
"tempStorage": {
"name": "tempStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/tmp",
"maxFileSize": "262144000",
"allowedContentTypes": [
"application/x-7z-compressed",
"application/x-zip-compressed",
"application/x-rar-compressed",
"application/octet-stream",
"application/pdf",
"application/zip",
"application/rar",
"multipart/x-zip",
"image/png",
"image/jpeg",
"image/jpg",
"image/webp",
"video/mp4"
]
},
"dmsStorage": {
"name": "dmsStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/dms",
"maxFileSize": "262144000",
"allowedContentTypes": [
"application/x-7z-compressed",
"application/x-zip-compressed",
"application/x-rar-compressed",
"application/octet-stream",
"application/pdf",
"application/zip",
"application/rar",
"multipart/x-zip",
"image/png",
"image/jpeg",
"image/jpg",
"image/webp"
]
},
"imageStorage": {
"name": "imageStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/image",
"maxFileSize": "52428800",
"allowedContentTypes": [
"image/png",
"image/jpeg",
"image/jpg",
"image/webp"
]
},
"invoiceStorage": {
"name": "invoiceStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/pdfs/invoice",
"maxFileSize": "52428800",
"allowedContentTypes": [
"application/octet-stream",
"application/pdf"
]
},
"claimStorage": {
"name": "claimStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/dms",
"maxFileSize": "31457280",
"allowedContentTypes": [
"image/png",
"image/jpeg",
"image/jpg",
"image/webp",
"video/mp4"
]
},
"entryStorage": {
"name": "entryStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/dms",
"maxFileSize": "31457280",
"allowedContentTypes": [
"image/png",
"image/jpeg",
"image/jpg",
"image/webp",
"video/mp4"
]
},
"supplierStorage": {
"name": "supplierStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/dms",
"maxFileSize": "31457280",
"allowedContentTypes": [
"image/png",
"image/jpeg",
"image/jpg",
"image/webp",
"video/mp4",
"application/pdf"
]
},
"accessStorage": {
"name": "accessStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/access",
"maxFileSize": "524288000",
"allowedContentTypes": [
"application/x-7z-compressed"
]
}
}

View File

@ -0,0 +1,21 @@
version: '3.7'
services:
back:
image: registry.verdnatura.es/salix-back:dev
volumes:
- ./test/cypress/storage:/salix/storage
- ./test/cypress/back/datasources.json:/salix/loopback/server/datasources.json
depends_on:
- db
dns_search: .
front:
image: lilium-dev:latest
command: pnpm exec quasar dev
volumes:
- .:/app
environment:
- CI
- TZ
dns_search: .
db:
image: registry.verdnatura.es/salix-db:dev

View File

View File

@ -41,7 +41,7 @@ describe('OrderCatalog', () => {
}
});
cy.get(
'[data-cy="vn-searchbar"] > .q-field > .q-field__inner > .q-field__control'
'[data-cy="vn-searchbar"] > .q-field > .q-field__inner > .q-field__control',
).type('{enter}');
cy.get(':nth-child(1) > [data-cy="catalogFilterCategory"]').click();
cy.dataCy('catalogFilterValueDialogBtn').last().click();

View File

@ -24,9 +24,9 @@ describe('ClaimAction', () => {
const rowData = [true];
cy.fillRow(firstRow, rowData);
cy.get('[title="Change destination"]').click();
cy.get('[title="Change destination"]').click({ force: true });
cy.selectOption(destinationRow, 'Confeccion');
cy.get('.q-card > .q-card__actions > .q-btn--standard').click();
cy.get('.q-card > .q-card__actions > .q-btn--standard').click({ force: true });
});
it('should regularize', () => {

View File

@ -8,7 +8,11 @@ describe('ClaimNotes', () => {
it('should add a new note', () => {
const message = 'This is a new message.';
cy.get('.q-textarea').type(message);
cy.get('.q-textarea')
.should('be.visible')
.should('not.be.disabled')
.type(message);
cy.get(saveBtn).click();
cy.get(firstNote).should('have.text', message);
});

View File

@ -23,14 +23,12 @@ describe.skip('ClaimPhoto', () => {
});
it('should open first image dialog change to second and close', () => {
cy.get(
':nth-child(1) > .q-card > .q-img > .q-img__container > .q-img__image'
).click();
cy.get(':nth-last-child(1) > .q-card').click();
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
'be.visible'
);
cy.get('.q-carousel__control > .q-btn > .q-btn__content > .q-icon').click();
cy.get('.q-carousel__control > button').click();
cy.get(
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon'
@ -42,7 +40,7 @@ describe.skip('ClaimPhoto', () => {
it('should remove third and fourth file', () => {
cy.get(
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon'
).click();
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
@ -50,7 +48,7 @@ describe.skip('ClaimPhoto', () => {
cy.get('.q-notification__message').should('have.text', 'Data deleted');
cy.get(
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon'
).click();
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'

View File

@ -8,7 +8,7 @@ describe('Client basic data', () => {
it('Should load layout', () => {
cy.get('.q-card').should('be.visible');
cy.dataCy('customerPhone').find('input').should('be.visible');
cy.dataCy('customerPhone').find('input').type('123456789');
cy.dataCy('customerPhone').find('input').clear().type('123456789');
cy.get('.q-btn-group > .q-btn--standard').click();
cy.intercept('PATCH', '/api/Clients/1102', (req) => {
const { body } = req;

View File

@ -20,7 +20,7 @@ describe('Entry', () => {
);
});
it('Create entry, modify travel and add buys', () => {
it.skip('Create entry, modify travel and add buys', () => {
createEntryAndBuy();
cy.get('a[data-cy="EntryBasicData-menu-item"]').click();
selectTravel('two');

View File

@ -9,7 +9,7 @@ describe('EntryStockBought', () => {
cy.get('[data-col-field="reserve"][data-row-index="0"]').click();
cy.get('input[name="reserve"]').type('10{enter}');
cy.get('button[title="Save"]').click();
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.checkNotification('Data saved');
});
it('Should add a new reserved space for buyerBoss', () => {
cy.addBtnClick();

View File

@ -1,6 +1,16 @@
/// <reference types="cypress" />
describe('InvoiceOut list', () => {
const serial = 'Española rapida';
const columnCheckbox =
'.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner';
const firstRowDescriptor =
'tbody > :nth-child(1) > [data-col-field="clientFk"] > .no-padding > .link';
const firstRowCheckbox =
'tbody > :nth-child(1) > :nth-child(1) > .q-checkbox > .q-checkbox__inner ';
const summaryPopupIcon = '.header > :nth-child(2) > .q-btn__content > .q-icon';
const filterBtn = '.q-scrollarea__content > .q-btn--standard > .q-btn__content';
const firstSummaryIcon =
':nth-child(1) > .text-right > [data-cy="tableAction-0"] > .q-btn__content > .q-icon';
beforeEach(() => {
cy.viewport(1920, 1080);
@ -9,18 +19,32 @@ describe('InvoiceOut list', () => {
cy.typeSearchbar('{enter}');
});
it('should search and filter an invoice and enter to the summary', () => {
cy.typeSearchbar('1{enter}');
cy.get('.q-virtual-scroll__content > :nth-child(2) > :nth-child(7)').click();
cy.get('.header > a.q-btn > .q-btn__content').click();
cy.typeSearchbar('{enter}');
cy.dataCy('InvoiceOutFilterAmountBtn').find('input').type('8.88{enter}');
it('should download one pdf from the subtoolbar button', () => {
cy.get(firstRowCheckbox).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
});
it('should download all pdfs', () => {
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
cy.get(columnCheckbox).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
});
it('should open the invoice descriptor from table icon', () => {
cy.get(firstSummaryIcon).click();
cy.get('.cardSummary').should('be.visible');
cy.get('.summaryHeader > div').should('include.text', 'A1111111');
});
it('should open the client descriptor', () => {
cy.get(firstRowDescriptor).click();
cy.get(summaryPopupIcon).click();
});
it('should filter the results by client ID, then check the first result is correct', () => {
cy.dataCy('Customer ID_input').type('1103');
cy.get(filterBtn).click();
cy.get(firstRowDescriptor).click();
cy.get('.q-item > .q-item__label').should('include.text', '1103');
});
it('should give an error when manual invoicing a ticket that is already invoiced', () => {
@ -31,11 +55,14 @@ describe('InvoiceOut list', () => {
cy.checkNotification('This ticket is already invoiced');
});
it('should create a manual invoice and enter to its summary', () => {
it('should create a manual invoice and enter to its summary, then delete that invoice', () => {
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('InvoiceOutCreateTicketinput').type(8);
cy.dataCy('InvoiceOutCreateTicketinput').type(9);
cy.selectOption('[data-cy="InvoiceOutCreateSerialSelect"]', serial);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(4)').click();
cy.dataCy('VnConfirm_confirm').click();
});
});

View File

@ -1,11 +1,26 @@
/// <reference types="cypress" />
describe('InvoiceOut negative bases', () => {
const getDescriptors = (opt) =>
`:nth-child(1) > [data-col-field="${opt}"] > .no-padding > .link`;
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/negative-bases`);
});
it('should open the posible descriptors', () => {
cy.get(getDescriptors('clientId')).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
cy.get(getDescriptors('ticketFk')).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '23');
cy.get(getDescriptors('workerName')).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '18');
});
it('should filter and download as CSV', () => {
cy.get('input[name="ticketFk"]').type('23{enter}');
cy.get('#subToolbar > .q-btn').click();

View File

@ -1,44 +1,95 @@
/// <reference types="cypress" />
describe('InvoiceOut summary', () => {
describe.skip('InvoiceOut summary', () => {
const transferInvoice = {
Client: { val: 'employee', type: 'select' },
Type: { val: 'Error in customer data', type: 'select' },
};
const firstRowDescriptors = (opt) =>
`tbody > :nth-child(1) > :nth-child(${opt}) > .q-btn`;
const toCustomerSummary = '[href="#/customer/1101"]';
const toTicketList = '[href="#/ticket/list?table={%22refFk%22:%22T1111111%22}"]';
const selectMenuOption = (opt) => `.q-menu > .q-list > :nth-child(${opt})`;
const confirmSend = '.q-btn--unelevated';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/list`);
cy.visit(`/#/invoice-out/1/summary`);
});
it('should generate the invoice PDF', () => {
cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(6)').click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('The invoice PDF document has been regenerated');
it('open the descriptors', () => {
cy.get(firstRowDescriptors(1)).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1');
cy.get(firstRowDescriptors(2)).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should refund the invoice ', () => {
it('should open the client summary and the ticket list', () => {
cy.get(toCustomerSummary).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should open the ticket list', () => {
cy.get(toTicketList).click();
cy.get('.descriptor').should('be.visible');
cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111');
});
it('should transfer the invoice ', () => {
cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(7)').click();
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
cy.checkNotification('The following refund ticket have been created');
cy.get(selectMenuOption(1)).click();
cy.fillInForm(transferInvoice);
cy.get('.q-mt-lg > .q-btn').click();
cy.checkNotification('Transferred invoice');
});
it('should send the invoice as PDF', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
it('should send the invoice as CSV', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
it('should delete an invoice ', () => {
cy.typeSearchbar('T2222222{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(4)').click();
cy.get(selectMenuOption(4)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted');
});
it('should transfer the invoice ', () => {
cy.typeSearchbar('T1111111{enter}');
it('should book the invoice', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(1)').click();
cy.fillInForm(transferInvoice);
cy.get('.q-mt-lg > .q-btn').click();
cy.checkNotification('Transferred invoice');
cy.get(selectMenuOption(5)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut booked');
});
it('should generate the invoice PDF', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(6)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('The invoice PDF document has been regenerated');
});
it('should refund the invoice ', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(7)).click();
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
cy.checkNotification('The following refund ticket have been created');
});
});

View File

@ -4,25 +4,21 @@ describe('Item tag', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/tags`);
cy.get('.q-page').should('be.visible');
cy.waitForElement('[data-cy="itemTags"]');
});
it('should throw an error adding an existent tag', () => {
cy.get('.q-page').should('be.visible');
cy.get('.q-page-sticky > div').click();
cy.get('.q-page-sticky > div').click();
cy.dataCy('Tag_select').eq(7).type('Tallos');
cy.get('.q-menu .q-item').contains('Tallos').click();
cy.selectOption(':nth-child(8) > .q-select', 'Tallos');
cy.get(':nth-child(8) > [label="Value"]').type('1');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification("The tag or priority can't be repeated for an item");
});
it('should add a new tag', () => {
cy.get('.q-page').should('be.visible');
cy.get('.q-page-sticky > div').click();
cy.get('.q-page-sticky > div').click();
cy.dataCy('Tag_select').eq(7).click();
cy.get('.q-menu .q-item').contains('Ancho de la base').type('{enter}');
cy.selectOption(':nth-child(8) > .q-select', 'Ancho de la base');
cy.get(':nth-child(8) > [label="Value"]').type('50');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved');

View File

@ -24,7 +24,7 @@ describe('Recover Password', () => {
it('should change password to user', () => {
// Get token from mail
cy.request(
`http://localhost:3000/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
`/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
).then((response) => {
const regex = /access_token=([a-zA-Z0-9]+)/;
const [match] = response.body[0].body.match(regex);

View File

@ -11,7 +11,7 @@ describe('Two Factor', () => {
it('should enable two factor to sysadmin', () => {
cy.request(
'PATCH',
`http://localhost:3000/api/VnUsers/${userId}/update-user?access_token=DEFAULT_TOKEN`,
`/api/VnUsers/${userId}/update-user?access_token=DEFAULT_TOKEN`,
{ twoFactor: 'email' }
);
});
@ -41,7 +41,7 @@ describe('Two Factor', () => {
// Get code from mail
cy.request(
`http://localhost:3000/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
`/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
).then((response) => {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = response.body[0].body;

View File

@ -1,4 +1,4 @@
describe('AgencyWorkCenter', () => {
describe.skip('AgencyWorkCenter', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');

View File

@ -0,0 +1,205 @@
describe.skip('Route extended list', () => {
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
const selectors = {
worker: getSelector('workerFk'),
agency: getSelector('agencyModeFk'),
vehicle: getSelector('vehicleFk'),
date: getSelector('dated'),
description: getSelector('description'),
served: getSelector('isOk'),
lastRowSelectCheckBox: 'tbody > tr:last-child > :nth-child(1) .q-checkbox__inner',
removeBtn: '[title="Remove"]',
resetBtn: '[title="Reset"]',
confirmBtn: 'VnConfirm_confirm',
saveBtn: 'crudModelDefaultSaveBtn',
saveFormBtn: 'FormModelPopup_save',
cloneBtn: '#st-actions > .q-btn-group > :nth-child(1)',
downloadBtn: '#st-actions > .q-btn-group > :nth-child(2)',
markServedBtn: '#st-actions > .q-btn-group > :nth-child(3)',
searchbar: 'searchbar',
firstTicketsRowSelectCheckBox:
'.q-card > :nth-child(2) > .q-table__container > .q-table__middle > .q-table > tbody > :nth-child(1) > .q-table--col-auto-width > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg > .q-checkbox__svg',
};
const checkboxState = {
check: 'check',
uncheck: 'close',
};
const url = '/#/route/extended-list';
const dataCreated = 'Data created';
const dataSaved = 'Data saved';
const originalFields = [
{ selector: selectors.worker, type: 'select', value: 'logistic' },
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
{ selector: selectors.vehicle, type: 'select', value: '3333-IMK' },
{ selector: selectors.date, type: 'date', value: '01/02/2024' },
{ selector: selectors.description, type: 'input', value: 'Test route' },
{ selector: selectors.served, type: 'checkbox', value: checkboxState.uncheck },
];
const updateFields = [
{ selector: selectors.worker, type: 'select', value: 'salesperson' },
{ selector: selectors.agency, type: 'select', value: 'inhouse pickup' },
{ selector: selectors.vehicle, type: 'select', value: '1111-IMK' },
{ selector: selectors.date, type: 'date', value: '01/01/2001' },
{ selector: selectors.description, type: 'input', value: 'Description updated' },
{ selector: selectors.served, type: 'checkbox', value: checkboxState.check },
];
function fillField(selector, type, value) {
switch (type) {
case 'select':
cy.get(selector).should('be.visible').click();
cy.dataCy('null_select').clear().type(value);
cy.get('.q-item').contains(value).click();
break;
case 'input':
cy.get(selector).should('be.visible').click();
cy.dataCy('null_input').clear().type(`${value}{enter}`);
break;
case 'date':
cy.get(selector).should('be.visible').click();
cy.dataCy('null_inputDate').clear().type(`${value}{enter}`);
break;
case 'checkbox':
cy.get(selector).should('be.visible').click().click();
break;
}
}
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(url);
cy.typeSearchbar('{enter}');
});
after(() => {
cy.visit(url);
cy.typeSearchbar('{enter}');
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.removeBtn).click();
cy.dataCy(selectors.confirmBtn).click();
});
it('Should list routes', () => {
cy.get('.q-table')
.children()
.should('be.visible')
.should('have.length.greaterThan', 0);
});
it('Should create new route', () => {
cy.addBtnClick();
const data = {
Worker: { val: 'logistic', type: 'select' },
Agency: { val: 'Super-Man delivery', type: 'select' },
Vehicle: { val: '3333-IMK', type: 'select' },
Date: { val: '02-01-2024', type: 'date' },
From: { val: '01-01-2024', type: 'date' },
To: { val: '10-01-2024', type: 'date' },
'Km start': { val: 1000 },
'Km end': { val: 1200 },
Description: { val: 'Test route' },
};
cy.fillInForm(data);
cy.dataCy(selectors.saveFormBtn).click();
cy.checkNotification(dataCreated);
cy.url().should('include', '/summary');
});
it('Should reset changed values when click reset button', () => {
updateFields.forEach(({ selector, type, value }) => {
fillField(selector, type, value);
});
cy.get('[title="Reset"]').click();
originalFields.forEach(({ selector, value }) => {
cy.validateContent(selector, value);
});
});
it('Should clone selected route', () => {
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.cloneBtn).click();
cy.dataCy('route.Starting date_inputDate').type('10-05-2001{enter}');
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
cy.validateContent(selectors.date, '05/10/2001');
});
it('Should download selected route', () => {
const downloadsFolder = Cypress.config('downloadsFolder');
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.downloadBtn).click();
cy.wait(5000);
const fileName = 'download.zip';
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
cy.task('deleteFile', `${downloadsFolder}/${fileName}`).then((deleted) => {
expect(deleted).to.be.true;
});
});
it('Should mark as served the selected route', () => {
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.markServedBtn).click();
cy.typeSearchbar('{enter}');
cy.validateContent(selectors.served, checkboxState.check);
});
it('Should delete the selected route', () => {
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.removeBtn).click();
cy.dataCy(selectors.confirmBtn).click();
cy.checkNotification(dataSaved);
});
it('Should save changes in route', () => {
updateFields.forEach(({ selector, type, value }) => {
fillField(selector, type, value);
});
cy.dataCy(selectors.saveBtn).should('not.be.disabled').click();
cy.checkNotification(dataSaved);
cy.typeSearchbar('{enter}');
updateFields.forEach(({ selector, value }) => {
cy.validateContent(selector, value);
});
});
it('Should add ticket to route', () => {
cy.dataCy('tableAction-0').last().click();
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
cy.checkNotification(dataSaved);
});
it('Should open summary pop-up when click summuary icon', () => {
cy.dataCy('tableAction-1').last().click();
cy.get('.summaryHeader > :nth-child(2').should('contain', updateFields[4].value);
});
it('Should redirect to the summary from the route summary pop-up', () => {
cy.dataCy('tableAction-1').last().click();
cy.get('.header > .q-icon').should('be.visible').click();
cy.url().should('include', '/summary');
});
it('Should redirect to the summary when click go to summary icon', () => {
cy.dataCy('tableAction-2').last().click();
cy.url().should('include', '/summary');
});
});

View File

@ -7,7 +7,7 @@ describe('Route', () => {
it('Route list create route', () => {
cy.addBtnClick();
cy.get('input[name="description"]').type('routeTestOne{enter}');
cy.get('.q-card input[name="description"]').type('routeTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary');
});

View File

@ -1,7 +1,7 @@
/// <reference types="cypress" />
describe('TicketSale', () => {
describe('Free ticket #31', () => {
describe.skip('Free ticket #31', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
@ -121,7 +121,7 @@ describe('TicketSale', () => {
cy.url().should('match', /\/ticket\/31\/log/);
});
});
describe('Ticket prepared #23', () => {
describe.skip('Ticket prepared #23', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);

View File

@ -40,7 +40,7 @@ describe('VnLocation', () => {
cy.selectOption(countrySelector, country);
cy.dataCy('locationProvince').type(`${province}{enter}`);
cy.get(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `,
).click();
cy.dataCy('locationProvince').should('have.value', province);
});
@ -87,7 +87,7 @@ describe('VnLocation', () => {
.get(':nth-child(1)')
.should('have.length.at.least', 2);
cy.get(
firstOption.concat(' > .q-item__section > .q-item__label--caption')
firstOption.concat(' > .q-item__section > .q-item__label--caption'),
).should('have.text', postCodeLabel);
cy.get(firstOption).click();
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
@ -103,7 +103,7 @@ describe('VnLocation', () => {
cy.get('.q-card > h1').should('have.text', 'New postcode');
cy.selectOption(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
province
province,
);
cy.get(dialogInputs).eq(0).clear();
cy.get(dialogInputs).eq(0).type(postCode);
@ -156,7 +156,7 @@ describe('VnLocation', () => {
cy.get(createLocationButton).click();
cy.selectOption(
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
'España'
'España',
);
cy.dataCy('Province_icon').click();

View File

@ -8,7 +8,7 @@ describe('WagonTypeCreate', () => {
it('should create a new wagon type and then delete it', () => {
cy.get('.q-page-sticky > div > .q-btn').click();
cy.get('input').first().type('Example for testing');
cy.dataCy('Name_input').type('Example for testing');
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
});

View File

@ -22,7 +22,7 @@ describe('WorkerNotificationsManager', () => {
);
});
it('should active a notification that is yours', () => {
it.skip('should active a notification that is yours', () => {
cy.login('developer');
cy.visit(`/#/worker/${developerId}/notifications`);
cy.waitForElement(activeList);

View File

@ -3,7 +3,7 @@ describe('ZoneWarehouse', () => {
Warehouse: { val: 'Warehouse One', type: 'select' },
};
const dataError = 'ER_DUP_ENTRY: Duplicate entry';
const dataError = 'The introduced warehouse already exists';
const saveBtn = '.q-btn--standard > .q-btn__content > .block';
beforeEach(() => {
@ -18,7 +18,7 @@ describe('ZoneWarehouse', () => {
cy.get(saveBtn).click();
cy.checkNotification(dataError);
});
it('should create & remove a warehouse', () => {
cy.addBtnClick();
cy.fillInForm(data);

View File

View File

View File

View File

View File

View File

View File

@ -27,7 +27,9 @@
// DO NOT REMOVE
// Imports Quasar Cypress AE predefined commands
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, require('./waitUntil'));
import waitUntil from './waitUntil';
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
Cypress.Commands.add('resetDB', () => {
cy.exec('pnpm run resetDatabase');
});
@ -57,7 +59,7 @@ Cypress.Commands.add('login', (user) => {
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
});
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => {
Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
});
@ -321,19 +323,14 @@ Cypress.Commands.add('clickButtonDescriptor', (id) => {
});
Cypress.Commands.add('openUserPanel', () => {
cy.get(
'.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image',
).click();
cy.dataCy('userPanel_btn').click();
});
Cypress.Commands.add('checkNotification', (text) => {
cy.get('.q-notification')
cy.get('.q-notification', { timeout: 10000 })
.should('be.visible')
.last()
.then(($lastNotification) => {
if (!Cypress.$($lastNotification).text().includes(text))
throw new Error(`Notification not found: "${text}"`);
});
.filter((_, el) => Cypress.$(el).text().includes(text))
.should('have.length.greaterThan', 0);
});
Cypress.Commands.add('openActions', (row) => {

View File

@ -27,7 +27,17 @@ function randomNumber(options = { length: 10 }) {
function randomizeValue(characterSet, options) {
return Array.from({ length: options.length }, () =>
characterSet.charAt(Math.floor(Math.random() * characterSet.length))
characterSet.charAt(Math.floor(Math.random() * characterSet.length)),
).join('');
}
const style = document.createElement('style');
style.innerHTML = `
* {
transition: none !important;
animation: none !important;
}
`;
document.head.appendChild(style);
export { randomString, randomNumber, randomizeValue };

View File

@ -5,9 +5,21 @@ import jsconfigPaths from 'vite-jsconfig-paths';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import path from 'path';
let reporters,
outputFile;
if (process.env.CI) {
reporters = ['junit', 'default'];
outputFile = {junit: './junit/vitest.xml'};
} else {
reporters = 'default';
}
// https://vitejs.dev/config/
export default defineConfig({
test: {
reporters,
outputFile,
environment: 'happy-dom',
setupFiles: 'test/vitest/setup-file.js',
include: [