salix/e2e/paths/09-invoice-out/03_manualInvoice.spec.js

66 lines
2.8 KiB
JavaScript
Raw Normal View History

2021-08-09 16:24:53 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('InvoiceOut manual invoice path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'invoiceOut');
});
afterAll(async() => {
await browser.close();
});
it('should open the manual invoice form', async() => {
await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice);
await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
});
it('should create an invoice from a ticket', async() => {
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '7');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
2021-08-11 11:34:32 +00:00
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
2021-08-09 16:24:53 +00:00
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should have been redirected to the created invoice summary`, async() => {
await page.waitForState('invoiceOut.card.summary');
});
it(`should navigate back to the invoiceOut index`, async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.invoiceOutButton);
await page.waitForSelector(selectors.invoiceOutIndex.topbarSearch);
await page.waitForState('invoiceOut.index');
});
it('should now open the manual invoice form', async() => {
await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice);
await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
});
it('should create an invoice from a client', async() => {
2022-03-29 07:10:42 +00:00
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Max Eisenhardt');
2021-08-09 16:24:53 +00:00
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
2021-08-11 11:34:32 +00:00
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
2021-08-09 16:24:53 +00:00
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should have been redirected to the created invoice summary`, async() => {
await page.waitForState('invoiceOut.card.summary');
});
});