salix/e2e/paths/05-ticket-module/01_observations.spec.js

52 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-03-19 15:29:55 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2018-03-19 15:29:55 +00:00
2018-12-19 07:42:07 +00:00
describe('Ticket Create notes path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'ticket');
await page.accessToSearchResult('1');
await page.accessToSection('ticket.card.observation');
});
2018-12-19 07:42:07 +00:00
afterAll(async() => {
await browser.close();
2018-12-19 07:42:07 +00:00
});
2019-06-19 07:03:45 +00:00
it('should create a new note', async() => {
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketNotes.addNoteButton);
await page.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one');
await page.write(selectors.ticketNotes.firstDescriptionInput, 'description');
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
const result = await page.waitForLastSnackbar();
2018-12-19 07:42:07 +00:00
expect(result).toEqual('Data saved!');
}, 15000);
2018-12-19 07:42:07 +00:00
2019-06-19 07:03:45 +00:00
it('should confirm the note is the expected one', async() => {
await page.reloadSection('ticket.card.observation');
const result = await page
.waitToGetProperty(selectors.ticketNotes.firstNoteTypeAutocomplete, 'value');
2018-12-19 07:42:07 +00:00
2019-01-07 08:33:07 +00:00
expect(result).toEqual('observation one');
2018-12-19 07:42:07 +00:00
const firstDescription = await page
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
2018-12-19 07:42:07 +00:00
expect(firstDescription).toEqual('description');
2018-03-19 15:29:55 +00:00
});
2019-06-19 07:03:45 +00:00
it('should delete the note', async() => {
await page.waitToClick(selectors.ticketNotes.firstNoteRemoveButton);
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
const result = await page.waitForLastSnackbar();
2019-06-19 07:03:45 +00:00
expect(result).toEqual('Data saved!');
});
2018-03-19 15:29:55 +00:00
});