138 lines
6.6 KiB
JavaScript
138 lines
6.6 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Ticket Advance path', () => {
|
|
let browser;
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('employee', 'ticket');
|
|
await page.accessToSection('ticket.advance');
|
|
});
|
|
|
|
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);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
});
|
|
|
|
it('should search with the origin IPT', async() => {
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal');
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.clearInput(selectors.ticketAdvance.ipt);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
});
|
|
|
|
it('should search with the destination IPT', async() => {
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal');
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.clearInput(selectors.ticketAdvance.futureIpt);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
});
|
|
|
|
it('should search with the origin pending state', async() => {
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.waitToClick(selectors.ticketAdvance.futureState);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.waitToClick(selectors.ticketAdvance.futureState);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
|
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.waitToClick(selectors.ticketAdvance.futureState);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
});
|
|
|
|
it('should search with the destination grouped state', async() => {
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.waitToClick(selectors.ticketAdvance.state);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
|
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.waitToClick(selectors.ticketAdvance.state);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.waitToClick(selectors.ticketAdvance.state);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
});
|
|
|
|
it('should search in smart-table with an IPT Origin', async() => {
|
|
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical');
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
|
|
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
});
|
|
|
|
it('should search in smart-table with an IPT Destination', async() => {
|
|
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'Vertical');
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
|
|
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
});
|
|
|
|
it('should check the one ticket and move to the present', async() => {
|
|
await page.waitToClick(selectors.ticketAdvance.multiCheck);
|
|
await page.waitToClick(selectors.ticketAdvance.moveButton);
|
|
await page.waitToClick(selectors.ticketAdvance.acceptButton);
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('Tickets moved successfully!');
|
|
});
|
|
});
|