2019-01-16 07:52:56 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-01-16 07:52:56 +00:00
|
|
|
|
2019-02-07 13:33:52 +00:00
|
|
|
describe('Ticket create path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
2019-01-16 07:52:56 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('employee', 'ticket');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-01-16 07:52:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should open the new ticket form', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.newTicketButton);
|
2020-02-04 15:21:10 +00:00
|
|
|
let url = await page.expectURL('#!/ticket/create');
|
2019-01-16 07:52:56 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
expect(url).toBe(true);
|
2019-01-16 07:52:56 +00:00
|
|
|
});
|
|
|
|
|
2019-11-21 12:18:44 +00:00
|
|
|
it('should succeed to create a ticket', async() => {
|
2020-03-23 22:57:11 +00:00
|
|
|
const nextMonth = new Date();
|
|
|
|
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
|
|
|
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.createTicketView.client, 'Tony Stark');
|
|
|
|
await page.autocompleteSearch(selectors.createTicketView.address, 'Tony Stark');
|
2020-03-23 22:57:11 +00:00
|
|
|
await page.pickDate(selectors.createTicketView.deliveryDate, nextMonth);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse One');
|
|
|
|
await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.createTicketView.createButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-01-16 07:52:56 +00:00
|
|
|
|
2019-01-24 13:03:01 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2019-01-16 07:52:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the url is now the summary of the ticket', async() => {
|
2020-02-04 15:21:10 +00:00
|
|
|
let url = await page.expectURL('/summary');
|
2019-01-16 07:52:56 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
expect(url).toBe(true);
|
2019-01-16 07:52:56 +00:00
|
|
|
});
|
|
|
|
});
|