Merge branch 'dev' into 6802-Clientes-gestionados-por-equipos

This commit is contained in:
Javi Gallego 2025-02-27 07:52:12 +01:00
commit 15ac8c36c7
23 changed files with 74 additions and 65 deletions

View File

@ -225,7 +225,7 @@ const toModule = computed(() =>
<div class="icons"> <div class="icons">
<slot name="icons" :entity="entity" /> <slot name="icons" :entity="entity" />
</div> </div>
<div class="actions justify-center"> <div class="actions justify-center" data-cy="descriptor_actions">
<slot name="actions" :entity="entity" /> <slot name="actions" :entity="entity" />
</div> </div>
<slot name="after" /> <slot name="after" />

View File

@ -783,7 +783,7 @@ worker:
notes: Notas notes: Notas
operator: operator:
numberOfWagons: Número de vagones numberOfWagons: Número de vagones
train: tren train: Tren
itemPackingType: Tipo de embalaje itemPackingType: Tipo de embalaje
warehouse: Almacén warehouse: Almacén
sector: Sector sector: Sector

View File

@ -46,8 +46,18 @@ async function setAdvancedSummary(data) {
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnInput :label="t('Name')" clearable v-model="data.firstName" /> <VnInput
<VnInput :label="t('Last name')" clearable v-model="data.lastName" /> :label="t('Name')"
clearable
v-model="data.firstName"
:required="true"
/>
<VnInput
:label="t('Last name')"
clearable
v-model="data.lastName"
:required="true"
/>
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput v-model="data.phone" :label="t('Business phone')" clearable /> <VnInput v-model="data.phone" :label="t('Business phone')" clearable />

View File

@ -54,9 +54,8 @@ watch(
selected.value = []; selected.value = [];
} }
}, },
{ immediate: true, deep: true } { immediate: true, deep: true },
); );
</script> </script>
<template> <template>
@ -105,6 +104,7 @@ watch(
:options="trainsData" :options="trainsData"
hide-selected hide-selected
v-model="row.trainFk" v-model="row.trainFk"
:required="true"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
@ -115,12 +115,14 @@ watch(
option-label="code" option-label="code"
option-value="code" option-value="code"
v-model="row.itemPackingTypeFk" v-model="row.itemPackingTypeFk"
:required="true"
/> />
<VnSelect <VnSelect
:label="t('worker.operator.warehouse')" :label="t('worker.operator.warehouse')"
:options="warehousesData" :options="warehousesData"
hide-selected hide-selected
v-model="row.warehouseFk" v-model="row.warehouseFk"
:required="true"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
@ -175,6 +177,7 @@ watch(
:label="t('worker.operator.isOnReservationMode')" :label="t('worker.operator.isOnReservationMode')"
v-model="row.isOnReservationMode" v-model="row.isOnReservationMode"
lazy-rules lazy-rules
:required="true"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>

View File

@ -1,8 +1,8 @@
src/pages/Worker/Card/WorkerPBX.vue
<script setup> <script setup>
import { useI18n } from 'vue-i18n';
import FormModel from 'src/components/FormModel.vue'; import FormModel from 'src/components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
</script> </script>
<template> <template>
@ -26,3 +26,8 @@ import VnInput from 'src/components/common/VnInput.vue';
</template> </template>
</FormModel> </FormModel>
</template> </template>
<i18n>
es:
It must be a 4-digit number and must not end in 00: Debe ser un número de 4 cifras y no terminar en 00
</i18n>

View File

@ -140,6 +140,7 @@ function reloadData() {
id="deviceProductionFk" id="deviceProductionFk"
hide-selected hide-selected
data-cy="pda-dialog-select" data-cy="pda-dialog-select"
:required="true"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">

View File

@ -1,16 +1,9 @@
<script setup> <script setup>
import VnSection from 'src/components/common/VnSection.vue';
import WorkerDepartmentTree from './WorkerDepartmentTree.vue'; import WorkerDepartmentTree from './WorkerDepartmentTree.vue';
</script> </script>
<template> <template>
<VnSection data-key="WorkerDepartment" :search-bar="false"> <QPage class="q-pa-md flex justify-center"> <WorkerDepartmentTree /> </QPage>
<template #body>
<div class="flex flex-center q-pa-md">
<WorkerDepartmentTree />
</div>
</template>
</VnSection>
</template> </template>
<i18n> <i18n>

View File

@ -35,8 +35,7 @@ describe('ClaimDevelopment', () => {
cy.saveCard(); cy.saveCard();
}); });
// TODO: #8112 it('should add and remove new line', () => {
xit('should add and remove new line', () => {
cy.wait(['@workers', '@workers']); cy.wait(['@workers', '@workers']);
cy.addCard(); cy.addCard();

View File

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

View File

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

View File

@ -4,7 +4,6 @@ describe('Client consignee', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('#/customer/1107/address'); cy.visit('#/customer/1107/address');
cy.domContentLoad();
}); });
it('Should load layout', () => { it('Should load layout', () => {
cy.get('.q-card').should('be.visible'); cy.get('.q-card').should('be.visible');

View File

@ -4,7 +4,6 @@ describe('Client fiscal data', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('#/customer/1107/fiscal-data'); cy.visit('#/customer/1107/fiscal-data');
cy.domContentLoad();
}); });
it('Should change required value when change customer', () => { it('Should change required value when change customer', () => {
cy.get('.q-card').should('be.visible'); cy.get('.q-card').should('be.visible');

View File

@ -1,7 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe.skip('Client list', () => { describe('Client list', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('/#/customer/list', { cy.visit('/#/customer/list', {
timeout: 5000, timeout: 5000,
@ -28,7 +27,7 @@ describe.skip('Client list', () => {
Email: { val: `user.test${randomInt}@cypress.com` }, Email: { val: `user.test${randomInt}@cypress.com` },
Team: { val: 'Informatica', type: 'select' }, Team: { val: 'Informatica', type: 'select' },
Location: { val: '46000', type: 'select' }, Location: { val: '46000', type: 'select' },
'Business type': { val: 'Otros', type: 'select' }, 'Business type': { val: 'others', type: 'select' },
}; };
cy.fillInForm(data); cy.fillInForm(data);
@ -37,6 +36,7 @@ describe.skip('Client list', () => {
cy.checkNotification('Data created'); cy.checkNotification('Data created');
cy.url().should('include', '/summary'); cy.url().should('include', '/summary');
}); });
it('Client list search client', () => { it('Client list search client', () => {
const search = 'Jessica Jones'; const search = 'Jessica Jones';
cy.searchByLabel('Name', search); cy.searchByLabel('Name', search);
@ -59,6 +59,7 @@ describe.skip('Client list', () => {
cy.checkValueForm(1, search); cy.checkValueForm(1, search);
cy.checkValueForm(2, search); cy.checkValueForm(2, search);
}); });
it('Client founded create order', () => { it('Client founded create order', () => {
const search = 'Jessica Jones'; const search = 'Jessica Jones';
cy.searchByLabel('Name', search); cy.searchByLabel('Name', search);

View File

@ -9,7 +9,7 @@ describe('InvoiceInList', () => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-in/list`); cy.visit(`/#/invoice-in/list`);
cy.get('#searchbar input').should('be.visible').type('{enter}'); cy.get('#searchbar input').type('{enter}');
}); });
it('should redirect on clicking a invoice', () => { it('should redirect on clicking a invoice', () => {
@ -21,7 +21,7 @@ describe('InvoiceInList', () => {
cy.url().should('include', `/invoice-in/${id}/summary`); cy.url().should('include', `/invoice-in/${id}/summary`);
}); });
}); });
// https://redmine.verdnatura.es/issues/8420
it('should open the details', () => { it('should open the details', () => {
cy.get(firstDetailBtn).click(); cy.get(firstDetailBtn).click();
cy.get(summaryHeaders).eq(1).contains('Basic data'); cy.get(summaryHeaders).eq(1).contains('Basic data');

View File

@ -11,7 +11,7 @@ describe('Handle Items FixedPrice', () => {
cy.visit('/#/item/fixed-price', { timeout: 5000 }); cy.visit('/#/item/fixed-price', { timeout: 5000 });
cy.waitForElement('.q-table'); cy.waitForElement('.q-table');
cy.get( cy.get(
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon' '.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon',
).click(); ).click();
}); });
it.skip('filter', function () { it.skip('filter', function () {
@ -38,7 +38,7 @@ describe('Handle Items FixedPrice', () => {
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click(); cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click();
cy.get( cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click(); ).click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data saved');
}); });
@ -56,7 +56,7 @@ describe('Handle Items FixedPrice', () => {
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click(); cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
cy.get('#subToolbar > .q-btn--flat').click(); cy.get('#subToolbar > .q-btn--flat').click();
cy.get( cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click(); ).click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data saved');
}); });

View File

@ -15,6 +15,7 @@ describe('Item list', () => {
cy.get('.q-menu .q-item').contains('Anthurium').click(); cy.get('.q-menu .q-item').contains('Anthurium').click();
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click(); cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
}); });
// https://redmine.verdnatura.es/issues/8421 // https://redmine.verdnatura.es/issues/8421
it.skip('should create an item', () => { it.skip('should create an item', () => {
const data = { const data = {
@ -28,7 +29,7 @@ describe('Item list', () => {
cy.dataCy('FormModelPopup_save').click(); cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created'); cy.checkNotification('Data created');
cy.get( cy.get(
':nth-child(2) > .q-drawer > .q-drawer__content > .q-scrollarea > .q-scrollarea__container > .q-scrollarea__content' ':nth-child(2) > .q-drawer > .q-drawer__content > .q-scrollarea > .q-scrollarea__container > .q-scrollarea__content',
).should('be.visible'); ).should('be.visible');
}); });
}); });

View File

@ -30,8 +30,6 @@ describe('Ticket descriptor', () => {
it('should set the weight of the ticket', () => { it('should set the weight of the ticket', () => {
cy.visit('/#/ticket/10/summary'); cy.visit('/#/ticket/10/summary');
cy.intercept('GET', /\/api\/Tickets\/\d/).as('ticket');
cy.wait('@ticket');
cy.openActionsDescriptor(); cy.openActionsDescriptor();
cy.contains(listItem, setWeightOpt).click(); cy.contains(listItem, setWeightOpt).click();
cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight'); cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight');

View File

@ -1,6 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
// https://redmine.verdnatura.es/issues/8423 describe('Ticket expedtion', () => {
describe.skip('Ticket expedtion', () => {
const tableContent = '.q-table .q-virtual-scroll__content'; const tableContent = '.q-table .q-virtual-scroll__content';
const stateTd = 'td:nth-child(9)'; const stateTd = 'td:nth-child(9)';

View File

@ -3,7 +3,6 @@ describe('VnInput Component', () => {
cy.login('developer'); cy.login('developer');
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.visit('/#/supplier/1/fiscal-data'); cy.visit('/#/supplier/1/fiscal-data');
cy.domContentLoad();
}); });
it('should replace character at cursor position in insert mode', () => { it('should replace character at cursor position in insert mode', () => {
@ -14,8 +13,7 @@ describe('VnInput Component', () => {
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}'); cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
// Escribe un número y verifica que se reemplace correctamente // Escribe un número y verifica que se reemplace correctamente
cy.dataCy('supplierFiscalDataAccount').type('999'); cy.dataCy('supplierFiscalDataAccount').type('999');
cy.dataCy('supplierFiscalDataAccount') cy.dataCy('supplierFiscalDataAccount').should('have.value', '9990000001');
.should('have.value', '9990000001');
}); });
it('should replace character at cursor position in insert mode', () => { it('should replace character at cursor position in insert mode', () => {
@ -26,14 +24,12 @@ describe('VnInput Component', () => {
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}'); cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
// Escribe un número y verifica que se reemplace correctamente en la posicion incial // Escribe un número y verifica que se reemplace correctamente en la posicion incial
cy.dataCy('supplierFiscalDataAccount').type('999'); cy.dataCy('supplierFiscalDataAccount').type('999');
cy.dataCy('supplierFiscalDataAccount') cy.dataCy('supplierFiscalDataAccount').should('have.value', '9990000001');
.should('have.value', '9990000001');
}); });
it('should respect maxlength prop', () => { it('should respect maxlength prop', () => {
cy.dataCy('supplierFiscalDataAccount').clear(); cy.dataCy('supplierFiscalDataAccount').clear();
cy.dataCy('supplierFiscalDataAccount').type('123456789012345'); cy.dataCy('supplierFiscalDataAccount').type('123456789012345');
cy.dataCy('supplierFiscalDataAccount') cy.dataCy('supplierFiscalDataAccount').should('have.value', '1234567890'); // asumiendo que maxlength es 10
.should('have.value', '1234567890'); // asumiendo que maxlength es 10
}); });
}); });

View File

@ -17,7 +17,6 @@ describe('VnLocation', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 }); cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 });
cy.domContentLoad();
cy.get(createLocationButton).click(); cy.get(createLocationButton).click();
}); });
it('should filter provinces based on selected country', () => { it('should filter provinces based on selected country', () => {

View File

@ -18,6 +18,6 @@ describe('WagonCreate', () => {
).type('100'); ).type('100');
cy.dataCy('Type_select').type('{downarrow}{enter}'); cy.dataCy('Type_select').type('{downarrow}{enter}');
cy.get('[title="Remove"] > .q-btn__content > .q-icon').click(); cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
}); });
}); });

View File

@ -9,13 +9,7 @@ describe('ZoneBasicData', () => {
}); });
it('should throw an error if the name is empty', () => { it('should throw an error if the name is empty', () => {
cy.intercept('GET', /\/api\/Zones\/4./).as('zone'); cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}');
cy.wait('@zone').then(() => {
cy.get('[data-cy="zone-basic-data-name"] input').type(
'{selectall}{backspace}',
);
});
cy.get(saveBtn).click(); cy.get(saveBtn).click();
cy.checkNotification("can't be blank"); cy.checkNotification("can't be blank");

View File

@ -33,7 +33,8 @@ Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
Cypress.Commands.add('resetDB', () => { Cypress.Commands.add('resetDB', () => {
cy.exec('pnpm run resetDatabase'); cy.exec('pnpm run resetDatabase');
}); });
Cypress.Commands.add('login', (user) => {
Cypress.Commands.add('login', (user = 'developer') => {
//cy.visit('/#/login'); //cy.visit('/#/login');
cy.request({ cy.request({
method: 'POST', method: 'POST',
@ -56,9 +57,12 @@ Cypress.Commands.add('login', (user) => {
}); });
}); });
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => { Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
originalFn(url, options);
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete')); cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
cy.waitUntil(() => cy.get('main').should('exist'));
}); });
Cypress.Commands.add('waitForElement', (element, timeout = 10000) => { Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled'); cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
}); });
@ -329,8 +333,13 @@ Cypress.Commands.add('openUserPanel', () => {
Cypress.Commands.add('checkNotification', (text) => { Cypress.Commands.add('checkNotification', (text) => {
cy.get('.q-notification', { timeout: 10000 }) cy.get('.q-notification', { timeout: 10000 })
.should('be.visible') .should('be.visible')
.filter((_, el) => Cypress.$(el).text().includes(text)) .should('have.length.greaterThan', 0)
.should('have.length.greaterThan', 0); .should(($elements) => {
const found = $elements
.toArray()
.some((el) => Cypress.$(el).text().includes(text));
expect(found).to.be.true;
});
}); });
Cypress.Commands.add('openActions', (row) => { Cypress.Commands.add('openActions', (row) => {
@ -376,7 +385,13 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
} }
}); });
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => { Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
cy.get(`.q-icon.${iconClass}`).parent().click(); cy.waitForElement('[data-cy="descriptor_actions"]');
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should('not.be.visible');
cy.get('.q-btn')
.filter((index, el) => Cypress.$(el).find('.q-icon.' + iconClass).length > 0)
.then(($btn) => {
cy.wrap($btn).click();
});
}); });
Cypress.Commands.add('clickButtonWithText', (buttonText) => { Cypress.Commands.add('clickButtonWithText', (buttonText) => {
cy.get('.q-btn').contains(buttonText).click(); cy.get('.q-btn').contains(buttonText).click();