2019-03-12 07:38:17 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-03-12 07:38:17 +00:00
|
|
|
|
2019-09-30 11:02:11 +00:00
|
|
|
describe('Ticket descriptor path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
2019-03-12 07:38:17 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('salesperson', 'ticket');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
2019-11-13 11:18:30 +00:00
|
|
|
describe('Delete ticket', () => {
|
2019-03-12 07:38:17 +00:00
|
|
|
it('should search for an specific ticket', async() => {
|
2020-03-17 13:01:25 +00:00
|
|
|
await page.accessToSearchResult('18');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
2019-10-15 05:23:34 +00:00
|
|
|
it(`should update the shipped hour using the descriptor menu`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.pickTime(selectors.ticketDescriptor.changeShippedHour, '08:15');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-08-21 07:32:21 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Shipped hour updated');
|
2019-08-21 07:32:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => {
|
2020-11-09 13:52:25 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2019-08-21 07:32:21 +00:00
|
|
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toContain('08:15');
|
|
|
|
});
|
|
|
|
|
2020-11-18 14:00:41 +00:00
|
|
|
it('should delete the ticket using the descriptor menu', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
|
2020-10-13 13:40:55 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-12 07:38:17 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Ticket deleted. You can undo this action within the first hour');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have been relocated to the ticket index', async() => {
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.index');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
2020-10-13 13:40:55 +00:00
|
|
|
it(`should search for the deleted ticket and check the deletedTicket icon and it's date`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.ticketsIndex.topbarSearch, '18');
|
2020-10-01 06:53:31 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.searchButton);
|
2020-03-24 09:48:16 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2020-10-13 13:40:55 +00:00
|
|
|
await page.waitForClassPresent(selectors.ticketDescriptor.isDeletedIcon, 'bright');
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');
|
2019-03-12 07:38:17 +00:00
|
|
|
|
|
|
|
expect(result).toContain(2000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-10-13 13:40:55 +00:00
|
|
|
describe('Restore ticket', () => {
|
2020-11-18 14:00:41 +00:00
|
|
|
it('should restore the ticket using the descriptor menu', async() => {
|
2020-10-13 13:40:55 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuRestoreTicket);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
|
2020-11-09 13:52:25 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2020-10-13 13:40:55 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-10-13 13:40:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should make sure the ticketDeleted icon is no longer bright', async() => {
|
|
|
|
await page.waitForClassNotPresent(selectors.ticketDescriptor.isDeletedIcon, 'bright');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-11-09 13:52:25 +00:00
|
|
|
describe('Add stowaway', () => {
|
2019-03-12 07:38:17 +00:00
|
|
|
it('should search for a ticket', async() => {
|
2020-03-17 13:01:25 +00:00
|
|
|
await page.accessToSearchResult('16');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should open the add stowaway dialog', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitForFunction(() => {
|
2020-11-09 13:52:25 +00:00
|
|
|
let element = document.querySelector('vn-ticket-descriptor-menu');
|
2020-01-23 15:01:29 +00:00
|
|
|
return element.$ctrl.canShowStowaway === true;
|
|
|
|
});
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
|
2020-01-23 15:01:29 +00:00
|
|
|
const isVisible = await page.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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-12 07:38:17 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|
|
|
|
|
2020-11-05 14:58:02 +00:00
|
|
|
it(`should check the state of the stowaway ticket is embarked`, async() => {
|
2020-11-10 10:41:10 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2020-01-23 15:01:29 +00:00
|
|
|
const state = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
2019-07-01 11:41:38 +00:00
|
|
|
|
|
|
|
expect(state).toEqual('State Embarcando');
|
|
|
|
});
|
|
|
|
|
2019-03-20 14:33:33 +00:00
|
|
|
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.shipButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2019-03-20 14:33:33 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the stowaway', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
2020-03-31 13:30:57 +00:00
|
|
|
await page.waitForContentLoaded();
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-20 14:33:33 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-03-20 14:33:33 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the ship buton doesn't exisist any more`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitForSelector(selectors.ticketDescriptor.shipButton, {hidden: true});
|
2019-03-20 14:33:33 +00:00
|
|
|
});
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const invoiceableTicketId = '14';
|
2019-04-23 06:58:49 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.loginAndModule('adminBoss', 'ticket');
|
|
|
|
await page.accessToSearchResult(invoiceableTicketId);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.summary');
|
2019-04-23 06:58:49 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2019-04-23 06:58:49 +00:00
|
|
|
.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toEqual('-');
|
|
|
|
});
|
|
|
|
|
2020-11-18 14:00:41 +00:00
|
|
|
it('should invoice the ticket using the descriptor menu', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
2020-03-31 13:30:57 +00:00
|
|
|
await page.waitForContentLoaded();
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-04-23 06:58:49 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Ticket invoiced');
|
2019-04-23 06:58:49 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should make sure the ticket summary have an invoiceOutFk`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445');
|
|
|
|
const result = await page.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
2019-04-23 06:58:49 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('T4444445');
|
|
|
|
});
|
|
|
|
});
|
2020-11-18 14:00:41 +00:00
|
|
|
|
|
|
|
describe('SMS', () => {
|
|
|
|
it('should send the payment SMS using the descriptor menu', async() => {
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitForContentLoaded();
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuPaymentSMS);
|
|
|
|
await page.waitForSelector(selectors.ticketDescriptor.SMStext);
|
|
|
|
await page.waitPropertyLength(selectors.ticketDescriptor.SMStext, 'value', 128);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.sendSMSbutton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('SMS sent!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should send the import SMS using the descriptor menu', async() => {
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitForContentLoaded();
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuSendImportSms);
|
|
|
|
await page.waitForSelector(selectors.ticketDescriptor.SMStext);
|
|
|
|
await page.waitPropertyLength(selectors.ticketDescriptor.SMStext, 'value', 144);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.sendSMSbutton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain('SMS sent!');
|
|
|
|
});
|
|
|
|
});
|
2019-03-12 07:38:17 +00:00
|
|
|
});
|