2018-02-22 10:26:32 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Item', () => {
|
|
|
|
describe('Edit basic data path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-02-22 10:26:32 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-10-11 07:14:26 +00:00
|
|
|
.waitForLogin('buyer');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-02 11:15:17 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should access to the items index by clicking the items button', () => {
|
|
|
|
return nightmare
|
|
|
|
.click(selectors.moduleAccessView.itemsSectionButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
2018-05-25 08:03:45 +00:00
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should search for the item Gem of Mind', () => {
|
|
|
|
return nightmare
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
2018-08-02 12:04:46 +00:00
|
|
|
.countElement(selectors.itemsIndex.searchResult)
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should click on the search result to access to the item basic data`, () => {
|
|
|
|
return nightmare
|
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.itemBasicData.basicDataButton)
|
|
|
|
.waitForURL('data')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('data');
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should edit the item basic data`, () => {
|
|
|
|
return nightmare
|
|
|
|
.clearInput(selectors.itemBasicData.nameInput)
|
|
|
|
.type(selectors.itemBasicData.nameInput, 'Rose of Purity')
|
|
|
|
.waitToClick(selectors.itemBasicData.typeSelect)
|
2018-09-13 10:32:33 +00:00
|
|
|
.waitToClick(selectors.itemBasicData.typeSelectOptionThree)
|
2018-04-05 06:55:47 +00:00
|
|
|
.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)
|
2018-10-01 11:46:09 +00:00
|
|
|
.waitToClick(selectors.itemBasicData.expenceSelectOptionThree)
|
2018-07-27 10:15:25 +00:00
|
|
|
.clearInput(selectors.itemBasicData.longNameInput)
|
|
|
|
.type(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
|
2018-10-15 11:20:55 +00:00
|
|
|
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
2018-04-05 06:55:47 +00:00
|
|
|
.click(selectors.itemBasicData.submitBasicDataButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the item name was edited`, () => {
|
|
|
|
return nightmare
|
|
|
|
.click(selectors.itemNiches.nicheButton)
|
|
|
|
.wait(selectors.itemNiches.firstWarehouseDisabled)
|
|
|
|
.waitToClick(selectors.itemBasicData.basicDataButton)
|
|
|
|
.waitForTextInInput(selectors.itemBasicData.nameInput, 'Rose of Purity')
|
|
|
|
.getInputValue(selectors.itemBasicData.nameInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Rose of Purity');
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the item type was edited`, () => {
|
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemBasicData.typeSelect)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Crisantemo');
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the item intrastad was edited`, () => {
|
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemBasicData.intrastatSelect)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Coral y materiales similares');
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the item relevancy was edited`, () => {
|
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemBasicData.relevancyInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('1');
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the item origin was edited`, () => {
|
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemBasicData.originSelect)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Spain');
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the item expence was edited`, () => {
|
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemBasicData.expenceSelect)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Adquisición mercancia Extracomunitaria');
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
2018-07-27 10:15:25 +00:00
|
|
|
|
|
|
|
it(`should confirm the item long name was edited`, () => {
|
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemBasicData.longNameInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('RS Rose of Purity');
|
|
|
|
});
|
|
|
|
});
|
2018-10-15 11:20:55 +00:00
|
|
|
|
|
|
|
it('should confirm isActive checkbox is unchecked', () => {
|
|
|
|
return nightmare
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
|
|
|
}, selectors.itemBasicData.isActiveCheckbox)
|
|
|
|
.then(value => {
|
|
|
|
expect(value).toBeFalsy();
|
|
|
|
});
|
|
|
|
});
|
2018-02-22 10:26:32 +00:00
|
|
|
});
|
|
|
|
});
|