salix/e2e/paths/05-ticket-module/11_diary.spec.js

67 lines
2.5 KiB
JavaScript
Raw Normal View History

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
.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')
.parsedUrl();
2018-11-16 11:03:52 +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-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
.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')
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
2018-11-16 11:03:52 +00:00
expect(result).toContain('balance');
});
});