This commit is contained in:
parent
c6d4e2ffe5
commit
b911211000
|
@ -8,28 +8,24 @@ describe('UserPanel', () => {
|
||||||
cy.openUserPanel();
|
cy.openUserPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should notify when update user warehouse', () => {
|
|
||||||
const userWarehouse = '.q-menu .q-gutter-xs > :nth-child(3) > .q-field';
|
|
||||||
const oldOption = 'VNL';
|
|
||||||
const newOption = 'VNH';
|
|
||||||
cy.get(userWarehouse).contains(oldOption);
|
|
||||||
cy.selectOption(userWarehouse, newOption);
|
|
||||||
cy.checkNotification('Data saved');
|
|
||||||
cy.get(userWarehouse).contains(newOption);
|
|
||||||
|
|
||||||
// Restore
|
|
||||||
cy.selectOption(userWarehouse, oldOption);
|
|
||||||
});
|
|
||||||
it('should notify when update user company', () => {
|
it('should notify when update user company', () => {
|
||||||
const userCompany = '.q-menu .q-gutter-xs > :nth-child(2) > .q-field';
|
changeSelect('User company', 'VNH', 'VNL');
|
||||||
const oldOption = 'Warehouse One';
|
|
||||||
const newOption = 'TestingWarehouse';
|
|
||||||
cy.get(userCompany).contains(oldOption);
|
|
||||||
cy.selectOption(userCompany, newOption);
|
|
||||||
cy.checkNotification('Data saved');
|
|
||||||
cy.get(userCompany).contains(newOption);
|
|
||||||
|
|
||||||
// Restore
|
|
||||||
cy.selectOption(userCompany, oldOption);
|
|
||||||
});
|
});
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue