2018-02-20 21:35:54 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Item', () => {
|
|
|
|
describe('Create niche path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-02-20 21:35:54 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitForLogin('developer');
|
|
|
|
});
|
2018-03-02 11:15:17 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should access to the items index by clicking the items button', () => {
|
|
|
|
return nightmare
|
|
|
|
.click(selectors.moduleAccessView.itemsSectionButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
2018-05-25 08:03:45 +00:00
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-02-20 21:35:54 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should search for the item Gem of Time', () => {
|
|
|
|
return nightmare
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
2018-08-02 12:04:46 +00:00
|
|
|
.countElement(selectors.itemsIndex.searchResult)
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
2018-02-20 21:35:54 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should click on the search result to access to the item niches`, () => {
|
|
|
|
return nightmare
|
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.itemNiches.nicheButton)
|
|
|
|
.waitForURL('niche')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('niche');
|
|
|
|
});
|
2018-02-20 21:35:54 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should click create a new niche and delete a former one`, () => {
|
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.itemNiches.addNicheButton)
|
|
|
|
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
|
|
|
|
.waitToClick(selectors.itemNiches.thirdWarehouseSelect)
|
|
|
|
.waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption)
|
|
|
|
.type(selectors.itemNiches.thirdCodeInput, 'A4')
|
|
|
|
.click(selectors.itemNiches.submitNichesButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-02-20 21:35:54 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the first niche is the expected one`, () => {
|
2018-03-05 11:26:00 +00:00
|
|
|
return nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.click(selectors.itemBasicData.basicDataButton)
|
|
|
|
.wait(selectors.itemBasicData.nameInput)
|
|
|
|
.click(selectors.itemNiches.nicheButton)
|
2018-08-30 06:50:03 +00:00
|
|
|
.waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One')
|
|
|
|
.getInputValue(selectors.itemNiches.firstWarehouseSelect)
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Warehouse One');
|
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemNiches.firstCodeInput);
|
|
|
|
})
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('A1');
|
|
|
|
});
|
2018-03-05 11:26:00 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the second niche is the expected one`, () => {
|
2018-03-05 11:26:00 +00:00
|
|
|
return nightmare
|
2018-08-30 06:50:03 +00:00
|
|
|
.getInputValue(selectors.itemNiches.secondWarehouseSelect)
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Warehouse Three');
|
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemNiches.secondCodeInput);
|
|
|
|
})
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('A3');
|
|
|
|
});
|
2018-03-05 11:26:00 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the third niche is the expected one`, () => {
|
2018-03-05 11:26:00 +00:00
|
|
|
return nightmare
|
2018-08-30 06:50:03 +00:00
|
|
|
.getInputValue(selectors.itemNiches.thirdWarehouseSelect)
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
2018-08-30 06:50:03 +00:00
|
|
|
expect(result).toEqual('Warehouse Two');
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemNiches.thirdCodeInput);
|
|
|
|
})
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('A4');
|
|
|
|
});
|
2018-02-20 21:35:54 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|