test: refs #8659 enhance AgencyWorkCenter tests with data attributes and improved messages
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
c7b753a4ef
commit
08b802955c
|
@ -80,6 +80,7 @@ async function deleteWorCenter(id) {
|
|||
color="primary"
|
||||
round
|
||||
flat
|
||||
data-cy="removeWorkCenterBtn"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -1,27 +1,40 @@
|
|||
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', () => {
|
||||
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();
|
||||
it('Should expect error when duplicate', () => {
|
||||
cy.addBtnClick();
|
||||
cy.selectOption('[data-cy="workCenter_select"]', 'workCenterOne');
|
||||
cy.dataCy(selectors.popupSave).click();
|
||||
cy.checkNotification(messages.alreadyAssigned);
|
||||
cy.dataCy(selectors.popupCancel).click();
|
||||
});
|
||||
|
||||
// delete
|
||||
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.checkNotification('WorkCenter removed successfully');
|
||||
it('Should remove work center', () => {
|
||||
cy.dataCy(selectors.remove).click();
|
||||
cy.checkNotification(messages.removed);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue