2018-02-22 10:26:32 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
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
|
|
|
|
.waitForLogin('buyer');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should access to the items index by clicking the items button', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.click(selectors.moduleAccessView.itemsSectionButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for the item Gem of Mind', async () => {
|
|
|
|
const resultCount = await nightmare
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.itemsIndex.searchItemInput)
|
2018-11-20 13:22:00 +00:00
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(resultCount).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the item basic data`, async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.itemBasicData.basicDataButton)
|
|
|
|
.waitForURL('data')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
expect(url.hash).toContain('data');
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should edit the item basic data`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.clearInput(selectors.itemBasicData.nameInput)
|
|
|
|
.type(selectors.itemBasicData.nameInput, 'Rose of Purity')
|
|
|
|
.waitToClick(selectors.itemBasicData.typeSelect)
|
|
|
|
.waitToClick(selectors.itemBasicData.typeSelectOptionThree)
|
|
|
|
.waitToClick(selectors.itemBasicData.intrastatSelect)
|
|
|
|
.waitToClick(selectors.itemBasicData.intrastatSelectOptionOne)
|
|
|
|
.clearInput(selectors.itemBasicData.relevancyInput)
|
|
|
|
.type(selectors.itemBasicData.relevancyInput, '1')
|
|
|
|
.waitToClick(selectors.itemBasicData.originSelect)
|
|
|
|
.waitToClick(selectors.itemBasicData.originSelectOptionTwo)
|
|
|
|
.waitToClick(selectors.itemBasicData.expenceSelect)
|
|
|
|
.waitToClick(selectors.itemBasicData.expenceSelectOptionThree)
|
|
|
|
.clearInput(selectors.itemBasicData.longNameInput)
|
|
|
|
.type(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
|
|
|
|
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
|
|
|
.click(selectors.itemBasicData.submitBasicDataButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the item name was edited`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.click(selectors.itemNiches.nicheButton)
|
|
|
|
.wait(selectors.itemNiches.firstWarehouseDisabled)
|
|
|
|
.waitToClick(selectors.itemBasicData.basicDataButton)
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Rose of Purity');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the item type was edited`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.typeSelect, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Crisantemo');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the item intrastad was edited`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.intrastatSelect, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('5080000 Coral y materiales similares');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the item relevancy was edited`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('1');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the item origin was edited`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.originSelect, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Spain');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the item expence was edited`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.expenceSelect, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Adquisición mercancia Extracomunitaria');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the item long name was edited`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 11:34:20 +00:00
|
|
|
.waitToGetProperty(selectors.itemBasicData.longNameInput, 'value');
|
2018-11-20 13:22:00 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('RS Rose of Purity');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm isActive checkbox is unchecked', async () => {
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|