2019-01-08 11:02:38 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-02-06 15:40:12 +00:00
|
|
|
// Bug #808 order.basic-data
|
|
|
|
xdescribe('Order edit basic data path', () => {
|
2019-01-08 11:02:38 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
describe('when confirmed order', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
|
|
|
.loginAndModule('employee', 'order')
|
|
|
|
.accessToSearchResult('1')
|
|
|
|
.accessToSection('order.card.basicData');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not be able to change the client', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark')
|
2019-01-23 15:00:56 +00:00
|
|
|
.waitToClick(selectors.orderBasicData.saveButton)
|
2019-01-08 11:02:38 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('when order with rows', () => {
|
|
|
|
it('should now navigate to order index', async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.returnToModuleIndexButton)
|
|
|
|
.waitToClick(selectors.globalItems.acceptVnConfirm)
|
|
|
|
.wait(selectors.ordersIndex.createOrderButton)
|
|
|
|
.accessToSearchResult('16')
|
|
|
|
.accessToSection('order.card.basicData')
|
2019-02-06 15:40:12 +00:00
|
|
|
.wait(selectors.orderBasicData.observationInput)
|
2019-01-08 11:02:38 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/order/16/basic-data');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not be able to change the company', async() => {
|
|
|
|
const result = await nightmare
|
2019-02-06 15:40:12 +00:00
|
|
|
.write(selectors.orderBasicData.observationInput, 'observation')
|
2019-01-23 15:00:56 +00:00
|
|
|
.waitToClick(selectors.orderBasicData.saveButton)
|
2019-01-08 11:02:38 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual(`You can't make changes on the basic data of an confirmed order or with rows`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('when new order', () => {
|
2019-01-23 14:34:16 +00:00
|
|
|
it('should once more navigate to order index', async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.returnToModuleIndexButton)
|
|
|
|
.waitToClick(selectors.globalItems.acceptVnConfirm)
|
|
|
|
.wait(selectors.ordersIndex.createOrderButton)
|
2019-01-08 11:02:38 +00:00
|
|
|
.accessToSearchResult('18')
|
2019-01-23 14:34:16 +00:00
|
|
|
.accessToSection('order.card.basicData')
|
2019-02-06 15:40:12 +00:00
|
|
|
.wait(selectors.orderBasicData.observationInput)
|
2019-01-23 14:34:16 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/order/18/basic-data');
|
2019-01-08 11:02:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should be able to modify all the properties', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark')
|
|
|
|
.clearInput(selectors.orderBasicData.observationInput)
|
2019-01-23 14:34:16 +00:00
|
|
|
.write(selectors.orderBasicData.observationInput, 'Observation modified')
|
2019-01-23 15:00:56 +00:00
|
|
|
.waitToClick(selectors.orderBasicData.saveButton)
|
2019-01-08 11:02:38 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should now confirm the client have been edited', async() => {
|
|
|
|
const result = await nightmare
|
2019-01-27 20:09:54 +00:00
|
|
|
.reloadSection('order.card.basicData')
|
2019-01-08 11:02:38 +00:00
|
|
|
.waitToGetProperty(`${selectors.orderBasicData.clientAutocomplete} input`, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('104: Tony Stark');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should now confirm the observations have been edited', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.orderBasicData.observationInput, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('Observation modified');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|