149 lines
6.6 KiB
JavaScript
149 lines
6.6 KiB
JavaScript
|
import selectors from '../../helpers/selectors.js';
|
||
|
import getBrowser from '../../helpers/puppeteer';
|
||
|
|
||
|
describe('Ticket descriptor path', () => {
|
||
|
let browser;
|
||
|
let page;
|
||
|
|
||
|
beforeAll(async() => {
|
||
|
browser = await getBrowser();
|
||
|
page = browser.page;
|
||
|
await page.loginAndModule('salesperson', 'ticket');
|
||
|
});
|
||
|
|
||
|
afterAll(async() => {
|
||
|
await browser.close();
|
||
|
});
|
||
|
|
||
|
describe('Delete ticket', () => {
|
||
|
it('should search for an specific ticket', async() => {
|
||
|
await page.accessToSearchResult('18');
|
||
|
await page.waitForState('ticket.card.summary');
|
||
|
});
|
||
|
|
||
|
it(`should update the shipped hour using the descriptor menu`, async() => {
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour);
|
||
|
await page.pickTime(selectors.ticketDescriptor.changeShippedHour, '08:15');
|
||
|
await page.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton);
|
||
|
const message = await page.waitForSnackbar();
|
||
|
|
||
|
expect(message.text).toContain('Shipped hour updated');
|
||
|
});
|
||
|
|
||
|
it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => {
|
||
|
await page.waitForState('ticket.card.summary');
|
||
|
const result = await page
|
||
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
||
|
|
||
|
expect(result).toContain('08:15');
|
||
|
});
|
||
|
|
||
|
it('should delete the ticket using the descriptor menu', async() => {
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
|
||
|
await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
|
||
|
const message = await page.waitForSnackbar();
|
||
|
|
||
|
expect(message.text).toContain('Ticket deleted. You can undo this action within the first hour');
|
||
|
});
|
||
|
|
||
|
it('should have been relocated to the ticket index', async() => {
|
||
|
await page.waitForState('ticket.index');
|
||
|
});
|
||
|
|
||
|
it(`should search for the deleted ticket and check the deletedTicket icon and it's date`, async() => {
|
||
|
await page.write(selectors.ticketsIndex.topbarSearch, '18');
|
||
|
await page.waitToClick(selectors.globalItems.searchButton);
|
||
|
await page.waitForState('ticket.card.summary');
|
||
|
await page.isVisible(selectors.ticketDescriptor.isDeletedIcon);
|
||
|
const result = await page.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');
|
||
|
|
||
|
expect(result).toContain(2000);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
describe('Restore ticket', () => {
|
||
|
it('should restore the ticket using the descriptor menu', async() => {
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuRestoreTicket);
|
||
|
await page.waitToClick(selectors.ticketDescriptor.acceptDialog);
|
||
|
await page.waitForState('ticket.card.summary');
|
||
|
const message = await page.waitForSnackbar();
|
||
|
|
||
|
expect(message.text).toContain('Data saved!');
|
||
|
});
|
||
|
});
|
||
|
|
||
|
describe('Make invoice', () => {
|
||
|
it('should login as administrative role then search for a ticket', async() => {
|
||
|
const invoiceableTicketId = '14';
|
||
|
|
||
|
await page.loginAndModule('administrative', 'ticket');
|
||
|
await page.accessToSearchResult(invoiceableTicketId);
|
||
|
await page.waitForState('ticket.card.summary');
|
||
|
});
|
||
|
|
||
|
it(`should make sure the ticket doesn't have an invoiceOutFk yet`, async() => {
|
||
|
const result = await page
|
||
|
.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
||
|
|
||
|
expect(result).toEqual('-');
|
||
|
});
|
||
|
|
||
|
it('should invoice the ticket using the descriptor menu', async() => {
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||
|
await page.waitForContentLoaded();
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice);
|
||
|
await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton);
|
||
|
const message = await page.waitForSnackbar();
|
||
|
|
||
|
expect(message.text).toContain('Ticket invoiced');
|
||
|
});
|
||
|
|
||
|
it(`should make sure the ticket summary have an invoiceOutFk`, async() => {
|
||
|
await page.waitForTextInElement(selectors.ticketSummary.invoiceOutRef, 'T4444445');
|
||
|
const result = await page.waitToGetProperty(selectors.ticketSummary.invoiceOutRef, 'innerText');
|
||
|
|
||
|
expect(result).toEqual('T4444445');
|
||
|
});
|
||
|
|
||
|
it(`should regenerate the invoice using the descriptor menu`, async() => {
|
||
|
const expectedMessage = 'The invoice PDF document has been regenerated';
|
||
|
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||
|
await page.waitForContentLoaded();
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuRegenerateInvoice);
|
||
|
await page.respondToDialog('accept');
|
||
|
const message = await page.waitForSnackbar();
|
||
|
|
||
|
expect(message.text).toContain(expectedMessage);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
describe('SMS', () => {
|
||
|
it('should send the payment SMS using the descriptor menu', async() => {
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuSMSOptions);
|
||
|
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).toBeDefined();
|
||
|
});
|
||
|
|
||
|
it('should send the import SMS using the descriptor menu', async() => {
|
||
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuSMSOptions);
|
||
|
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).toBeDefined();
|
||
|
});
|
||
|
});
|
||
|
});
|