test: #7356 Ticket e2e #1531

Merged
jsegarra merged 32 commits from 7356_e2e into dev 2025-04-08 12:31:24 +00:00
10 changed files with 153 additions and 17 deletions
Showing only changes of commit aebd9ea83c - Show all commits

View File

@ -78,7 +78,8 @@ export function useValidator() {
if (min >= 0)
if (Math.floor(value) < min) return t('inputMin', { value: min });
},
custom: (value) => validation.bindedFunction(value) || 'Invalid value',
custom: (value) =>
eval(`(${validation.bindedFunction})`)(value) || 'Invalid value',
};
};

View File

@ -22,7 +22,7 @@ const $props = defineProps({
});
</script>
<template>
<QPopupProxy style="max-width: 10px">
<QPopupProxy style="max-width: 10px" data-cy="ItemDescriptor">
<ItemDescriptor
v-if="$props.id"
:id="$props.id"

View File

@ -134,7 +134,7 @@ onMounted(() => (stateStore.rightDrawer = true));
auto-load
>
<template #column-itemFk="{ row }">
<span class="link">
<span class="link" @click.stop>
{{ row.itemFk }}
<ItemDescriptorProxy :id="row.itemFk" />
</span>

View File

@ -11,7 +11,7 @@ const $props = defineProps({
</script>
<template>
<QPopupProxy>
<QPopupProxy data-cy="ZoneDescriptor">
<ZoneDescriptor v-if="$props.id" :id="$props.id" :summary="ZoneSummary" />
</QPopupProxy>
</template>

View File

@ -1,11 +1,67 @@
/// <reference types="cypress" />
describe('TicketRequest', () => {
describe('TicketComponents', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/request');
cy.visit('/#/ticket/1/components');
});
it('Should load layout', () => {
cy.get('.q-page').should('be.visible');
/* ==== Generated with Cypress Studio ==== */
cy.get('.q-scrollarea__content > :nth-child(2) > :nth-child(2)').should(
'have.text',
'Base to commission: €799.20',
);
cy.get('.q-scrollarea__content > :nth-child(2) > :nth-child(3)').should(
'have.text',
'Total without VAT: €807.20',
);
cy.get('.q-scrollarea__content > :nth-child(3) > :nth-child(2)').should(
'have.text',
'valor de compra: €425.000',
);
cy.get('.q-scrollarea__content > :nth-child(3) > :nth-child(4)').should(
'have.text',
'maná auto: €7.998',
);
cy.get('.q-scrollarea__content > :nth-child(4) > :nth-child(2)').should(
'have.text',
'Price: €5.00',
);
cy.get('.q-scrollarea__content > :nth-child(4) > :nth-child(3)').should(
'have.text',
'Bonus: €1.00',
);
cy.get('.q-scrollarea__content > :nth-child(4) > :nth-child(5)').should(
'have.text',
'Packages: 6',
);
cy.get('.q-scrollarea__content > :nth-child(4) > :nth-child(4)').should(
'have.text',
'Zone: Zone pickup A ',
);
cy.get('.q-scrollarea__content > :nth-child(5) > :nth-child(2)').should(
'have.text',
'Total price: €16.00',
);
cy.get(':nth-child(4) > .link').click();
cy.dataCy('ZoneDescriptor').should('exist');
cy.get(':nth-child(1) > [data-col-field="total"]').should(
'have.text',
'€250.000€247.000€4.970',
);
cy.get(':nth-child(1) > [data-col-field="import"]').should(
'have.text',
'€50.000€49.400€0.994',
);
cy.get(':nth-child(1) > [data-col-field="components"]').should(
'have.text',
'valor de compramargenmaná auto',
);
cy.get(':nth-child(1) > [data-col-field="serie"]').should(
'have.text',
'costeempresacartera_comercial',
);
});
});

View File

@ -1,12 +1,22 @@
/// <reference types="cypress" />
describe('TicketRequest', () => {
describe('TicketPackages', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/request');
cy.visit('/#/ticket/31/package');
});
it('Should load layout', () => {
cy.get('.q-page').should('be.visible');
cy.get('.vn-row > .q-btn > .q-btn__content > .q-icon').click();
cy.get('[data-cy="Package_select"]').click();
cy.get('.q-menu :nth-child(1) >.q-item__section').click();
cy.get('[data-cy="Quantity_input"]').clear();
cy.get('[data-cy="Quantity_input"]').type('5');
cy.get('[data-cy="crudModelDefaultSaveBtn"] > .q-btn__content').click();
cy.checkNotification('Data saved');
cy.get('.q-mb-md > .text-primary').click();
cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
cy.checkNotification('Data saved');
});
});

