refactor: streamline filter panel tests with parameterized test cases
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
2f47bb10aa
commit
da31d6db3b
|
@ -29,94 +29,104 @@ describe('Monitor Tickets Table', () => {
|
||||||
cy.clickOption();
|
cy.clickOption();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should filter by filter panel', () => {
|
it.only('should filter by filter panel', () => {
|
||||||
// Client id - clientFk
|
const testCases = [
|
||||||
cy.dataCy('Client id_input').type('1101');
|
{
|
||||||
cy.searchInFilterPanel();
|
name: 'Client id',
|
||||||
cy.url().should('include', 'clientFk');
|
selector: 'Client id_input',
|
||||||
cy.countTableRows('eq', 7);
|
value: '1101',
|
||||||
//
|
urlParam: 'clientFk',
|
||||||
cy.cleanFilterPanel();
|
rows: 7,
|
||||||
// Order id - orderFk
|
intercept: () => interceptFilterClient(),
|
||||||
cy.dataCy('Order id_input').type(7);
|
wait: '@filterClient',
|
||||||
cy.searchInFilterPanel();
|
},
|
||||||
cy.url().should('include', 'orderFk');
|
{
|
||||||
cy.countTableRows('eq', 1);
|
name: 'Order id',
|
||||||
//
|
selector: 'Order id_input',
|
||||||
cy.cleanFilterPanel();
|
value: '7',
|
||||||
// Days onward - scopeDays
|
urlParam: 'orderFk',
|
||||||
cy.dataCy('Days onward_input').type(2);
|
rows: 1,
|
||||||
cy.searchInFilterPanel();
|
},
|
||||||
cy.url().should('include', 'scopeDays');
|
{
|
||||||
cy.countTableRows('eq', 27);
|
name: 'Days onward',
|
||||||
//
|
selector: 'Days onward_input',
|
||||||
cy.cleanFilterPanel();
|
value: '2',
|
||||||
// Nickname
|
urlParam: 'scopeDays',
|
||||||
cy.dataCy('Nickname_input').type('test');
|
rows: 27,
|
||||||
cy.searchInFilterPanel();
|
},
|
||||||
cy.url().should('include', 'nickname');
|
// ... resto de casos como selects
|
||||||
cy.countTableRows('eq', 2);
|
{
|
||||||
//
|
name: 'Agency',
|
||||||
cy.cleanFilterPanel();
|
selector: 'Agency_select',
|
||||||
// Invoice
|
value: 'inhouse pickup',
|
||||||
cy.dataCy('Invoice_input').type('test');
|
urlParam: 'agencyModeFk',
|
||||||
cy.searchInFilterPanel();
|
rows: 6,
|
||||||
cy.url().should('include', 'refFk');
|
isSelect: true,
|
||||||
cy.countTableRows('eq', 0);
|
},
|
||||||
//
|
{
|
||||||
cy.cleanFilterPanel();
|
name: 'State',
|
||||||
// Agency
|
selector: 'State_select',
|
||||||
cy.dataCy('Agency_select').click();
|
value: 'Libre',
|
||||||
cy.get('.q-item__label').contains('inhouse pickup').click();
|
urlParam: 'state',
|
||||||
cy.searchInFilterPanel();
|
rows: 13,
|
||||||
cy.url().should('include', 'agencyModeFk');
|
isSelect: true,
|
||||||
cy.countTableRows('eq', 6);
|
},
|
||||||
//
|
{
|
||||||
cy.cleanFilterPanel();
|
name: 'Grouped State',
|
||||||
// State
|
selector: 'Grouped State_select',
|
||||||
cy.dataCy('State_select').click();
|
value: 'Free',
|
||||||
cy.get('.q-item__label').contains('Libre').click();
|
urlParam: 'alertLevel',
|
||||||
cy.searchInFilterPanel();
|
rows: 18,
|
||||||
cy.url().should('include', 'stateFk');
|
isSelect: true,
|
||||||
cy.countTableRows('eq', 13);
|
},
|
||||||
//
|
{
|
||||||
cy.cleanFilterPanel();
|
name: 'Warehouse',
|
||||||
// AlertLevel
|
selector: 'Warehouse_select',
|
||||||
cy.dataCy('Grouped State_select').click();
|
value: 'Warehouse Two',
|
||||||
cy.get('.q-item__label').contains('Free').click();
|
urlParam: 'warehouseFk',
|
||||||
cy.searchInFilterPanel();
|
rows: 1,
|
||||||
cy.url().should('include', 'alertLevel');
|
isSelect: true,
|
||||||
cy.countTableRows('eq', 18);
|
},
|
||||||
//
|
{
|
||||||
cy.cleanFilterPanel();
|
name: 'ITP',
|
||||||
// Country
|
selector: 'ITP_select',
|
||||||
cy.dataCy('Country_select').click();
|
value: 'H',
|
||||||
cy.get('.q-item__label').contains('España').click();
|
urlParam: 'packing',
|
||||||
cy.searchInFilterPanel();
|
rows: 5,
|
||||||
cy.url().should('include', 'countryFk');
|
isSelect: true,
|
||||||
cy.countTableRows('eq', 28);
|
},
|
||||||
//
|
];
|
||||||
cy.cleanFilterPanel();
|
|
||||||
// Province
|
testCases.forEach(
|
||||||
cy.dataCy('Warehouse_select').click();
|
({ name, selector, value, urlParam, rows, intercept, wait, isSelect }) => {
|
||||||
cy.get('.q-item__label').contains('Warehouse Two').click();
|
cy.log(`Testing ${name}`);
|
||||||
cy.searchInFilterPanel();
|
|
||||||
cy.url().should('include', 'warehouseFk');
|
if (intercept) intercept();
|
||||||
cy.countTableRows('eq', 1);
|
|
||||||
//
|
if (isSelect) {
|
||||||
cy.cleanFilterPanel();
|
cy.dataCy(selector).click();
|
||||||
|
cy.get('.q-item__label').contains(value).click();
|
||||||
|
} else {
|
||||||
|
cy.dataCy(selector).type(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
cy.searchInFilterPanel();
|
||||||
|
cy.url().should('include', urlParam);
|
||||||
|
|
||||||
|
if (wait) {
|
||||||
|
cy.waitRequest(wait, () => cy.countTableRows('eq', rows));
|
||||||
|
} else {
|
||||||
|
cy.countTableRows('eq', rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
cy.cleanFilterPanel();
|
||||||
|
},
|
||||||
|
);
|
||||||
// Department
|
// Department
|
||||||
cy.selectOption('[data-cy="Department_select"]', 'EQUIPO ESPAÑA LEVANTE');
|
cy.selectOption('[data-cy="Department_select"]', 'EQUIPO ESPAÑA LEVANTE');
|
||||||
cy.searchInFilterPanel();
|
cy.searchInFilterPanel();
|
||||||
cy.url().should('include', 'departmentFk');
|
cy.url().should('include', 'departmentFk');
|
||||||
//
|
|
||||||
cy.cleanFilterPanel();
|
cy.cleanFilterPanel();
|
||||||
// ITP
|
|
||||||
cy.dataCy('ITP_select').click();
|
|
||||||
cy.get('.q-item__label').contains('H').click();
|
|
||||||
cy.searchInFilterPanel();
|
|
||||||
cy.url().should('include', 'packing');
|
|
||||||
cy.countTableRows('eq', 5);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Cols', () => {
|
it('Cols', () => {
|
||||||
|
@ -171,3 +181,10 @@ function checkScopeDays(scopeDays) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptFilterClient() {
|
||||||
|
cy.intercept('GET', '**/Clients*').as('filterClient');
|
||||||
|
}
|
||||||
|
function waitRequest() {
|
||||||
|
cy.wait('@filterClient');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue