2018-02-22 10:26:32 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-02-22 10:26:32 +00:00
|
|
|
|
2021-11-24 08:21:41 +00:00
|
|
|
fdescribe('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;
|
|
|
|
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');
|
|
|
|
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
|
|
|
});
|
|
|
|
|
2019-02-04 13:47:55 +00:00
|
|
|
it(`should check the descritor edit button is visible for buyer`, async() => {
|
2020-01-26 23:48:00 +00:00
|
|
|
await page.waitForSelector(selectors.itemDescriptor.editButton, {visible: true});
|
2019-02-04 13:47:55 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should edit the item basic data`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.itemBasicData.name);
|
|
|
|
await page.write(selectors.itemBasicData.name, 'Rose of Purity');
|
2021-11-24 08:21:41 +00:00
|
|
|
await page.clearInput(selectors.itemBasicData.longName);
|
|
|
|
await page.write(selectors.itemBasicData.longName, 'RS Rose of Purity');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.itemBasicData.type, 'Anthurium');
|
|
|
|
await page.autocompleteSearch(selectors.itemBasicData.intrastat, 'Coral y materiales similares');
|
2021-11-24 08:21:41 +00:00
|
|
|
await page.autocompleteSearch(selectors.itemBasicData.origin, 'Spain');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.itemBasicData.relevancy);
|
|
|
|
await page.write(selectors.itemBasicData.relevancy, '1');
|
2020-09-17 07:58:00 +00:00
|
|
|
await page.clearInput(selectors.itemBasicData.compression);
|
|
|
|
await page.write(selectors.itemBasicData.compression, '2');
|
2021-11-24 08:21:41 +00:00
|
|
|
await page.clearInput(selectors.itemBasicData.generic);
|
|
|
|
await page.autocompleteSearch(selectors.itemBasicData.generic, '9');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
|
2020-09-17 07:58:00 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.isFragile);
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-02-25 15:36:29 +00:00
|
|
|
});
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-02-17 11:47:03 +00:00
|
|
|
it(`should create a new intrastat`, async() => {
|
|
|
|
await page.waitToClick(selectors.itemBasicData.newIntrastatButton);
|
|
|
|
await page.write(selectors.itemBasicData.newIntrastatId, '588420239');
|
|
|
|
await page.write(selectors.itemBasicData.newIntrastatDescription, 'Tropical Flowers');
|
2021-04-16 14:16:05 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.acceptIntrastatButton);
|
2020-02-17 11:47:03 +00:00
|
|
|
await page.waitForTextInField(selectors.itemBasicData.intrastat, 'Tropical Flowers');
|
|
|
|
let newcode = await page.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
|
|
|
|
|
|
|
|
expect(newcode).toEqual('588420239 Tropical Flowers');
|
|
|
|
});
|
|
|
|
|
2020-02-25 15:36:29 +00:00
|
|
|
it('should save with the new intrastat', async() => {
|
2020-02-17 11:47:03 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2020-02-17 11:47:03 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-02-17 11:47:03 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the item name was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.reloadSection('item.card.basicData');
|
2020-02-03 14:55:11 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.itemBasicData.name, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Rose of Purity');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the item type was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.type, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2019-05-02 09:23:54 +00:00
|
|
|
expect(result).toEqual('Anthurium');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
2020-02-17 11:47:03 +00:00
|
|
|
it(`should confirm the item intrastat was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-02-17 11:47:03 +00:00
|
|
|
expect(result).toEqual('588420239 Tropical Flowers');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the item relevancy was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.relevancy, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('1');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the item origin was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.origin, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Spain');
|
|
|
|
});
|
|
|
|
|
2020-09-17 07:58:00 +00:00
|
|
|
it(`should confirm the item compression was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2020-09-17 07:58:00 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.compression, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-09-17 07:58:00 +00:00
|
|
|
expect(result).toEqual('2');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
2021-11-24 08:21:41 +00:00
|
|
|
it(`should confirm the item generic was edited`, async() => {
|
|
|
|
const result = await page
|
|
|
|
.waitToGetProperty(selectors.itemBasicData.generic, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('9 - Melee Reinforced weapon combat fist 15cm');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the item long name was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2020-02-03 14:55:11 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.longName, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('RS Rose of Purity');
|
|
|
|
});
|
|
|
|
|
2020-09-17 07:58:00 +00:00
|
|
|
it('should confirm isFragile checkbox is unchecked', async() => {
|
|
|
|
const result = await page
|
|
|
|
.checkboxState(selectors.itemBasicData.isFragile);
|
|
|
|
|
2020-09-18 09:50:20 +00:00
|
|
|
expect(result).toBe('checked');
|
2020-09-17 07:58:00 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it('should confirm isActive checkbox is unchecked', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2019-02-14 19:17:22 +00:00
|
|
|
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2019-02-14 19:17:22 +00:00
|
|
|
expect(result).toBe('unchecked');
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
2019-09-18 09:11:47 +00:00
|
|
|
|
|
|
|
it('should confirm the priceInKg checkbox is checked', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page
|
2019-09-18 09:11:47 +00:00
|
|
|
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
|
|
|
|
|
|
|
|
expect(result).toBe('checked');
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|