141 lines
5.5 KiB
JavaScript
141 lines
5.5 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Item Edit basic data path', () => {
|
|
let browser;
|
|
let page;
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('buyer', 'item');
|
|
await page.accessToSearchResult('Melee weapon combat fist 15cm');
|
|
await page.accessToSection('item.card.basicData');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.close();
|
|
});
|
|
|
|
it(`should check the descritor edit button is visible for buyer`, async() => {
|
|
await page.waitForSelector(selectors.itemDescriptor.editButton, {visible: true});
|
|
});
|
|
|
|
it(`should edit the item basic data`, async() => {
|
|
await page.clearInput(selectors.itemBasicData.name);
|
|
await page.write(selectors.itemBasicData.name, 'Rose of Purity');
|
|
await page.clearInput(selectors.itemBasicData.longName);
|
|
await page.write(selectors.itemBasicData.longName, 'RS Rose of Purity');
|
|
await page.autocompleteSearch(selectors.itemBasicData.type, 'Anthurium');
|
|
await page.autocompleteSearch(selectors.itemBasicData.intrastat, 'Coral y materiales similares');
|
|
await page.autocompleteSearch(selectors.itemBasicData.origin, 'Spain');
|
|
await page.clearInput(selectors.itemBasicData.relevancy);
|
|
await page.write(selectors.itemBasicData.relevancy, '1');
|
|
await page.clearInput(selectors.itemBasicData.compression);
|
|
await page.write(selectors.itemBasicData.compression, '2');
|
|
await page.clearInput(selectors.itemBasicData.generic);
|
|
await page.autocompleteSearch(selectors.itemBasicData.generic, '16');
|
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
|
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
|
|
await page.waitToClick(selectors.itemBasicData.isFragile);
|
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
});
|
|
|
|
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');
|
|
await page.waitToClick(selectors.itemBasicData.acceptIntrastatButton);
|
|
await page.waitForTextInField(selectors.itemBasicData.intrastat, 'Tropical Flowers');
|
|
let newcode = await page.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
|
|
|
|
expect(newcode).toEqual('588420239 Tropical Flowers');
|
|
});
|
|
|
|
it('should save with the new intrastat', async() => {
|
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
});
|
|
|
|
it(`should confirm the item name was edited`, async() => {
|
|
await page.reloadSection('item.card.basicData');
|
|
const result = await page.waitToGetProperty(selectors.itemBasicData.name, 'value');
|
|
|
|
expect(result).toEqual('Rose of Purity');
|
|
});
|
|
|
|
it(`should confirm the item type was edited`, async() => {
|
|
const result = await page
|
|
.waitToGetProperty(selectors.itemBasicData.type, 'value');
|
|
|
|
expect(result).toEqual('Anthurium');
|
|
});
|
|
|
|
it(`should confirm the item intrastat was edited`, async() => {
|
|
const result = await page
|
|
.waitToGetProperty(selectors.itemBasicData.intrastat, 'value');
|
|
|
|
expect(result).toEqual('588420239 Tropical Flowers');
|
|
});
|
|
|
|
it(`should confirm the item relevancy was edited`, async() => {
|
|
const result = await page
|
|
.waitToGetProperty(selectors.itemBasicData.relevancy, 'value');
|
|
|
|
expect(result).toEqual('1');
|
|
});
|
|
|
|
it(`should confirm the item origin was edited`, async() => {
|
|
const result = await page
|
|
.waitToGetProperty(selectors.itemBasicData.origin, 'value');
|
|
|
|
expect(result).toEqual('Spain');
|
|
});
|
|
|
|
it(`should confirm the item compression was edited`, async() => {
|
|
const result = await page
|
|
.waitToGetProperty(selectors.itemBasicData.compression, 'value');
|
|
|
|
expect(result).toEqual('2');
|
|
});
|
|
|
|
it(`should confirm the item generic was edited`, async() => {
|
|
const result = await page
|
|
.waitToGetProperty(selectors.itemBasicData.generic, 'value');
|
|
|
|
expect(result).toEqual('16 - Pallet');
|
|
});
|
|
|
|
it(`should confirm the item long name was edited`, async() => {
|
|
const result = await page
|
|
.waitToGetProperty(selectors.itemBasicData.longName, 'value');
|
|
|
|
expect(result).toEqual('RS Rose of Purity');
|
|
});
|
|
|
|
it('should confirm isFragile checkbox is unchecked', async() => {
|
|
const result = await page
|
|
.checkboxState(selectors.itemBasicData.isFragile);
|
|
|
|
expect(result).toBe('checked');
|
|
});
|
|
|
|
it('should confirm isActive checkbox is unchecked', async() => {
|
|
const result = await page
|
|
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
|
|
|
|
expect(result).toBe('unchecked');
|
|
});
|
|
|
|
it('should confirm the priceInKg checkbox is checked', async() => {
|
|
const result = await page
|
|
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
|
|
|
|
expect(result).toBe('checked');
|
|
});
|
|
});
|