44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
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"]');
|
|
await page.waitForTimeout(1000); // index search needs time to return results
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.close();
|
|
});
|
|
|
|
let invoicesBeforeOneClient;
|
|
let invoicesBeforeAllClients;
|
|
let now = Date.vnNew();
|
|
|
|
it('should count the amount of invoices listed before globla invoces are made', async() => {
|
|
invoicesBeforeOneClient = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
|
|
|
expect(invoicesBeforeOneClient).toBeGreaterThanOrEqual(4);
|
|
});
|
|
|
|
it('should open the global invoice form', async() => {
|
|
await page.accessToSection('invoiceOut.global-invoicing');
|
|
});
|
|
|
|
it('should create a global invoice for charles xavier today', async() => {
|
|
await page.waitToClick(selectors.invoiceOutGlobalInvoicing.oneClient);
|
|
await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.clientId, '1108');
|
|
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);
|
|
});
|
|
});
|