2018-02-15 11:28:05 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-02-20 12:48:25 +00:00
|
|
|
import createNightmare from '../../helpers/helpers';
|
2018-02-15 11:28:05 +00:00
|
|
|
|
2018-02-15 12:20:01 +00:00
|
|
|
describe('create item barcodes path', () => {
|
2018-02-20 12:48:25 +00:00
|
|
|
const nightmare = createNightmare();
|
2018-02-15 11:28:05 +00:00
|
|
|
|
2018-02-20 12:48:25 +00:00
|
|
|
it('should access to the items index by clicking the items button', () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.click(selectors.moduleAccessView.itemsSectionButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
2018-02-20 12:48:25 +00:00
|
|
|
.urlParsed()
|
2018-02-15 11:28:05 +00:00
|
|
|
.then(url => {
|
2018-02-20 12:48:25 +00:00
|
|
|
expect(url.hash).toEqual('#!/item/list');
|
|
|
|
});
|
2018-02-15 11:28:05 +00:00
|
|
|
});
|
2018-02-15 12:20:01 +00:00
|
|
|
|
2018-02-20 12:48:25 +00:00
|
|
|
it('should search for the item Gem of Time', () => {
|
|
|
|
return nightmare
|
2018-02-15 12:20:01 +00:00
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
|
|
|
.countSearchResults(selectors.itemsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-02-20 12:48:25 +00:00
|
|
|
});
|
2018-02-15 12:20:01 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 12:48:25 +00:00
|
|
|
it(`should click on the search result to access to the item barcodes`, () => {
|
|
|
|
return nightmare
|
2018-02-19 10:55:45 +00:00
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.itemBarcodes.barcodeButton)
|
|
|
|
.waitForURL('barcode')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('barcode');
|
2018-02-20 12:48:25 +00:00
|
|
|
});
|
2018-02-19 10:55:45 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 12:48:25 +00:00
|
|
|
it(`should click create a new code and delete a former one`, () => {
|
|
|
|
return nightmare
|
2018-02-19 10:55:45 +00:00
|
|
|
.waitToClick(selectors.itemBarcodes.addBarcodeButton)
|
|
|
|
.type(selectors.itemBarcodes.fourthCodeInput, '5')
|
|
|
|
.click(selectors.itemBarcodes.firstCodeRemoveButton)
|
|
|
|
.click(selectors.itemBarcodes.submitBarcodesButton)
|
2018-02-20 12:48:25 +00:00
|
|
|
.waitForSnackbar()
|
2018-02-19 10:55:45 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Data saved!');
|
2018-02-20 12:48:25 +00:00
|
|
|
});
|
2018-02-19 10:55:45 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 12:48:25 +00:00
|
|
|
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, () => {
|
|
|
|
return nightmare
|
2018-02-19 10:55:45 +00:00
|
|
|
.click(selectors.itemBasicData.basicDataButton)
|
|
|
|
.wait(selectors.itemBasicData.nameInput)
|
|
|
|
.click(selectors.itemBarcodes.barcodeButton)
|
|
|
|
.wait(200)
|
|
|
|
.getInputValue(selectors.itemBarcodes.thirdCodeInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('5');
|
2018-02-19 19:50:01 +00:00
|
|
|
});
|
|
|
|
});
|
2018-02-15 11:28:05 +00:00
|
|
|
});
|