2018-04-05 12:14:34 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-04-05 12:14:34 +00:00
|
|
|
|
2018-12-19 07:42:07 +00:00
|
|
|
describe('Ticket Create new tracking state path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2019-01-22 14:55:58 +00:00
|
|
|
describe('as production', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
it('should log into the ticket 1 tracking', async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('production', 'ticket');
|
|
|
|
await page.accessToSearchResult('1');
|
|
|
|
await page.accessToSection('ticket.card.tracking.index');
|
2019-01-22 14:55:58 +00:00
|
|
|
});
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2019-01-22 14:55:58 +00:00
|
|
|
it('should access to the create state view by clicking the create floating button', async() => {
|
2020-01-26 23:48:00 +00:00
|
|
|
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.waitForSelector(selectors.createStateView.state, {visible: true});
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.tracking.edit');
|
2019-01-22 14:55:58 +00:00
|
|
|
});
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2019-01-22 14:55:58 +00:00
|
|
|
it(`should create a new state`, async() => {
|
2022-03-11 11:21:39 +00:00
|
|
|
await page.autocompleteSearch(selectors.createStateView.state, 'OK');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-01-22 14:55:58 +00:00
|
|
|
});
|
2018-12-19 07:42:07 +00:00
|
|
|
});
|
|
|
|
|
2019-01-22 14:55:58 +00:00
|
|
|
describe('as salesPerson', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
it('should now log into the ticket 1 tracking', async() => {
|
|
|
|
await page.loginAndModule('salesPerson', 'ticket');
|
|
|
|
await page.accessToSearchResult('1');
|
|
|
|
await page.accessToSection('ticket.card.tracking.index');
|
2019-01-22 14:55:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should now access to the create state view by clicking the create floating button', async() => {
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector('.vn-popup', {hidden: true});
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.tracking.edit');
|
2019-01-22 14:55:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.createStateView.state, 'Encajado');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-01-22 14:55:58 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain(`You don't have enough privileges`);
|
2019-01-22 14:55:58 +00:00
|
|
|
});
|
|
|
|
|
2019-08-19 05:56:20 +00:00
|
|
|
it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.createStateView.state, 'asignado');
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.createStateView.worker, 'value');
|
2019-01-22 14:55:58 +00:00
|
|
|
|
2023-07-20 09:26:48 +00:00
|
|
|
expect(result).toEqual('salesPerson');
|
2019-01-22 14:55:58 +00:00
|
|
|
});
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2019-08-19 05:56:20 +00:00
|
|
|
it(`should succesfully create a valid state`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-01-22 14:55:58 +00:00
|
|
|
});
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
});
|