2022-11-10 14:54:00 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
2022-11-16 10:10:00 +00:00
|
|
|
fdescribe('Ticket Future path', () => {
|
2022-11-10 14:54:00 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('employee', 'ticket');
|
|
|
|
await page.accessToSection('ticket.future');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
const now = new Date();
|
|
|
|
const tomorrow = new Date(now.getDate() + 1);
|
2022-11-11 14:58:11 +00:00
|
|
|
const ticket = {
|
|
|
|
originDated: now,
|
|
|
|
futureDated: now,
|
|
|
|
linesMax: '9999',
|
|
|
|
litersMax: '9999',
|
|
|
|
warehouseFk: 'Warehouse One'
|
|
|
|
};
|
|
|
|
|
|
|
|
it('should show errors snackbar because of the required data', async () => {
|
|
|
|
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();
|
|
|
|
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.litersMax);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('litersMax is a required argument');
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-16 10:10:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.linesMax);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('linesMax 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();
|
|
|
|
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();
|
|
|
|
expect(message.text).toContain('originDated is a required argument');
|
|
|
|
});
|
|
|
|
|
2022-11-10 14:54:00 +00:00
|
|
|
it('should search with the required data', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search with the origin shipped today', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.pickDate(selectors.ticketFuture.shipped, now);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search with the origin shipped tomorrow', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.pickDate(selectors.ticketFuture.shipped, tomorrow);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search with the destination shipped today', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.clearInput(selectors.ticketFuture.shipped);
|
|
|
|
await page.pickDate(selectors.ticketFuture.tfShipped, now);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search with the destination shipped tomorrow', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.pickDate(selectors.ticketFuture.tfShipped, tomorrow);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search with the origin IPT', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
|
|
|
await page.clearInput(selectors.ticketFuture.shipped);
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.tfShipped);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.ipt);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfIpt);
|
|
|
|
await page.clearInput(selectors.ticketFuture.state);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfState);
|
|
|
|
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketFuture.ipt, 'Horizontal');
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search with the destination IPT', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
|
|
|
await page.clearInput(selectors.ticketFuture.shipped);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfShipped);
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.ipt);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.tfIpt);
|
|
|
|
await page.clearInput(selectors.ticketFuture.state);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfState);
|
|
|
|
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketFuture.tfIpt, 'Horizontal');
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search with the origin grouped state', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
|
|
|
await page.clearInput(selectors.ticketFuture.shipped);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfShipped);
|
|
|
|
await page.clearInput(selectors.ticketFuture.ipt);
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.tfIpt);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.state);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfState);
|
|
|
|
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketFuture.state, 'Free');
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 3);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search with the destination grouped state', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
|
|
|
await page.clearInput(selectors.ticketFuture.shipped);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfShipped);
|
|
|
|
await page.clearInput(selectors.ticketFuture.ipt);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfIpt);
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.state);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.tfState);
|
|
|
|
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketFuture.tfState, 'Free');
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.shipped);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfShipped);
|
|
|
|
await page.clearInput(selectors.ticketFuture.ipt);
|
|
|
|
await page.clearInput(selectors.ticketFuture.tfIpt);
|
|
|
|
await page.clearInput(selectors.ticketFuture.state);
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.clearInput(selectors.ticketFuture.tfState);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
});
|
|
|
|
|
2022-11-11 14:58:11 +00:00
|
|
|
it('should search in smart-table with an ID Origin', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.write(selectors.ticketFuture.tableId, "13");
|
|
|
|
await page.keyboard.press("Enter");
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 2);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search in smart-table with an ID Destination', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.write(selectors.ticketFuture.tableTfId, "12");
|
|
|
|
await page.keyboard.press("Enter");
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 5);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search in smart-table with an IPT Origin', async () => {
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketFuture.tableIpt, 'Vertical');
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 1);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search in smart-table with an IPT Destination', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.autocompleteSearch(selectors.ticketFuture.tableTfIpt, 'Vertical');
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 1);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search in smart-table with especified Lines', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.write(selectors.ticketFuture.tableLines, "0");
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.keyboard.press("Enter");
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 1);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.write(selectors.ticketFuture.tableLines, "1");
|
|
|
|
await page.keyboard.press("Enter");
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 5);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
2022-11-10 14:54:00 +00:00
|
|
|
});
|
2022-11-11 14:58:11 +00:00
|
|
|
|
|
|
|
it('should search in smart-table with especified Liters', async () => {
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.write(selectors.ticketFuture.tableLiters, "0");
|
|
|
|
await page.keyboard.press("Enter");
|
2022-11-10 14:54:00 +00:00
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 1);
|
2022-11-11 14:58:11 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.write(selectors.ticketFuture.tableLiters, "28");
|
|
|
|
await page.keyboard.press("Enter");
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 5);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.submit);
|
|
|
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
2022-11-10 14:54:00 +00:00
|
|
|
});
|
|
|
|
|
2022-11-14 07:51:15 +00:00
|
|
|
it('should check the three last tickets and move to the future', async () => {
|
2022-11-11 14:58:11 +00:00
|
|
|
await page.waitToClick(selectors.ticketFuture.multiCheck);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.firstCheck);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.moveButton);
|
|
|
|
await page.waitToClick(selectors.ticketFuture.acceptButton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('Tickets moved successfully!');
|
|
|
|
});
|
2022-11-10 14:54:00 +00:00
|
|
|
|
|
|
|
});
|