salix/e2e/paths/item-module/02_edit_item_basic_data.spe...

95 lines
3.7 KiB
JavaScript
Raw Normal View History

2018-02-22 10:26:32 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2018-02-22 10:26:32 +00:00
2018-11-20 13:22:00 +00:00
describe('Item Edit basic data path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
2019-01-10 06:26:10 +00:00
.accessToSearchResult('Object2 Gem2 3')
.accessToSection('item.card.data');
2018-11-20 13:22:00 +00:00
});
2019-01-07 08:33:07 +00:00
it(`should edit the item basic data`, async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
.wait(selectors.itemBasicData.nameInput)
2018-11-20 13:22:00 +00:00
.clearInput(selectors.itemBasicData.nameInput)
.type(selectors.itemBasicData.nameInput, 'Rose of Purity')
2019-01-07 08:33:07 +00:00
.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Crisantemo')
.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares')
2018-11-20 13:22:00 +00:00
.clearInput(selectors.itemBasicData.relevancyInput)
.type(selectors.itemBasicData.relevancyInput, '1')
2019-01-07 08:33:07 +00:00
.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain')
.autocompleteSearch(selectors.itemBasicData.expenceAutocomplete, 'Alquiler VNH')
2018-11-20 13:22:00 +00:00
.clearInput(selectors.itemBasicData.longNameInput)
.type(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
2019-01-07 08:33:07 +00:00
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
2018-11-20 13:22:00 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
2019-01-07 08:33:07 +00:00
}, 15000);
2018-11-20 13:22:00 +00:00
2019-01-07 08:33:07 +00:00
it(`should confirm the item name was edited`, async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
.click(selectors.itemNiches.nicheButton)
.wait(selectors.itemNiches.firstWarehouseDisabled)
.waitToClick(selectors.itemBasicData.basicDataButton)
.waitToGetProperty(selectors.itemBasicData.nameInput, '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() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Crisantemo');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item intrastad was edited`, async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('5080000 Coral y materiales similares');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item relevancy was edited`, async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
.waitToGetProperty(selectors.itemBasicData.relevancyInput, '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() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('Spain');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item expence was edited`, async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemBasicData.expenceAutocomplete} input`, 'value');
2018-11-20 13:22:00 +00:00
2019-01-07 08:33:07 +00:00
expect(result).toEqual('Alquiler VNH');
2018-11-20 13:22:00 +00:00
});
2019-01-07 08:33:07 +00:00
it(`should confirm the item long name was edited`, async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
.waitToGetProperty(selectors.itemBasicData.longNameInput, 'value');
2018-11-20 13:22:00 +00:00
expect(result).toEqual('RS Rose of Purity');
});
2019-01-07 08:33:07 +00:00
it('should confirm isActive checkbox is unchecked', async() => {
2018-11-20 13:22:00 +00:00
const result = await nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.itemBasicData.isActiveCheckbox);
expect(result).toBeFalsy();
2018-02-22 10:26:32 +00:00
});
});