2022-11-10 14:54:00 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// 'https:// redmine.verdnatura.es/issues/5642'
|
|
|
|
xdescribe('Ticket Future path', () => {
|
2022-11-10 14:54:00 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
2023-03-06 11:04:16 +00:00
|
|
|
let httpRequest;
|
2022-11-10 14:54:00 +00:00
|
|
|
|
2022-11-23 07:23:58 +00:00
|
|
|
beforeAll(async() => {
|
2022-11-10 14:54:00 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('employee', 'ticket');
|
|
|
|
await page.accessToSection('ticket.future');
|
2023-03-06 11:04:16 +00:00
|
|
|
page.on('request', req => {
|
|
|
|
if (req.url().includes(`Tickets/getTicketsFuture`))
|
|
|
|
httpRequest = req.url();
|
|
|
|
});
|
2022-11-10 14:54:00 +00:00
|
|
|
});
|
|
|
|
|
2022-11-23 07:23:58 +00:00
|
|
|
afterAll(async() => {
|
2022-11-10 14:54:00 +00:00
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
2022-11-23 07:23:58 +00:00
|
|
|
it('should show errors snackbar because of the required data', async() => {
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-16 10:10:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.warehouseFk);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
let message = await page.waitForSnackbar();
|
2022-11-23 07:23:58 +00:00
|
|
|
|
2022-11-11 14:58:11 +00:00
|
|
|
expect(message.text).toContain('warehouseFk is a required argument');
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-16 10:10:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.futureDated);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
message = await page.waitForSnackbar();
|
2022-11-23 07:23:58 +00:00
|
|
|
|
2022-11-11 14:58:11 +00:00
|
|
|
expect(message.text).toContain('futureDated is a required argument');
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-16 10:10:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.originDated);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
message = await page.waitForSnackbar();
|
2022-11-23 07:23:58 +00:00
|
|
|
|
2022-11-11 14:58:11 +00:00
|
|
|
expect(message.text).toContain('originDated is a required argument');
|
|
|
|
});
|
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// it('should search with the required data', async() => {
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.submit);
|
2023-03-06 11:04:16 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// expect(httpRequest).toBeDefined();
|
|
|
|
// });
|
2022-11-10 14:54:00 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// it('should search with the origin IPT', async() => {
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// await page.autocompleteSearch(selectors.ticketFuture.ipt, 'H');
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.submit);
|
2023-03-06 11:04:16 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// expect(httpRequest).toContain('ipt=H');
|
|
|
|
// });
|
2022-11-10 14:54:00 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// it('should search with the destination IPT', async() => {
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// await page.clearInput(selectors.ticketFuture.ipt);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'H');
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.submit);
|
2023-03-06 11:04:16 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// expect(httpRequest).toContain('futureIpt=H');
|
|
|
|
// });
|
2022-11-10 14:54:00 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// it('should search with the origin grouped state', async() => {
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// await page.clearInput(selectors.ticketFuture.futureIpt);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// await page.autocompleteSearch(selectors.ticketFuture.state, 'Free');
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.submit);
|
2023-03-06 11:04:16 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// expect(httpRequest).toContain('state=FREE');
|
|
|
|
// });
|
2022-11-10 14:54:00 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// it('should search with the destination grouped state', async() => {
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// await page.clearInput(selectors.ticketFuture.state);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// await page.autocompleteSearch(selectors.ticketFuture.futureState, 'Free');
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.submit);
|
2023-03-06 11:04:16 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// expect(httpRequest).toContain('futureState=FREE');
|
2022-11-10 14:54:00 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
// await page.clearInput(selectors.ticketFuture.futureState);
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
// });
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// it('should check the three last tickets and move to the future', async() => {
|
|
|
|
// await page.waitForNumberOfElements(selectors.ticketFuture.searchResult, 4);
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.multiCheck);
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.firstCheck);
|
|
|
|
// await page.waitToClick(selectors.ticketFuture.moveButton);
|
|
|
|
// await page.waitToClick(selectors.globalItems.acceptButton);
|
|
|
|
// const message = await page.waitForSnackbar();
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2023-05-05 10:20:41 +00:00
|
|
|
// expect(message.text).toContain('Tickets moved successfully!');
|
|
|
|
// });
|
2022-11-10 14:54:00 +00:00
|
|
|
});
|