127 lines
6.1 KiB
JavaScript
127 lines
6.1 KiB
JavaScript
|
import selectors from '../../helpers/selectors.js';
|
||
|
import getBrowser from '../../helpers/puppeteer';
|
||
|
|
||
|
describe('Ticket Future path', () => {
|
||
|
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);
|
||
|
it('should search with the required data', async () => {
|
||
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||
|
await page.pickDate(selectors.ticketFuture.originDated, now);
|
||
|
await page.pickDate(selectors.ticketFuture.futureDated, now);
|
||
|
await page.waitToClick(selectors.ticketFuture.linesMax);
|
||
|
await page.write(selectors.ticketFuture.linesMax, '9999');
|
||
|
await page.write(selectors.ticketFuture.litersMax, '9999');
|
||
|
await page.autocompleteSearch(selectors.ticketFuture.warehouseFk, 'Warehouse One');
|
||
|
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);
|
||
|
await page.clearInput(selectors.ticketFuture.tfShipped);
|
||
|
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);
|
||
|
await page.clearInput(selectors.ticketFuture.ipt);
|
||
|
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);
|
||
|
await page.clearInput(selectors.ticketFuture.tfIpt);
|
||
|
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);
|
||
|
await page.clearInput(selectors.ticketFuture.state);
|
||
|
await page.autocompleteSearch(selectors.ticketFuture.tfState, 'Free');
|
||
|
await page.waitToClick(selectors.ticketFuture.submit);
|
||
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
||
|
});
|
||
|
|
||
|
it('should search with problems selected', async () => {
|
||
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||
|
await page.clearInput(selectors.ticketFuture.tfState);
|
||
|
await page.waitToClick(selectors.ticketFuture.problems);
|
||
|
await page.waitToClick(selectors.ticketFuture.submit);
|
||
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
||
|
});
|
||
|
|
||
|
it('should search with no problems selected', async () => {
|
||
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||
|
await page.waitToClick(selectors.ticketFuture.problems);
|
||
|
await page.waitToClick(selectors.ticketFuture.submit);
|
||
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 0);
|
||
|
});
|
||
|
|
||
|
it('should search with an ID Origin', async () => {
|
||
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||
|
await page.waitToClick(selectors.ticketFuture.problems);
|
||
|
await page.waitToClick(selectors.ticketFuture.submit);
|
||
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
||
|
await page.write(selectors.ticketFuture.tableId, "13");
|
||
|
await page.keyboard.press("Enter");
|
||
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 1);
|
||
|
});
|
||
|
it('should search with an ID Destination', async () => {
|
||
|
await page.clearInput(selectors.ticketFuture.tableId);
|
||
|
await page.write(selectors.ticketFuture.tableTfId, "12");
|
||
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 1);
|
||
|
});
|
||
|
|
||
|
|
||
|
// const message = await page.waitForSnackbar();
|
||
|
});
|