Merge branch '4700-split-tour' of https://gitea.verdnatura.es/verdnatura/salix into 3963-ticket-advance
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2022-11-16 11:10:21 +01:00
commit 66002968f6
3 changed files with 20 additions and 27 deletions

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Ticket Future path', () => {
fdescribe('Ticket Future path', () => {
let browser;
let page;
@ -28,47 +28,31 @@ describe('Ticket Future path', () => {
it('should show errors snackbar because of the required data', async () => {
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.pickDate(selectors.ticketFuture.originDated, ticket.originDated);
await page.pickDate(selectors.ticketFuture.futureDated, ticket.futureDated);
await page.write(selectors.ticketFuture.linesMax, ticket.linesMax);
await page.write(selectors.ticketFuture.litersMax, ticket.litersMax);
await page.clearInput(selectors.ticketFuture.warehouseFk);
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);
await page.pickDate(selectors.ticketFuture.originDated, ticket.originDated);
await page.pickDate(selectors.ticketFuture.futureDated, ticket.futureDated);
await page.write(selectors.ticketFuture.linesMax, ticket.linesMax);
await page.autocompleteSearch(selectors.ticketFuture.warehouseFk, ticket.warehouseFk);
await page.clearInput(selectors.ticketFuture.litersMax);
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);
await page.pickDate(selectors.ticketFuture.originDated, ticket.originDated);
await page.pickDate(selectors.ticketFuture.futureDated, ticket.futureDated);
await page.write(selectors.ticketFuture.litersMax, ticket.litersMax);
await page.autocompleteSearch(selectors.ticketFuture.warehouseFk, ticket.warehouseFk);
await page.clearInput(selectors.ticketFuture.linesMax);
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);
await page.pickDate(selectors.ticketFuture.originDated, ticket.originDated);
await page.write(selectors.ticketFuture.linesMax, ticket.linesMax);
await page.write(selectors.ticketFuture.litersMax, ticket.litersMax);
await page.autocompleteSearch(selectors.ticketFuture.warehouseFk, ticket.warehouseFk);
await page.clearInput(selectors.ticketFuture.futureDated);
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);
await page.pickDate(selectors.ticketFuture.futureDated, ticket.futureDated);
await page.write(selectors.ticketFuture.linesMax, ticket.linesMax);
await page.write(selectors.ticketFuture.litersMax, ticket.litersMax);
await page.autocompleteSearch(selectors.ticketFuture.warehouseFk, ticket.warehouseFk);
await page.clearInput(selectors.ticketFuture.originDated);
await page.waitToClick(selectors.ticketFuture.submit);
message = await page.waitForSnackbar();
expect(message.text).toContain('originDated is a required argument');
@ -76,11 +60,6 @@ describe('Ticket Future path', () => {
it('should search with the required data', async () => {
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.pickDate(selectors.ticketFuture.originDated, ticket.originDated);
await page.pickDate(selectors.ticketFuture.futureDated, ticket.futureDated);
await page.write(selectors.ticketFuture.linesMax, ticket.linesMax);
await page.write(selectors.ticketFuture.litersMax, ticket.litersMax);
await page.autocompleteSearch(selectors.ticketFuture.warehouseFk, ticket.warehouseFk);
await page.waitToClick(selectors.ticketFuture.submit);
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
});

View File

@ -9,6 +9,7 @@
panel="vn-future-ticket-search-panel"
placeholder="Search tickets"
info="Search future tickets by date"
suggested-filter="$ctrl.filterParams"
auto-state="false"
model="model">
</vn-searchbar>

View File

@ -48,6 +48,19 @@ export default class Controller extends Section {
},
]
};
this.setDefaultFilter();
}
setDefaultFilter() {
const today = new Date();
this.filterParams = {
originDated: today,
futureDated: today,
linesMax: '9999',
litersMax: '9999',
warehouseFk: 1
};
}
compareDate(date) {