Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6564-enhanceTicketAdvance

This commit is contained in:
Jorge Penadés 2025-03-24 12:59:47 +01:00
commit 304a039ebd
7 changed files with 119 additions and 13 deletions

View File

@ -26,6 +26,7 @@ const id = props.entityId;
:to="{ name: routeName, params: { id: id } }"
class="header link"
:href="url"
data-cy="goToSummaryBtn"
>
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>

View File

@ -28,7 +28,6 @@ const userParams = {
shipped: null,
};
const columns = computed(() => [
{
align: 'left',
@ -175,6 +174,7 @@ function downloadPdfs() {
:data-key
url="Cmrs/filter"
:columns="columns"
:order="['shipped DESC', 'cmrFk ASC']"
:user-params="userParams"
default-mode="table"
v-model:selected="selectedRows"

View File

@ -54,9 +54,9 @@ const columns = computed(() => [
label: t('globals.worker'),
component: markRaw(VnSelectWorker),
create: true,
cardVisible: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
columnFilter: false,
cardVisible: true,
width: '100px',
},
{
@ -74,7 +74,6 @@ const columns = computed(() => [
create: true,
columnFilter: true,
cardVisible: true,
visible: true,
},
{
name: 'vehicleFk',
@ -93,7 +92,6 @@ const columns = computed(() => [
create: true,
columnFilter: true,
cardVisible: true,
visible: true,
},
{
align: 'center',

View File

@ -10,14 +10,16 @@ describe('InvoiceInSerial', () => {
});
it('should filter by last days ', () => {
let before;
cy.dataCy('vnTableCell_total')
.invoke('text')
.then((total) => (before = +total));
cy.dataCy('Last days_input').type('{selectall}1{enter}');
cy.dataCy('vnTableCell_total')
.invoke('text')
.then((total) => expect(+total).to.be.lessThan(before));
.then((before) => {
cy.dataCy('Last days_input')
.type('{selectall}1{enter}')
.then(() => {
cy.dataCy('vnTableCell_total')
.invoke('text')
.then((after) => expect(+after).to.be.lessThan(+before));
});
});
});
});

View File

@ -0,0 +1,91 @@
describe('Cmr list', () => {
const getLinkSelector = (colField) =>
`tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;
const selectors = {
ticket: getLinkSelector('ticketFk'),
client: getLinkSelector('clientFk'),
lastRowSelectCheckBox:
'.q-virtual-scroll__content > tr:last-child > :nth-child(1) > .q-checkbox',
downloadBtn: '#subToolbar > .q-btn',
viewCmr: 'tableAction-0',
descriptorOpenSummaryBtn: '.descriptor [data-cy="openSummaryBtn"]',
summaryTitle: '.summaryHeader',
descriptorId: '.descriptor .subtitle',
descriptorTitle: '.descriptor .title',
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
descriptorGoToSummaryBtn: '.descriptor [data-cy="goToSummaryBtn"]',
removeFilter: '.q-chip__icon--remove',
};
const data = {
ticket: '1',
client: 'Bruce Wayne',
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/route/cmr');
cy.typeSearchbar('{enter}');
cy.get(selectors.removeFilter).click();
});
it('Should download selected cmr', () => {
const downloadsFolder = Cypress.config('downloadsFolder');
cy.get(selectors.lastRowSelectCheckBox).should('be.visible').click();
cy.get(selectors.downloadBtn).should('be.visible').click();
cy.wait(3000);
const fileName = 'cmrs.zip';
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
});
it('Should open selected cmr pdf', () => {
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});
cy.dataCy(selectors.viewCmr).last().click();
cy.get('@windowOpen').should('be.calledWithMatch', '\/api\/Cmrs\/3');
});
describe('Ticket pop-ups', () => {
it('Should redirect to the ticket summary from the ticket descriptor pop-up', () => {
cy.get(selectors.ticket).should('be.visible').click();
cy.containContent(selectors.descriptorId, data.ticket);
cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/ticket/1/summary');
cy.containContent(selectors.summaryTitle, data.client);
});
it('Should redirect to the ticket summary from summary pop-up from the ticket descriptor pop-up', () => {
cy.get(selectors.ticket).should('be.visible').click();
cy.containContent(selectors.descriptorId, data.ticket);
cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
cy.containContent(selectors.summaryTitle, data.client);
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/ticket/1/summary');
cy.containContent(selectors.summaryTitle, data.client);
});
});
describe('Client pop-ups', () => {
it('Should redirect to the client summary from the client descriptor pop-up', () => {
cy.get(selectors.client).should('be.visible').click();
cy.containContent(selectors.descriptorTitle, data.client);
cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/customer/1101/summary');
cy.containContent(selectors.summaryTitle, data.client);
});
it('Should redirect to the client summary from summary pop-up from the client descriptor pop-up', () => {
cy.get(selectors.client).should('be.visible').click();
cy.containContent(selectors.descriptorTitle, data.client);
cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
cy.containContent(selectors.summaryTitle, data.client);
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
cy.url().should('include', '/customer/1101/summary');
cy.containContent(selectors.summaryTitle, data.client);
});
});
});

View File

@ -154,10 +154,9 @@ describe('Route extended list', () => {
cy.validateContent(selectors.served, checkboxState.check);
});
it('Should delete the selected routes', () => {
it('Should delete the selected route', () => {
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.removeBtn).click();
cy.dataCy(selectors.confirmBtn).click();
cy.checkNotification(dataSaved);

View File

@ -370,6 +370,21 @@ Cypress.Commands.add('validateContent', (selector, expectedValue) => {
cy.get(selector).should('have.text', expectedValue);
});
Cypress.Commands.add('containContent', (selector, expectedValue) => {
cy.get(selector)
.should('be.visible')
.invoke('text')
.then((text) => {
expect(text).to.include(expectedValue);
});
});
Cypress.Commands.add('openActionDescriptor', (opt) => {
cy.openActionsDescriptor();
const listItem = '[role="menu"] .q-list .q-item';
cy.contains(listItem, opt).click();
});
Cypress.Commands.add('openActionsDescriptor', () => {
cy.get('[data-cy="vnDescriptor"] [data-cy="descriptor-more-opts"]').click();
});