2019-03-12 07:38:17 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-05-24 13:56:19 +00:00
|
|
|
describe('Ticket descriptor path', () => {
|
2019-03-12 07:38:17 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
2019-06-21 11:19:51 +00:00
|
|
|
.loginAndModule('salesperson', 'ticket');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Delete ticket', () => {
|
|
|
|
it('should search for an specific ticket', async() => {
|
|
|
|
const result = await nightmare
|
2019-06-19 12:40:47 +00:00
|
|
|
.write(selectors.ticketsIndex.searchTicketInput, 18)
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the ticket summary`, async() => {
|
|
|
|
const url = await nightmare
|
2019-06-19 12:40:47 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Cerebro')
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitForURL('/summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
|
|
});
|
|
|
|
|
2019-08-21 07:32:21 +00:00
|
|
|
it('should open the change shipped hours dialog by using the more menu option', async() => {
|
|
|
|
const visible = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour)
|
|
|
|
.wait(selectors.ticketDescriptor.changeShippedHourInput)
|
|
|
|
.isVisible(selectors.ticketDescriptor.changeShippedHourInput);
|
|
|
|
|
|
|
|
|
|
|
|
expect(visible).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should update the shipped hour`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.write(selectors.ticketDescriptor.changeShippedHourInput, '0815')
|
|
|
|
.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Shipped hour updated');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toContain('08:15');
|
|
|
|
});
|
|
|
|
|
2019-03-12 07:38:17 +00:00
|
|
|
it('should delete the ticket using the descriptor more menu', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket)
|
2019-03-20 14:33:33 +00:00
|
|
|
.waitToClick(selectors.ticketDescriptor.acceptDeleteButton)
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Ticket deleted');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have been relocated to the ticket index', async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should search for the deleted ticket and check it's date`, async() => {
|
|
|
|
const result = await nightmare
|
2019-06-19 12:40:47 +00:00
|
|
|
.write(selectors.ticketsIndex.searchTicketInput, 18)
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.wait(selectors.ticketsIndex.searchResultDate)
|
|
|
|
.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toContain(2000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('add stowaway', () => {
|
|
|
|
it('should search for a ticket', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.clearInput(selectors.ticketsIndex.searchTicketInput)
|
2019-06-19 12:40:47 +00:00
|
|
|
.write(selectors.ticketsIndex.searchTicketInput, 16)
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
2019-06-19 07:03:45 +00:00
|
|
|
it(`should now click on the search result to access to the ticket summary`, async() => {
|
2019-03-12 07:38:17 +00:00
|
|
|
const url = await nightmare
|
2019-06-19 12:40:47 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Many Places')
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitForURL('/summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should open the add stowaway dialog', async() => {
|
|
|
|
const isVisible = await nightmare
|
2019-09-06 07:47:58 +00:00
|
|
|
.waitForSpinnerLoad()
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway)
|
2019-06-19 07:03:45 +00:00
|
|
|
.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
|
|
|
|
.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
|
2019-03-12 07:38:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
expect(isVisible).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
2019-06-19 07:03:45 +00:00
|
|
|
it('should add a ticket as stowaway', async() => {
|
2019-03-12 07:38:17 +00:00
|
|
|
const result = await nightmare
|
2019-06-19 07:03:45 +00:00
|
|
|
.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
|
2019-03-12 07:38:17 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should navigate to the added ticket using the descriptors ship button`, async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
|
2019-06-19 07:03:45 +00:00
|
|
|
.waitToClick(selectors.ticketDescriptor.shipButton)
|
2019-06-19 12:40:47 +00:00
|
|
|
.waitForURL('#!/ticket/17/summary')
|
2019-03-12 07:38:17 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
2019-06-19 12:40:47 +00:00
|
|
|
expect(url.hash).toContain('#!/ticket/17/summary');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
2019-07-01 11:41:38 +00:00
|
|
|
it(`should check the state of the stowaway ticket is embarked`, async() => {
|
|
|
|
const state = await nightmare
|
|
|
|
.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
|
|
|
|
|
|
|
expect(state).toEqual('State Embarcando');
|
|
|
|
});
|
|
|
|
|
2019-03-12 07:38:17 +00:00
|
|
|
it(`should navigate to the ship ticket using the descriptors ship button`, async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.shipButton)
|
2019-06-19 12:40:47 +00:00
|
|
|
.waitForURL('#!/ticket/16/summary')
|
2019-03-12 07:38:17 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
2019-06-19 12:40:47 +00:00
|
|
|
expect(url.hash).toContain('#!/ticket/16/summary');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
2019-03-20 14:33:33 +00:00
|
|
|
|
|
|
|
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
|
2019-06-19 07:03:45 +00:00
|
|
|
.waitToClick(selectors.ticketDescriptor.shipButton)
|
2019-06-19 12:40:47 +00:00
|
|
|
.waitForURL('#!/ticket/17/summary')
|
2019-03-20 14:33:33 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
2019-06-19 12:40:47 +00:00
|
|
|
expect(url.hash).toContain('#!/ticket/17/summary');
|
2019-03-20 14:33:33 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the stowaway', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the ship buton doesn't exisist any more`, async() => {
|
|
|
|
const exists = await nightmare
|
|
|
|
.exists(selectors.ticketDescriptor.shipButton);
|
|
|
|
|
|
|
|
expect(exists).toBeFalsy();
|
|
|
|
});
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
2019-04-23 06:58:49 +00:00
|
|
|
|
|
|
|
describe('Make invoice', () => {
|
2019-04-23 11:29:52 +00:00
|
|
|
it('should login as adminBoss role then search for a ticket', async() => {
|
2019-06-19 12:40:47 +00:00
|
|
|
const invoiceableTicketId = 14;
|
2019-04-23 06:58:49 +00:00
|
|
|
|
|
|
|
const url = await nightmare
|
2019-04-23 11:29:52 +00:00
|
|
|
.loginAndModule('adminBoss', 'ticket')
|
2019-04-23 06:58:49 +00:00
|
|
|
.accessToSearchResult(invoiceableTicketId)
|
|
|
|
.waitForURL('/summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain(`ticket/${invoiceableTicketId}/summary`);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toEqual('-');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should invoice the ticket using the descriptor more menu', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice)
|
|
|
|
.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Ticket invoiced');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should make sure the ticket summary have an invoiceOutFk`, async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445')
|
|
|
|
.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toEqual('T4444445');
|
|
|
|
});
|
|
|
|
});
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|