105 lines
4.0 KiB
JavaScript
105 lines
4.0 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
describe('Item Edit basic data path', () => {
|
|
const nightmare = createNightmare();
|
|
|
|
beforeAll(() => {
|
|
nightmare
|
|
.loginAndModule('buyer', 'item')
|
|
.accessToSearchResult('Melee weapon combat fist 15cm')
|
|
.accessToSection('item.card.basicData');
|
|
});
|
|
|
|
it(`should check the descritor edit button is visible for buyer`, async() => {
|
|
const visibleButton = await nightmare
|
|
.isVisible(selectors.itemDescriptor.editButton);
|
|
|
|
expect(visibleButton).toBeTruthy();
|
|
});
|
|
|
|
it(`should edit the item basic data`, async() => {
|
|
const result = await nightmare
|
|
.clearInput(selectors.itemBasicData.nameInput)
|
|
.write(selectors.itemBasicData.nameInput, 'Rose of Purity')
|
|
.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium')
|
|
.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares')
|
|
.clearInput(selectors.itemBasicData.relevancyInput)
|
|
.write(selectors.itemBasicData.relevancyInput, '1')
|
|
.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain')
|
|
.autocompleteSearch(selectors.itemBasicData.expenceAutocomplete, 'Alquiler VNH')
|
|
.clearInput(selectors.itemBasicData.longNameInput)
|
|
.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
|
|
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
|
.waitToClick(selectors.itemBasicData.priceInKgCheckbox)
|
|
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
|
.waitForLastSnackbar();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
}, 15000);
|
|
|
|
it(`should confirm the item name was edited`, async() => {
|
|
const result = await nightmare
|
|
.reloadSection('item.card.basicData')
|
|
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
|
|
|
|
expect(result).toEqual('Rose of Purity');
|
|
});
|
|
|
|
it(`should confirm the item type was edited`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
|
|
|
expect(result).toEqual('Anthurium');
|
|
});
|
|
|
|
it(`should confirm the item intrastad was edited`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
|
|
|
expect(result).toEqual('5080000 Coral y materiales similares');
|
|
});
|
|
|
|
it(`should confirm the item relevancy was edited`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value');
|
|
|
|
expect(result).toEqual('1');
|
|
});
|
|
|
|
it(`should confirm the item origin was edited`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
|
|
|
expect(result).toEqual('Spain');
|
|
});
|
|
|
|
it(`should confirm the item expence was edited`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(`${selectors.itemBasicData.expenceAutocomplete} input`, 'value');
|
|
|
|
expect(result).toEqual('Alquiler VNH');
|
|
});
|
|
|
|
it(`should confirm the item long name was edited`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.itemBasicData.longNameInput, 'value');
|
|
|
|
expect(result).toEqual('RS Rose of Purity');
|
|
});
|
|
|
|
it('should confirm isActive checkbox is unchecked', async() => {
|
|
const result = await nightmare
|
|
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
|
|
|
|
expect(result).toBe('unchecked');
|
|
});
|
|
|
|
it('should confirm the priceInKg checkbox is checked', async() => {
|
|
const result = await nightmare
|
|
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
|
|
|
|
expect(result).toBe('checked');
|
|
});
|
|
});
|