2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-02-22 10:26:32 +00:00
|
|
|
|
2023-05-05 06:12:38 +00:00
|
|
|
const $ = {
|
|
|
|
form: 'vn-item-basic-data form',
|
|
|
|
intrastatForm: '.vn-dialog.shown form',
|
|
|
|
newIntrastatButton: 'vn-item-basic-data vn-icon-button[vn-tooltip="New intrastat"] > button'
|
|
|
|
};
|
|
|
|
|
2021-11-26 07:34:32 +00:00
|
|
|
describe('Item Edit basic data path', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
2020-01-09 12:07:16 +00:00
|
|
|
let page;
|
2023-05-05 06:12:38 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
beforeAll(async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.loginAndModule('buyer', 'item');
|
|
|
|
await page.accessToSearchResult('Melee weapon combat fist 15cm');
|
2023-05-05 06:12:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.accessToSection('item.card.basicData');
|
|
|
|
});
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
2023-05-05 06:12:38 +00:00
|
|
|
it(`should edit the item basic data and confirm the item data was edited`, async() => {
|
|
|
|
const values = {
|
|
|
|
type: 'Anthurium',
|
|
|
|
intrastat: 'Coral y materiales similares',
|
|
|
|
relevancy: 1,
|
|
|
|
generic: 'Pallet',
|
|
|
|
isActive: false,
|
|
|
|
priceInKg: true,
|
|
|
|
isFragile: true,
|
|
|
|
packingOut: 5
|
|
|
|
};
|
|
|
|
|
|
|
|
const message = await page.sendForm($.form, values);
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.reloadSection('item.card.basicData');
|
2023-05-05 06:12:38 +00:00
|
|
|
const formValues = await page.fetchForm($.form, Object.keys(values));
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2023-05-05 06:12:38 +00:00
|
|
|
expect(message.isSuccess).toBeTrue();
|
|
|
|
expect(formValues).toEqual(values);
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
2023-05-05 06:12:38 +00:00
|
|
|
it(`should create a new intrastat and save it`, async() => {
|
|
|
|
await page.click($.newIntrastatButton);
|
2023-05-18 07:52:20 +00:00
|
|
|
await page.waitForSelector($.intrastatForm);
|
2023-05-05 06:12:38 +00:00
|
|
|
await page.fillForm($.intrastatForm, {
|
|
|
|
id: '588420239',
|
|
|
|
description: 'Tropical Flowers'
|
|
|
|
});
|
|
|
|
await page.respondToDialog('accept');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2023-05-05 06:12:38 +00:00
|
|
|
const message = await page.sendForm($.form);
|
|
|
|
await page.reloadSection('item.card.basicData');
|
|
|
|
const formValues = await page.fetchForm($.form, ['intrastat']);
|
2022-12-27 06:48:09 +00:00
|
|
|
|
2023-05-05 06:12:38 +00:00
|
|
|
expect(message.isSuccess).toBeTrue();
|
|
|
|
expect(formValues).toEqual({intrastat: 'Tropical Flowers'});
|
2022-12-27 06:48:09 +00:00
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|