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

110 lines
4.5 KiB
JavaScript
Raw Normal View History

2022-12-20 10:36:58 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Ticket Advance path', () => {
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();
});
it('should show errors snackbar because of the required data', async() => {
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');
});
it('should search with the required data', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
2023-02-10 09:13:41 +00:00
2023-03-06 11:04:16 +00:00
expect(httpRequest).toBeDefined();
2022-12-20 10:36:58 +00:00
});
it('should search with the origin IPT', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
2023-03-22 09:13:37 +00:00
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'H');
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.submit);
2023-02-10 09:13:41 +00:00
2023-03-06 11:04:16 +00:00
expect(httpRequest).toContain('futureIpt=H');
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
2023-02-10 09:13:41 +00:00
await page.clearInput(selectors.ticketAdvance.futureIpt);
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.submit);
});
it('should search with the destination IPT', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
2023-03-22 09:13:37 +00:00
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'H');
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.submit);
2023-02-10 09:13:41 +00:00
2023-03-06 11:04:16 +00:00
expect(httpRequest).toContain('ipt=H');
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
2023-02-10 09:13:41 +00:00
await page.clearInput(selectors.ticketAdvance.ipt);
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.submit);
});
it('should search in smart-table with an IPT Origin', async() => {
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
2023-03-22 09:13:37 +00:00
await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'V');
2023-02-10 09:13:41 +00:00
2023-03-06 11:04:16 +00:00
expect(httpRequest).toContain('futureIpt');
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
});
it('should search in smart-table with an IPT Destination', async() => {
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
2023-03-22 09:13:37 +00:00
await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'V');
2023-02-10 09:13:41 +00:00
2023-03-06 11:04:16 +00:00
expect(httpRequest).toContain('ipt');
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
});
2023-02-13 09:16:28 +00:00
it('should check the first ticket and move to the present', async() => {
await page.waitToClick(selectors.ticketAdvance.firstCheck);
2022-12-20 10:36:58 +00:00
await page.waitToClick(selectors.ticketAdvance.moveButton);
await page.waitToClick(selectors.ticketAdvance.acceptButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Tickets moved successfully!');
});
});