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

51 lines
1.8 KiB
JavaScript
Raw Permalink 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
2023-03-27 10:14:06 +00:00
describe('Ticket Create notes path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'ticket');
2023-03-27 10:13:20 +00:00
await page.accessToSearchResult('5');
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.waitToClick(selectors.ticketNotes.addNoteButton);
await page.autocompleteSearch(selectors.ticketNotes.firstNoteType, 'ItemPicker');
2020-02-03 14:55:11 +00:00
await page.write(selectors.ticketNotes.firstDescription, 'description');
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!');
});
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
2020-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.ticketNotes.firstNoteType, 'value');
2018-12-19 07:42:07 +00:00
expect(result).toEqual('ItemPicker');
2018-12-19 07:42:07 +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() => {
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
});