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.waitForContentLoaded();
|
|
|
|
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
|
|
|
await page.waitForSelector(selectors.createStateView.stateAutocomplete, {visible: true});
|
2020-01-23 15:01:29 +00:00
|
|
|
let url = await page.parsedUrl();
|
2019-02-04 13:47:55 +00:00
|
|
|
|
2019-01-22 14:55:58 +00:00
|
|
|
expect(url.hash).toContain('tracking/edit');
|
|
|
|
});
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2019-01-22 14:55:58 +00:00
|
|
|
it(`should attempt create a new state but receive an error if state is empty`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
|
|
|
let result = await page.waitForLastSnackbar();
|
2019-01-22 14:55:58 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('State cannot be blank');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should create a new state`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?');
|
|
|
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
|
|
|
let result = await page.waitForLastSnackbar();
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2019-01-22 14:55:58 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
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-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
|
|
|
await page.waitForURL('tracking/edit');
|
|
|
|
let url = await page.parsedUrl();
|
2019-01-22 14:55:58 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('tracking/edit');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitFor(1500);
|
|
|
|
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado');
|
|
|
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
|
|
|
let result = await page.waitForLastSnackbar();
|
2019-01-22 14:55:58 +00:00
|
|
|
|
2019-01-29 20:00:27 +00:00
|
|
|
expect(result).toEqual(`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-01-23 15:01:29 +00:00
|
|
|
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado');
|
|
|
|
let result = await page
|
2020-01-29 13:54:07 +00:00
|
|
|
.waitToGetProperty(selectors.createStateView.workerAutocomplete, 'value');
|
2019-01-22 14:55:58 +00:00
|
|
|
|
2019-08-19 05:56:20 +00:00
|
|
|
expect(result).toEqual('salesPersonNick');
|
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);
|
|
|
|
let result = await page.waitForLastSnackbar();
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2019-01-22 14:55:58 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
});
|