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

97 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-04-17 07:37:55 +00:00
.accessToSearchResult('Melee weapon combat fist 15cm')
.accessToSection('item.card.basicData');
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() => {
const visibleButton = await nightmare
.isVisible(selectors.itemDescriptor.editButton);
expect(visibleButton).toBeTruthy();
});
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
.clearInput(selectors.itemBasicData.nameInput)
2019-01-23 14:33:25 +00:00
.write(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)
2019-01-23 14:33:25 +00:00
.write(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)
2019-01-23 14:33:25 +00:00
.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
2018-11-20 13:22:00 +00:00
.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
.reloadSection('item.card.basicData')
.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
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
2018-11-20 13:22:00 +00:00
expect(result).toBe('unchecked');
2018-02-22 10:26:32 +00:00
});
});