2019-06-10 14:58:08 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-06-10 14:58:08 +00:00
|
|
|
|
2020-09-03 10:01:57 +00:00
|
|
|
describe('InvoiceOut descriptor path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
2019-06-10 14:58:08 +00:00
|
|
|
|
2020-01-26 23:48:00 +00:00
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('administrative', 'ticket');
|
|
|
|
});
|
2020-01-23 15:01:29 +00:00
|
|
|
|
2020-01-26 23:48:00 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
2019-06-10 14:58:08 +00:00
|
|
|
|
2020-01-26 23:48:00 +00:00
|
|
|
describe('as Administrative', () => {
|
2019-06-10 14:58:08 +00:00
|
|
|
it('should search for tickets with an specific invoiceOut', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
|
2020-09-03 10:01:57 +00:00
|
|
|
await page.clearInput(selectors.ticketsIndex.advancedSearchDaysOnward);
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222');
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.advancedSearchButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
2020-03-17 10:00:16 +00:00
|
|
|
it('should navigate to the invoiceOut index', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.invoiceOutButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.invoiceOutIndex.topbarSearch);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('invoiceOut.index');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the invoiceOut summary`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.accessToSearchResult('T2222222');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('invoiceOut.card.summary');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the invoiceOut using the descriptor more menu', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut);
|
|
|
|
await page.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-06-10 14:58:08 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('InvoiceOut deleted');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have been relocated to the invoiceOut index', async() => {
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('invoiceOut.index');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should search for the deleted invouceOut to find no results`, async() => {
|
2020-03-31 16:33:48 +00:00
|
|
|
await page.doSearch('T2222222');
|
|
|
|
const nResults = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
2019-06-10 14:58:08 +00:00
|
|
|
|
2020-03-31 16:33:48 +00:00
|
|
|
expect(nResults).toEqual(0);
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate to the ticket index', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.index');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
2020-08-28 17:52:54 +00:00
|
|
|
it('should search now for tickets with an specific invoiceOut to find no results', async() => {
|
2020-03-31 16:33:48 +00:00
|
|
|
await page.doSearch('T2222222');
|
|
|
|
const nResults = await page.countElement(selectors.ticketsIndex.searchResult);
|
2019-06-10 14:58:08 +00:00
|
|
|
|
2020-03-31 16:33:48 +00:00
|
|
|
expect(nResults).toEqual(0);
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should now navigate to the invoiceOut index', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.invoiceOutButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('invoiceOut.index');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
2019-06-19 07:03:45 +00:00
|
|
|
it(`should search and access to the invoiceOut summary`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.accessToSearchResult('T1111111');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('invoiceOut.card.summary');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 10:38:30 +00:00
|
|
|
it(`should check the invoiceOut is booked in the summary data`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitForTextInElement(selectors.invoiceOutSummary.bookedLabel, '/');
|
|
|
|
const result = await page.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
2019-06-10 14:58:08 +00:00
|
|
|
|
2019-06-27 10:38:30 +00:00
|
|
|
expect(result.length).toBeGreaterThan(1);
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
2019-06-27 10:38:30 +00:00
|
|
|
it('should re-book the invoiceOut using the descriptor more menu', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut);
|
|
|
|
await page.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-06-10 14:58:08 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('InvoiceOut booked');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the invoiceOut booked in the summary data`, async() => {
|
2019-10-29 10:28:35 +00:00
|
|
|
let today = new Date();
|
2019-11-12 07:51:50 +00:00
|
|
|
|
|
|
|
let day = today.getDate();
|
|
|
|
if (day < 10) day = `0${day}`;
|
|
|
|
|
|
|
|
let month = (today.getMonth() + 1);
|
|
|
|
if (month < 10) month = `0${month}`;
|
|
|
|
|
|
|
|
let expectedDate = `${day}/${month}/${today.getFullYear()}`;
|
2019-10-29 10:28:35 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
await page.waitForContentLoaded();
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2019-06-10 14:58:08 +00:00
|
|
|
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
|
|
|
|
2019-10-29 10:28:35 +00:00
|
|
|
expect(result).toEqual(expectedDate);
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as salesPerson', () => {
|
2020-01-26 23:48:00 +00:00
|
|
|
it(`should log in as salesPerson then go to the target invoiceOut summary`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.loginAndModule('salesPerson', 'invoiceOut');
|
|
|
|
await page.accessToSearchResult('A1111111');
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the salesPerson role doens't see the book option in the more menu`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.invoiceOutDescriptor.moreMenu);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf);
|
2020-01-26 23:48:00 +00:00
|
|
|
await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut, {hidden: true});
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the salesPerson role doens't see the delete option in the more menu`, async() => {
|
2020-01-26 23:48:00 +00:00
|
|
|
await page.waitForSelector(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut, {hidden: true});
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|