2018-03-19 15:29:55 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-03-19 15:29:55 +00:00
|
|
|
|
2021-11-17 09:12:23 +00:00
|
|
|
describe('Ticket Create notes path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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
|
|
|
|
2020-01-23 15:01:29 +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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketNotes.addNoteButton);
|
2021-05-17 08:38:53 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketNotes.firstNoteType, 'ItemPicker');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.ticketNotes.firstDescription, 'description');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
|
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!');
|
2020-02-12 06:21:53 +00:00
|
|
|
});
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.reloadSection('ticket.card.observation');
|
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.ticketNotes.firstNoteType, 'value');
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2021-05-17 08:38:53 +00:00
|
|
|
expect(result).toEqual('ItemPicker');
|
2018-12-19 07:42:07 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const firstDescription = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.ticketNotes.firstDescription, '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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketNotes.firstNoteRemoveButton);
|
|
|
|
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-06-19 07:03:45 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-06-19 07:03:45 +00:00
|
|
|
});
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|