2019-06-10 14:58:08 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-10-18 19:36:30 +00:00
|
|
|
fdescribe('InvoiceOut descriptor path', () => {
|
2019-06-10 14:58:08 +00:00
|
|
|
const nightmare = createNightmare();
|
2019-06-27 10:38:30 +00:00
|
|
|
let bookedDate;
|
2019-06-10 14:58:08 +00:00
|
|
|
|
|
|
|
describe('as Administrative', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
|
|
|
.loginAndModule('administrative', 'ticket');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for tickets with an specific invoiceOut', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton)
|
|
|
|
.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222')
|
|
|
|
.waitToClick(selectors.ticketsIndex.advancedSearchButton)
|
2019-06-19 07:03:45 +00:00
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
2019-06-10 14:58:08 +00:00
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
2019-06-19 07:03:45 +00:00
|
|
|
expect(result).toEqual(1);
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate to the invoiceOut index', async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.invoiceOutButton)
|
|
|
|
.wait(selectors.invoiceOutIndex.searchInvoiceOutInput)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/invoice-out/index');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for the target invoiceOut', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222')
|
|
|
|
.waitToClick(selectors.invoiceOutIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.invoiceOutIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the invoiceOut summary`, async() => {
|
|
|
|
const url = await nightmare
|
2019-06-19 07:03:45 +00:00
|
|
|
.accessToSearchResult('T2222222')
|
2019-06-10 14:58:08 +00:00
|
|
|
.waitForURL('/summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the invoiceOut using the descriptor more menu', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.invoiceOutDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut)
|
|
|
|
.waitToClick(selectors.invoiceOutDescriptor.acceptDeleteButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('InvoiceOut deleted');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have been relocated to the invoiceOut index', async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/invoice-out/index');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should search for the deleted invouceOut to find no results`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'T2222222')
|
|
|
|
.waitToClick(selectors.invoiceOutIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0)
|
|
|
|
.countElement(selectors.invoiceOutIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate to the ticket index', async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for tickets with an specific invoiceOut to find no results', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton)
|
|
|
|
.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222')
|
|
|
|
.waitToClick(selectors.ticketsIndex.advancedSearchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should now navigate to the invoiceOut index', async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.invoiceOutButton)
|
|
|
|
.wait(selectors.invoiceOutIndex.searchInvoiceOutInput)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/invoice-out/index');
|
|
|
|
});
|
|
|
|
|
2019-06-19 07:03:45 +00:00
|
|
|
it(`should search and access to the invoiceOut summary`, async() => {
|
2019-06-10 14:58:08 +00:00
|
|
|
const url = await nightmare
|
2019-06-27 10:38:30 +00:00
|
|
|
.accessToSearchResult('T1111111')
|
2019-06-10 14:58:08 +00:00
|
|
|
.waitForURL('/summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
|
|
});
|
|
|
|
|
2019-06-27 10:38:30 +00:00
|
|
|
it(`should check the invoiceOut is booked in the summary data`, async() => {
|
2019-06-10 14:58:08 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
|
|
|
|
2019-06-27 10:38:30 +00:00
|
|
|
bookedDate = result;
|
|
|
|
|
|
|
|
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() => {
|
2019-06-10 14:58:08 +00:00
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.invoiceOutDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut)
|
|
|
|
.waitToClick(selectors.invoiceOutDescriptor.acceptBookingButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('InvoiceOut booked');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the invoiceOut booked in the summary data`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
|
|
|
|
2019-06-27 10:38:30 +00:00
|
|
|
expect(result).not.toEqual(bookedDate);
|
2019-06-10 14:58:08 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as salesPerson', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
|
|
|
.loginAndModule('salesPerson', 'invoiceOut')
|
|
|
|
.accessToSearchResult('A1111111');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the salesPerson role doens't see the book option in the more menu`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.invoiceOutDescriptor.moreMenu)
|
|
|
|
.wait(selectors.invoiceOutDescriptor.moreMenuShowInvoiceOutPdf)
|
|
|
|
.exists(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut);
|
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the salesPerson role doens't see the delete option in the more menu`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.exists(selectors.invoiceOutDescriptor.moreMenuDeleteInvoiceOut);
|
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|