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
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-11-16 11:03:52 +00:00
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.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
|
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
|
|
|
.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() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketSummary.firstSaleItemId)
|
|
|
|
.waitToClick(selectors.ticketSummary.popoverDiaryButton)
|
|
|
|
.waitForLogin('employee')
|
|
|
|
.goto(`${config.url}#!/item/1/diary?warehouseFk=1&ticketFk=1`)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/diary');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should check the seventh line id is marked as counter`, async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const result = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemDiary.thirdTicketId, 'className');
|
2018-11-16 11:03:52 +00:00
|
|
|
|
|
|
|
expect(result).toContain('counter');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should check the fifth line balance is marked as counter`, async() => {
|
2018-11-16 11:03:52 +00:00
|
|
|
const result = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemDiary.fifthBalance, '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');
|
|
|
|
});
|
|
|
|
});
|