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

66 lines
2.4 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-01-23 14:33:25 +00:00
.write(selectors.ticketsIndex.searchTicketInput, 'id: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
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.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() => {
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
.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
2019-02-19 15:37:17 +00:00
.waitToGetProperty(`${selectors.itemDiary.fifthBalance} > 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')
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
2018-11-16 11:03:52 +00:00
expect(result).toContain('balance');
});
});