2018-02-22 15:44:14 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-02-22 15:44:14 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Item', () => {
|
|
|
|
describe('Summary path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-02-22 15:44:14 +00:00
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
beforeAll(done => {
|
|
|
|
nightmare
|
2018-10-11 07:14:26 +00:00
|
|
|
.waitForLogin('employee');
|
2018-10-24 08:57:14 +00:00
|
|
|
done();
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-02 11:15:17 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should access to the items index by clicking the items button', done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.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-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should search for the item Gem of Time', done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.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-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result summary button to open the item summary popup`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
|
|
|
|
.isVisible(selectors.itemSummary.basicData)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
|
|
|
.isVisible(selectors.itemSummary.basicData);
|
|
|
|
})
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toBeTruthy();
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary preview shows fields from basic data`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
|
|
|
|
.getInnerText(selectors.itemSummary.basicData)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Name: Gem of Time');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary preview shows fields from tags`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
|
|
|
|
.getInnerText(selectors.itemSummary.tags)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Color: Yellow');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary preview shows fields from niche`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1')
|
|
|
|
.getInnerText(selectors.itemSummary.niche)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Warehouse One: A1');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-24 08:57:14 +00:00
|
|
|
it(`should check the item summary preview shows fields from botanical`, async() => {
|
|
|
|
let result = await nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
|
2018-10-24 08:57:14 +00:00
|
|
|
.getInnerText(selectors.itemSummary.botanical);
|
|
|
|
|
|
|
|
expect(result).toContain('Botanical: Hedera helix');
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary preview shows fields from barcode`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.barcode, '1')
|
|
|
|
.getInnerText(selectors.itemSummary.barcode)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('1');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should close the summary popup`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
|
|
|
|
.isVisible(selectors.itemSummary.basicData)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toBeFalsy();
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should navigate to the one of the items detailed section`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitForURL('summary')
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
|
|
|
expect(url.hash).toContain('summary');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary shows fields from basic data section`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
|
|
|
|
.getInnerText(selectors.itemSummary.basicData)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Name: Gem of Time');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-04 07:21:33 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary shows fields from tags section`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.getInnerText(selectors.itemSummary.tags)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Color: Yellow');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-04 07:21:33 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary shows fields from niches section`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.getInnerText(selectors.itemSummary.niche)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Warehouse One: A1');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-04 07:21:33 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary shows fields from botanical section`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.getInnerText(selectors.itemSummary.botanical)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Botanical: Hedera helix');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-04 07:21:33 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should check the item summary shows fields from barcodes section`, done => {
|
2018-10-24 08:57:14 +00:00
|
|
|
nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.getInnerText(selectors.itemSummary.barcode)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('1');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|