2018-11-16 11:03:52 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import config from '../../helpers/config.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)
|
2018-11-16 11:03:52 +00:00
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
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-06-19 07:03:45 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave')
|
2018-11-16 11:03:52 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.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() => {
|
2019-06-19 07:03:45 +00:00
|
|
|
const itemId = 2;
|
2018-11-16 11:03:52 +00:00
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketSummary.firstSaleItemId)
|
|
|
|
.waitToClick(selectors.ticketSummary.popoverDiaryButton)
|
|
|
|
.waitForLogin('employee')
|
2019-06-19 07:03:45 +00:00
|
|
|
.goto(`${config.url}#!/item/${itemId}/diary?warehouseFk=1&ticketFk=1`)
|
2018-11-16 11:03:52 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/diary');
|
|
|
|
});
|
|
|
|
|
2019-06-19 07:03:45 +00:00
|
|
|
it(`should check the second line id is marked as counter`, 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
|
|
|
|
|
|
|
expect(result).toContain('counter');
|
|
|
|
});
|
|
|
|
|
2019-06-19 07:03:45 +00:00
|
|
|
it(`should check the third line balance is marked as counter`, async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const result = await nightmare
|
2019-06-19 07:03:45 +00:00
|
|
|
.waitToGetProperty(`${selectors.itemDiary.thirdBalance} > span`, 'className');
|
2018-11-16 11:03:52 +00:00
|
|
|
|
|
|
|
expect(result).toContain('counter');
|
|
|
|
});
|
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|