salix/e2e/paths/05-ticket/05_tracking_state.spec.js

81 lines
3.3 KiB
JavaScript
Raw Normal View History

2018-04-05 12:14:34 +00:00
import selectors from '../../helpers/selectors.js';
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', () => {
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', () => {
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});
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 attempt create a new state but receive an error if state is empty`, async() => {
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-04-08 09:24:40 +00:00
expect(message.text).toBe('State cannot be blank');
2019-01-22 14:55:58 +00:00
});
it(`should create a new state`, async() => {
2020-02-03 14:55:11 +00:00
await page.autocompleteSearch(selectors.createStateView.state, '¿Fecha?');
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-10-30 16:09:11 +00:00
expect(message.text).toBe('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', () => {
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-07-02 12:03:01 +00:00
await page.waitFor('.vn-popup', {hidden: true}),
await page.waitToClick(selectors.ticketTracking.createStateButton);
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() => {
await page.waitFor(1500);
2020-02-03 14:55:11 +00:00
await page.autocompleteSearch(selectors.createStateView.state, 'Encajado');
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-04-08 09:24:40 +00:00
expect(message.text).toBe(`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
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() => {
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-10-30 16:09:11 +00:00
expect(message.text).toBe('Data saved!');
2019-01-22 14:55:58 +00:00
});
2018-04-05 12:14:34 +00:00
});
});