/// describe('UserPanel', () => { beforeEach(() => { cy.viewport(1280, 720); cy.login('developer'); cy.visit(`/#dashboard`); cy.waitForElement('.q-page', 6000); cy.openUserPanel(); }); it('should notify when update user company', () => { changeSelect('User company', 'VNH', 'VNL'); }); it('should notify when update user warehouse', () => { changeSelect('User warehouse', 'TestingWarehouse', 'Warehouse One'); }); function changeSelect(field, newOption, oldOption) { cy.get('.q-menu') .contains(field) .then(($field) => { cy.wrap($field).contains(oldOption); cy.selectOption($field, newOption); cy.checkNotification('Data saved'); cy.wrap($field).contains(newOption); // Restore cy.selectOption($field, oldOption); }); } });