View File

@ -1,11 +1,18 @@
/// <reference types="cypress" />
describe('TicketRequest', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/picture');
});
it('Should load layout', () => {
cy.get('.q-page').should('be.visible');
cy.get(
':nth-child(1) > .q-card > .img-wrapper > .q-img > .q-img__container > .q-img__image',
).should('be.visible');
cy.get(':nth-child(1) > .q-card > .content').should('be.visible');
cy.get('.content > .link').should('be.visible').click();
cy.dataCy('ItemDescriptor').should('exist');
cy.get('[data-cy="vnLvColor:"]').should('be.visible');
cy.get('[data-cy="vnLvColor:"]').should('be.visible');
cy.get('[data-cy="vnLvTallos:"]').should('be.visible');
cy.get('.q-mt-md').should('be.visible');
});
});

View File

@ -1,12 +1,47 @@
/// <reference types="cypress" />
function uncheckedSVG(className, state) {
cy.get(`${className} .q-checkbox__svg`).should(
state === 'checked' ? 'not.have.attr' : 'have.attr',
'fill',
'none',
);
}
function checkedSVG(className, state) {
cy.get(`${className} .q-checkbox__svg> .q-checkbox__truthy`).should(
state === 'checked' ? 'not.have.attr' : 'have.attr',
'fill',
'none',
);
}
describe('TicketRequest', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/sale-tracking');
cy.visit('/#/ticket/1/sale-tracking');
});
it('Should load layout', () => {
cy.get('.q-page').should('be.visible');
// Check checkbox states
uncheckedSVG('.pink', 'checked');
uncheckedSVG('.cyan', 'checked');
uncheckedSVG('.warning', 'checked');
uncheckedSVG('.info', 'checked');
checkedSVG('.yellow', 'unchecked');
cy.get('.q-page').click();
cy.get(
':nth-child(1) > :nth-child(6) > :nth-child(2) > .q-btn__content > .q-icon',
).click();
cy.get('.q-dialog__backdrop').click();
cy.get(
':nth-child(1) > :nth-child(6) > :nth-child(1) > .q-btn__content > .q-icon',
).click();
cy.get('.q-dialog__backdrop').click();
cy.get(
':nth-child(1) > :nth-child(2) > div > .link > .q-btn > .q-btn__content',
).click();
cy.dataCy('ItemDescriptor').should('exist');
});
});

View File

@ -1,12 +1,24 @@
/// <reference types="cypress" />
describe('TicketRequest', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/service');
});
it('Should load layout', () => {
it('Add and remove service', () => {
cy.get('.q-page').should('be.visible');
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get('[data-cy="Description_icon"]').click();
cy.get('[data-cy="Description_input"]').clear();
cy.get('[data-cy="Description_input"]').type('test');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.selectOption('[data-cy="Description_select"]', 'test');
cy.get('[data-cy="Quantity_input"]').clear('1');
cy.get('[data-cy="Quantity_input"]').type('1');
cy.get('[data-cy="Price_input"]').clear('2');
cy.get('[data-cy="Price_input"]').type('2');
cy.get('[data-cy="crudModelDefaultSaveBtn"] > .q-btn__content > .block').click();
cy.checkNotification('Data saved');
cy.get(':nth-child(5) > .q-icon').click();
});
});

View File

@ -1,12 +1,27 @@
/// <reference types="cypress" />
function checkRightLabel(index, value, tag = 'Volume: ') {
cy.get(`.q-scrollarea__content > :nth-child(${index}) > :nth-child(2) > span`)
.should('be.visible')
.should('have.text', `${tag}${value}`);
}
describe('TicketRequest', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/volume');
cy.visit('/#/ticket/1/volume');
});
it('Should load layout', () => {
it('Check right panel info', () => {
cy.get('.q-page').should('be.visible');
checkRightLabel(2, '0.028');
checkRightLabel(3, '0.014');
checkRightLabel(4, '1.526');
});
it('Descriptors', () => {
cy.get(':nth-child(1) > [data-col-field="itemFk"]')
.find('span')
.should('have.class', 'link')
.click();
cy.dataCy('ItemDescriptor').should('exist');
});
});