salix/e2e/paths/09-invoice-in/03_basic_data.spec.js

65 lines
2.5 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('InvoiceIn basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('administrative', 'invoiceIn');
await page.accessToSearchResult('1');
await page.accessToSection('invoiceIn.card.basicData');
});
afterAll(async() => {
await browser.close();
});
it(`should edit the invoiceIn basic data`, async() => {
const now = new Date();
await page.pickDate(selectors.invoiceInBasicData.issued, now);
await page.pickDate(selectors.invoiceInBasicData.operated, now);
await page.autocompleteSearch(selectors.invoiceInBasicData.supplier, 'Verdnatura');
await page.clearInput(selectors.invoiceInBasicData.supplierRef);
await page.write(selectors.invoiceInBasicData.supplierRef, '9999');
await page.pickDate(selectors.invoiceInBasicData.bookEntried, now);
await page.pickDate(selectors.invoiceInBasicData.booked, now);
2021-07-08 08:06:42 +00:00
await page.autocompleteSearch(selectors.invoiceInBasicData.currency, 'USD');
await page.autocompleteSearch(selectors.invoiceInBasicData.company, 'ORN');
await page.waitToClick(selectors.invoiceInBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should confirm the invoiceIn supplier was edited`, async() => {
await page.reloadSection('invoiceIn.card.basicData');
const result = await page.waitToGetProperty(selectors.invoiceInBasicData.supplier, 'value');
expect(result).toContain('Verdnatura');
});
it(`should confirm the invoiceIn supplierRef was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.invoiceInBasicData.supplierRef, 'value');
expect(result).toEqual('9999');
});
it(`should confirm the invoiceIn currency was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.invoiceInBasicData.currency, 'value');
2021-07-08 08:06:42 +00:00
expect(result).toEqual('USD');
});
it(`should confirm the invoiceIn company was edited`, async() => {
const result = await page
.waitToGetProperty(selectors.invoiceInBasicData.company, 'value');
expect(result).toEqual('ORN');
});
});