Merge pull request 'test: refs #8659 enhance AgencyWorkCenter tests with data attributes and improved messages' (!1483) from 8659-fixAgencyWorkCenterE2eTest into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1483
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Jose Antonio Tubau 2025-03-12 10:20:05 +00:00
commit 75adb54761
2 changed files with 26 additions and 18 deletions

View File

@ -80,6 +80,7 @@ async function deleteWorCenter(id) {
color="primary"
round
flat
data-cy="removeWorkCenterBtn"
/>
</QItemSection>
</QItem>

View File

@ -1,27 +1,34 @@
describe.skip('AgencyWorkCenter', () => {
describe('AgencyWorkCenter', () => {
const selectors = {
workCenter: 'workCenter_select',
popupSave: 'FormModelPopup_save',
popupCancel: 'FormModelPopup_cancel',
remove: 'removeWorkCenterBtn',
};
const messages = {
dataCreated: 'Data created',
alreadyAssigned: 'This workCenter is already assigned to this agency',
removed: 'WorkCenter removed successfully',
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency/11/workCenter`);
});
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
const workCenterCombobox = 'input[role="combobox"]';
it('check workCenter crud', () => {
// create
cy.get(createButton).click();
cy.get(workCenterCombobox).type('workCenterOne{enter}');
it('Should add work center, check already assigned and remove work center', () => {
cy.addBtnClick();
cy.selectOption('[data-cy="workCenter_select"]', 'workCenterOne');
cy.dataCy(selectors.popupSave).click();
cy.checkNotification('Data created');
// expect error when duplicate
cy.get(createButton).click();
cy.selectOption(workCenterCombobox, 'workCenterOne');
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.checkNotification('This workCenter is already assigned to this agency');
cy.get('[data-cy="FormModelPopup_cancel"]').click();
// delete
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
cy.checkNotification('WorkCenter removed successfully');
cy.addBtnClick();
cy.selectOption('[data-cy="workCenter_select"]', 'workCenterOne');
cy.dataCy(selectors.popupSave).click();
cy.checkNotification(messages.alreadyAssigned);
cy.dataCy(selectors.popupCancel).click();
cy.dataCy(selectors.remove).click();
cy.checkNotification(messages.removed);
});
});