salix/e2e/paths/05-ticket/22_advance.spec.js

80 lines
3.2 KiB
JavaScript
Raw Permalink Normal View History

2022-12-20 10:36:58 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2023-05-16 11:31:22 +00:00
describe('Ticket Advance path', () => {
2022-12-20 10:36:58 +00:00
let browser;
let page;
2023-03-06 11:04:16 +00:00
let httpRequest;
2022-12-20 10:36:58 +00:00
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'ticket');
await page.accessToSection('ticket.advance');
2023-02-10 07:56:30 +00:00
page.on('request', req => {
if (req.url().includes(`Tickets/getTicketsAdvance`))
2023-03-06 11:04:16 +00:00
httpRequest = req.url();
2023-02-10 07:56:30 +00:00
});
2022-12-20 10:36:58 +00:00
});
afterAll(async() => {
await browser.close();
});
2023-05-29 07:58:49 +00:00
it('should search with the required data, check the first ticket and move to the present', async() => {
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.warehouseFk);
await page.waitToClick(selectors.ticketAdvance.submit);
let message = await page.waitForSnackbar();
expect(message.text).toContain('warehouseFk is a required argument');
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.dateToAdvance);
await page.waitToClick(selectors.ticketAdvance.submit);
message = await page.waitForSnackbar();
expect(message.text).toContain('dateToAdvance is a required argument');
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.dateFuture);
await page.waitToClick(selectors.ticketAdvance.submit);
message = await page.waitForSnackbar();
expect(message.text).toContain('dateFuture is a required argument');
2023-05-16 11:31:22 +00:00
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
2023-02-10 09:13:41 +00:00
2023-05-16 11:31:22 +00:00
expect(httpRequest).toBeDefined();
2022-12-20 10:36:58 +00:00
2023-05-16 11:31:22 +00:00
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'H');
await page.waitToClick(selectors.ticketAdvance.submit);
2022-12-20 10:36:58 +00:00
2023-05-16 11:31:22 +00:00
expect(httpRequest).toContain('futureIpt=H');
2023-02-10 09:13:41 +00:00
2023-05-16 11:31:22 +00:00
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.futureIpt);
await page.waitToClick(selectors.ticketAdvance.submit);
2022-12-20 10:36:58 +00:00
2023-05-16 11:31:22 +00:00
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'H');
await page.waitToClick(selectors.ticketAdvance.submit);
2023-02-10 09:13:41 +00:00
2023-05-16 11:31:22 +00:00
expect(httpRequest).toContain('ipt=H');
2022-12-20 10:36:58 +00:00
2023-05-16 11:31:22 +00:00
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.ipt);
await page.waitToClick(selectors.ticketAdvance.submit);
2022-12-20 10:36:58 +00:00
2023-05-16 11:31:22 +00:00
await page.waitToClick(selectors.ticketAdvance.firstCheck);
await page.waitToClick(selectors.ticketAdvance.moveButton);
await page.waitToClick(selectors.ticketAdvance.acceptButton);
2023-05-29 07:58:49 +00:00
message = await page.waitForSnackbar();
2022-12-20 10:36:58 +00:00
2023-05-16 11:31:22 +00:00
expect(message.text).toContain('Tickets moved successfully!');
});
2022-12-20 10:36:58 +00:00
});