test: check params from and to
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2025-03-16 12:36:22 +01:00
parent e0def231b1
commit 57e80040fa
1 changed files with 43 additions and 38 deletions

View File

@ -139,57 +139,62 @@ describe('Monitor Tickets Table', () => {
cy.url().should('include', 'packing');
countRows('eq', 5);
});
});
it('Cols', () => {
cy.get(firstRow('totalProblems'));
cy.get(firstRow('id')).find('span').should('have.class', 'link').click();
cy.dataCy('TicketDescriptor').should('exist');
it('Cols', () => {
cy.get(firstRow('totalProblems'));
cy.get(firstRow('zoneFk')).find('span').should('have.class', 'link').click();
cy.dataCy('ZoneDescriptor').should('exist');
cy.get(firstRow('id')).find('span').should('have.class', 'link').click();
cy.dataCy('TicketDescriptor').should('exist');
cy.get(firstRow('clientFk')).find('span').should('have.class', 'link').click();
cy.dataCy('CustomerDescriptor').should('exist');
cy.get(firstRow('zoneFk')).find('span').should('have.class', 'link').click();
cy.dataCy('ZoneDescriptor').should('exist');
cy.get(firstRow('departmentFk')).find('span').should('have.class', 'link').click();
cy.dataCy('DepartmentDescriptor').should('exist');
cy.get(firstRow('shippedDate')).find('.q-badge');
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"] > .q-btn__content > .q-icon',
).click({ ctrlKey: true });
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-1"] > .q-btn__content > .q-icon',
).click();
cy.get('.summaryHeader').should('exist');
cy.get(firstRow('clientFk')).find('span').should('have.class', 'link').click();
cy.dataCy('CustomerDescriptor').should('exist');
cy.get(firstRow('departmentFk'))
.find('span')
.should('have.class', 'link')
.click();
cy.dataCy('DepartmentDescriptor').should('exist');
cy.get(firstRow('shippedDate')).find('.q-badge');
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"] > .q-btn__content > .q-icon',
).click({ ctrlKey: true });
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-1"] > .q-btn__content > .q-icon',
).click();
cy.get('.summaryHeader').should('exist');
});
it.only('clear scopeDays', function () {
cy.get('[data-cy="Days onward_input"]').clear().type('2');
cy.searchInFilterPanel();
cy.get('.q-chip__content > span').should('have.text', '"2"');
cy.waitSpinner();
checkScopeDays(2);
cy.get('[data-cy="Days onward_input"]').clear();
cy.searchInFilterPanel();
cy.get('.q-chip__content > span').should('have.text', '"0"');
cy.waitSpinner();
checkScopeDays(0);
});
});
it('clear scopeDays', function () {
cy.get('[data-cy="Days onward_input"]').clear().type('2');
cy.searchInFilterPanel();
cy.get('.q-chip__content > span').should('have.text', '"2"');
cy.waitSpinner();
// Verify URL contains correct scopeDays value
function checkScopeDays(scopeDays) {
cy.url().then((url) => {
const urlParams = new URLSearchParams(url.split('?')[1]);
const saleMonitorTickets = JSON.parse(
decodeURIComponent(urlParams.get('saleMonitorTickets')),
);
expect(saleMonitorTickets.scopeDays).to.equal(2);
});
cy.get('[data-cy="Days onward_input"]').clear();
cy.searchInFilterPanel();
cy.get('.q-chip__content > span').should('have.text', '"0"');
cy.waitSpinner();
// Verify URL after clearing
cy.url().then((url) => {
const urlParams = new URLSearchParams(url.split('?')[1]);
const saleMonitorTickets = JSON.parse(
decodeURIComponent(urlParams.get('saleMonitorTickets')),
expect(saleMonitorTickets.scopeDays).to.equal(scopeDays);
const fromDate = new Date(saleMonitorTickets.from);
const toDate = new Date(saleMonitorTickets.to);
expect(toDate.getDate() - fromDate.getDate()).to.equal(
saleMonitorTickets.scopeDays,
);
expect(saleMonitorTickets.scopeDays).to.equal(0);
});
});
}
function requestParams(key, value, options = { inWhere: false, like: false }) {
cy.wait('@filterRequest').then((interception) => {
if (!key) return;