#8582 - test: e2e monitorTicket #1391

Merged
jsegarra merged 51 commits from e2e_monitor into dev 2025-04-15 21:04:49 +00:00
6 changed files with 38 additions and 28 deletions
Showing only changes of commit d29a27999a - Show all commits

View File

@ -69,7 +69,7 @@ const refresh = () => window.location.reload();
'no-visible': !stateQuery.isLoading().value,
}"
size="sm"
data-cy="loading-spinner"
data-cy="navBar-spinner"
/>
<QSpace />
<div id="searchbar" class="searchbar"></div>

View File

@ -294,6 +294,7 @@ const getLocale = (label) => {
</QList>
</QForm>
<QInnerLoading
data-cy="filterPanel-spinner"
:label="t('globals.pleaseWait')"
:showing="isLoading"
color="primary"

View File

@ -36,7 +36,7 @@ describe('Monitor Tickets Table', () => {
selector: 'Client id_input',
value: '1101',
urlParam: 'clientFk',
rows: 7,
rows: 12,
},
{
name: 'Order id',
@ -50,9 +50,8 @@ describe('Monitor Tickets Table', () => {
selector: 'Days onward_input',
value: '2',
urlParam: 'scopeDays',
rows: 27,
rows: 37,
},
// ... resto de casos como selects
{
name: 'Agency',
selector: 'Agency_select',
@ -66,7 +65,7 @@ describe('Monitor Tickets Table', () => {
selector: 'State_select',
value: 'Libre',
urlParam: 'state',
rows: 13,
rows: 18,
isSelect: true,
},
{
@ -74,7 +73,7 @@ describe('Monitor Tickets Table', () => {
selector: 'Grouped State_select',
value: 'Free',
urlParam: 'alertLevel',
rows: 18,
rows: 24,
isSelect: true,
},
{
@ -90,7 +89,15 @@ describe('Monitor Tickets Table', () => {
selector: 'ITP_select',
value: 'H',
urlParam: 'packing',
rows: 5,
rows: 6,
isSelect: true,
},
{
name: 'Department',
selector: 'Department_select',
value: 'COMPRAS',
urlParam: 'departmentFk',
rows: 0,
isSelect: true,
},
];
@ -105,8 +112,6 @@ describe('Monitor Tickets Table', () => {
wait = '@salesRequest',
isSelect,
}) => {
cy.log(`Testing ${name}`);
if (intercept) intercept();
if (isSelect) {
@ -120,20 +125,18 @@ describe('Monitor Tickets Table', () => {
cy.url().should('include', urlParam);
if (wait) {
cy.waitRequest(wait, () => cy.countTableRows('eq', rows));
cy.waitRequest(wait, () => {
cy.countTableRows('eq', rows);
});
} else {
cy.waitSpinner();
cy.waitSpinner('filterPanel');
cy.countTableRows('eq', rows);
}
cy.cleanFilterPanel();
},
);
// Department
cy.selectOption('[data-cy="Department_select"]', 'EQUIPO ESPAÑA LEVANTE');
cy.searchInFilterPanel();
cy.url().should('include', 'departmentFk');
cy.cleanFilterPanel();
});
it('Cols', () => {
@ -151,12 +154,9 @@ describe('Monitor Tickets Table', () => {
cy.getRowCol('departmentFk').find('span').should('have.class', 'link').click();
cy.dataCy('DepartmentDescriptor').should('exist');
cy.getRowCol('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.tableActions().click({ ctrlKey: true });
cy.tableActions(1).click();
cy.get('.summaryHeader').should('exist');
});

View File

@ -6,9 +6,7 @@ describe('ParkingBasicData', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/shelving/parking/1/basic-data`);
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should(
'not.be.visible',
);
cy.get('[data-cy="navBar-spinner"]', { timeout: 10000 }).should('not.be.visible');
});
it('should give an error if the code aldready exists', () => {

View File

@ -12,3 +12,9 @@ Cypress.Commands.add('vnTableCreateBtn', () =>
Cypress.Commands.add('waitTableScrollLoad', () =>
cy.waitForElement('[data-q-vs-anchor]'),
);
Cypress.Commands.add('tableActions', (n = 0, child = 1) =>
cy.get(
`:nth-child(${child}) > .q-table--col-auto-width > [data-cy="tableAction-${n}"] > .q-btn__content > .q-icon`,
),
);

View File

@ -100,10 +100,15 @@ Cypress.Commands.add('getValue', (selector) => {
});
});
Cypress.Commands.add('waitSpinner', () => {
Cypress.Commands.add('waitSpinner', (_spinner = 'navBar') => {
const spinners = {
navBar: '[data-cy="navBar-spinner"]',
filterPanel: '[data-cy="filterPanel-spinner"]',
};
const spinner = spinners[_spinner];
cy.get('body').then(($body) => {
if ($body.find('[data-cy="loading-spinner"]').length) {
cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
if ($body.find(spinner).length) {
jsegarra marked this conversation as resolved Outdated

Quitar

Quitar
cy.get(spinner).should('not.be.visible');
}
});
});
@ -464,7 +469,7 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
cy.waitForElement('[data-cy="descriptor_actions"]');
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should('not.be.visible');
cy.waitSpinner();
cy.get('.q-btn')
.filter((index, el) => Cypress.$(el).find('.q-icon.' + iconClass).length > 0)
.then(($btn) => {