46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Ticket create path', () => {
|
|
let browser;
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('employee', 'ticket');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.close();
|
|
});
|
|
|
|
it('should open the new ticket form', async() => {
|
|
await page.waitToClick(selectors.ticketsIndex.newTicketButton);
|
|
let url = await page.expectURL('#!/ticket/create');
|
|
|
|
expect(url).toBe(true);
|
|
});
|
|
|
|
it('should succeed to create a ticket', async() => {
|
|
const nextMonth = new Date();
|
|
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
|
|
|
await page.autocompleteSearch(selectors.createTicketView.client, 'Tony Stark');
|
|
await page.autocompleteSearch(selectors.createTicketView.address, 'Tony Stark');
|
|
await page.pickDate(selectors.createTicketView.deliveryDate, nextMonth);
|
|
await page.autocompleteSearch(selectors.createTicketView.warehouse, 'Warehouse One');
|
|
await page.autocompleteSearch(selectors.createTicketView.agency, 'Silla247');
|
|
await page.waitToClick(selectors.createTicketView.createButton);
|
|
const result = await page.waitForLastSnackbar();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
|
|
it('should check the url is now the summary of the ticket', async() => {
|
|
let url = await page.expectURL('/summary');
|
|
|
|
expect(url).toBe(true);
|
|
});
|
|
});
|