salix/e2e/paths/07-order/02_basic_data.spec.js

70 lines
2.5 KiB
JavaScript
Raw Normal View History

2019-01-08 11:02:38 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2019-01-08 11:02:38 +00:00
2023-05-05 06:12:38 +00:00
const $ = {
form: 'vn-order-basic-data form',
observation: 'vn-order-basic-data form [vn-name="note"]',
saveButton: `vn-order-basic-data form button[type=submit]`,
acceptButton: '.vn-confirm.shown button[response="accept"]'
};
2019-02-19 15:37:17 +00:00
describe('Order edit basic data path', () => {
let browser;
let page;
2019-06-19 07:03:45 +00:00
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'order');
await page.accessToSearchResult('1');
await page.accessToSection('order.card.basicData');
});
2019-01-08 11:02:38 +00:00
afterAll(async() => {
await browser.close();
});
describe('when confirmed order', () => {
2019-01-08 11:02:38 +00:00
it('should not be able to change the client', async() => {
2023-05-05 06:12:38 +00:00
const message = await page.sendForm($.form, {
client: 'Tony Stark',
address: 'Tony Stark',
});
2019-01-08 11:02:38 +00:00
2023-05-05 06:12:38 +00:00
expect(message.text).toContain(`You can't make changes on the basic data`);
2019-01-08 11:02:38 +00:00
});
});
describe('when new order', () => {
2023-05-05 06:12:38 +00:00
it('should create an order and edit its basic data', async() => {
await page.waitToClick(selectors.globalItems.returnToModuleIndexButton);
2023-05-05 06:12:38 +00:00
await page.waitToClick($.acceptButton);
2020-01-26 23:48:00 +00:00
await page.waitForContentLoaded();
await page.waitToClick(selectors.ordersIndex.createOrderButton);
await page.waitForState('order.create');
2019-06-19 07:03:45 +00:00
2020-02-03 14:55:11 +00:00
await page.autocompleteSearch(selectors.createOrderView.client, 'Jessica Jones');
await page.pickDate(selectors.createOrderView.landedDatePicker);
2020-02-03 14:55:11 +00:00
await page.autocompleteSearch(selectors.createOrderView.agency, 'Other agency');
await page.waitToClick(selectors.createOrderView.createButton);
await page.waitForState('order.card.catalog');
2019-06-14 10:27:41 +00:00
await page.accessToSection('order.card.basicData');
2019-01-08 11:02:38 +00:00
2023-05-05 06:12:38 +00:00
const values = {
client: 'Tony Stark',
address: 'Tony Stark',
agencyMode: 'Other agency'
};
2019-01-08 11:02:38 +00:00
2023-05-05 06:12:38 +00:00
const message = await page.sendForm($.form, values);
await page.reloadSection('order.card.basicData');
2023-05-05 06:12:38 +00:00
const formValues = await page.fetchForm($.form, Object.keys(values));
2019-01-08 11:02:38 +00:00
2023-05-05 06:12:38 +00:00
expect(message.isSuccess).toBeTrue();
expect(formValues).toEqual(values);
2019-01-08 11:02:38 +00:00
});
});
});