2021-08-11 11:34:32 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
|
|
|
describe('InvoiceOut global invoice path', () => {
|
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('administrative', 'invoiceOut');
|
|
|
|
await page.waitToClick('[icon="search"]');
|
2021-08-11 11:37:24 +00:00
|
|
|
await page.waitForTimeout(1000); // index search needs time to return results
|
2021-08-11 11:34:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
2023-03-01 09:36:38 +00:00
|
|
|
let invoicesBeforeOneClient;
|
|
|
|
let now = Date.vnNew();
|
2021-08-11 11:34:32 +00:00
|
|
|
|
|
|
|
it('should count the amount of invoices listed before globla invoces are made', async() => {
|
2023-03-01 09:36:38 +00:00
|
|
|
invoicesBeforeOneClient = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
2021-08-11 11:34:32 +00:00
|
|
|
|
2023-03-01 09:36:38 +00:00
|
|
|
expect(invoicesBeforeOneClient).toBeGreaterThanOrEqual(4);
|
2021-08-11 11:34:32 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should create a global invoice for charles xavier today', async() => {
|
2023-05-05 06:12:38 +00:00
|
|
|
await page.accessToSection('invoiceOut.global-invoicing');
|
2023-03-01 09:36:38 +00:00
|
|
|
await page.waitToClick(selectors.invoiceOutGlobalInvoicing.oneClient);
|
2023-05-05 06:12:38 +00:00
|
|
|
await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.clientId, 'Charles Xavier');
|
2023-03-01 09:36:38 +00:00
|
|
|
await page.pickDate(selectors.invoiceOutGlobalInvoicing.invoiceDate, now);
|
|
|
|
await page.pickDate(selectors.invoiceOutGlobalInvoicing.maxShipped, now);
|
|
|
|
await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.printer, '1');
|
|
|
|
await page.waitToClick(selectors.invoiceOutGlobalInvoicing.makeInvoice);
|
|
|
|
await page.waitForTimeout(1000);
|
2021-08-11 11:34:32 +00:00
|
|
|
});
|
|
|
|
});
|