2018-11-16 11:03:52 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
|
|
|
describe('Ticket diary path', () => {
|
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
2018-11-23 07:05:57 +00:00
|
|
|
.loginAndModule('employee', 'ticket');
|
2018-11-16 11:03:52 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should search for a specific ticket', async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const result = await nightmare
|
2019-06-19 07:03:45 +00:00
|
|
|
.write(selectors.ticketsIndex.searchTicketInput, 1)
|
2019-01-23 15:00:56 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
2019-11-10 13:13:55 +00:00
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
2018-11-16 11:03:52 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should click on the search result to access to the ticket summary`, async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const url = await nightmare
|
2019-11-10 13:13:55 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
2018-11-16 11:03:52 +00:00
|
|
|
.waitForURL('/summary')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-11-16 11:03:52 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('/summary');
|
2018-11-16 11:03:52 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketSummary.firstSaleItemId)
|
|
|
|
.waitToClick(selectors.ticketSummary.popoverDiaryButton)
|
2019-11-28 11:54:34 +00:00
|
|
|
.waitForURL('/diary')
|
2018-11-16 11:03:52 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/diary');
|
|
|
|
});
|
|
|
|
|
2019-09-12 11:20:07 +00:00
|
|
|
it(`should check the second line id is marked as message`, async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const result = await nightmare
|
2019-06-19 07:03:45 +00:00
|
|
|
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
|
2018-11-16 11:03:52 +00:00
|
|
|
|
2019-09-12 11:20:07 +00:00
|
|
|
expect(result).toContain('message');
|
2018-11-16 11:03:52 +00:00
|
|
|
});
|
|
|
|
|
2019-09-12 11:20:07 +00:00
|
|
|
it(`should check the third line balance is marked as message`, async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const result = await nightmare
|
2019-07-01 09:56:16 +00:00
|
|
|
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
|
2018-11-16 11:03:52 +00:00
|
|
|
|
2019-09-12 11:20:07 +00:00
|
|
|
expect(result).toContain('message');
|
2018-11-16 11:03:52 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const result = await nightmare
|
2019-01-07 08:33:07 +00:00
|
|
|
.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two')
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
|
2018-11-16 11:03:52 +00:00
|
|
|
|
|
|
|
expect(result).toContain('balance');
|
|
|
|
});
|
|
|
|
});
|