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
|
|
|
|
2018-12-19 07:42:07 +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.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!');
|
2020-01-23 15:01:29 +00:00
|
|
|
}, 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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.reloadSection('ticket.card.observation');
|
|
|
|
const result = await page
|
2019-01-07 08:33:07 +00:00
|
|
|
.waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, '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
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const firstDescription = await page
|
|
|
|
.waitToGetProperty(`${selectors.ticketNotes.firstDescriptionInput} input`, '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);
|
|
|
|
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
|
|
|
});
|