salix/e2e/paths/04-item/02_basic_data.spec.js

68 lines
2.1 KiB
JavaScript
Raw Normal View History

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'
};
describe('Item Edit basic data path', () => {
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() => {
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() => {
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 = {
name: 'Rose of Purity',
longName: 'RS Rose of Purity',
type: 'Anthurium',
intrastat: 'Coral y materiales similares',
origin: 'Spain',
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
});