0
0
Fork 0

perf: refs #6943 #6943 merge command

This commit is contained in:
Javier Segarra 2024-10-25 10:33:59 +02:00
parent 21c4468fce
commit ff559384aa
3 changed files with 14 additions and 16 deletions

View File

@ -11,16 +11,16 @@ describe('AgencyWorkCenter', () => {
// create // create
cy.get(createButton).click(); cy.get(createButton).click();
cy.get(workCenterCombobox).type('workCenterOne{enter}'); cy.get(workCenterCombobox).type('workCenterOne{enter}');
cy.hasNotify('Data created'); cy.checkNotification('created');
// expect error when duplicate // expect error when duplicate
cy.get(createButton).click(); cy.get(createButton).click();
cy.get('[data-cy="FormModelPopup_save"]').click(); cy.get('[data-cy="FormModelPopup_save"]').click();
cy.hasNotify('This workCenter is already assigned to this agency'); cy.checkNotification('This workCenter is already assigned to this agency');
cy.get('[data-cy="FormModelPopup_cancel"]').click(); cy.get('[data-cy="FormModelPopup_cancel"]').click();
// delete // delete
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click(); cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
cy.hasNotify('WorkCenter removed successfully'); cy.checkNotification('WorkCenter removed successfully');
}); });
}); });

View File

@ -17,7 +17,9 @@ describe('WorkerNotificationsManager', () => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/worker/${salesPersonId}/notifications`); cy.visit(`/#/worker/${salesPersonId}/notifications`);
cy.get(firstAvailableNotification).click(); cy.get(firstAvailableNotification).click();
cy.hasNotify('The notification subscription of this worker cant be modified'); cy.checkNotification(
'The notification subscription of this worker cant be modified'
);
}); });
it('should active a notification that is yours', () => { it('should active a notification that is yours', () => {

View File

@ -274,21 +274,13 @@ Cypress.Commands.add('openActions', (row) => {
cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click(); cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click();
}); });
Cypress.Commands.add('checkNotification', (type) => { Cypress.Commands.add('checkNotification', (tag) => {
const values = { const defaultTags = {
created: 'Data created', created: 'Data created',
updated: 'Data saved', updated: 'Data saved',
deleted: 'Data deleted', deleted: 'Data deleted',
}; }; //last
cy.get('.q-notification__message').should('have.text', values[type]); const text = defaultTags[tag] ?? tag;
});
Cypress.Commands.add('searchByLabel', (label, value) => {
cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
});
Cypress.Commands.add('hasNotify', (text) => {
//last
cy.get('.q-notification') cy.get('.q-notification')
.should('be.visible') .should('be.visible')
.last() .last()
@ -297,3 +289,7 @@ Cypress.Commands.add('hasNotify', (text) => {
throw new Error(`Notification not found: "${text}"`); throw new Error(`Notification not found: "${text}"`);
}); });
}); });
Cypress.Commands.add('searchByLabel', (label, value) => {
cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
});