2018-02-26 15:06:49 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-02-26 15:06:49 +00:00
|
|
|
|
2018-11-14 17:05:24 +00:00
|
|
|
describe('Item', () => {
|
2018-04-05 07:08:10 +00:00
|
|
|
const nightmare = createNightmare();
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Create path', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-10-31 10:58:10 +00:00
|
|
|
.waitForLogin('buyer');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-02 11:15:17 +00:00
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
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');
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
|
|
|
.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(0);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it('should access to the create item view by clicking the create floating button', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.click(selectors.itemsIndex.createItemButton)
|
|
|
|
.wait(selectors.itemCreateView.createButton)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/create');
|
2018-04-22 14:25:44 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it('should return to the item index by clickig the cancel button', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.click(selectors.itemCreateView.cancelButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
2018-04-22 14:25:44 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it('should now access to the create item view by clicking the create floating button', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.click(selectors.itemsIndex.createItemButton)
|
|
|
|
.wait(selectors.itemCreateView.createButton)
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/create');
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it('should create the Infinity Gauntlet item', async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.type(selectors.itemCreateView.name, 'Infinity Gauntlet')
|
|
|
|
.waitToClick(selectors.itemCreateView.typeSelect)
|
|
|
|
.waitToClick(selectors.itemCreateView.typeSelectOptionThree)
|
|
|
|
.waitToClick(selectors.itemCreateView.intrastatSelect)
|
|
|
|
.waitToClick(selectors.itemCreateView.intrastatSelectOptionOne)
|
|
|
|
.waitToClick(selectors.itemCreateView.originSelect)
|
|
|
|
.waitToClick(selectors.itemCreateView.originSelectOptionOne)
|
|
|
|
.click(selectors.itemCreateView.createButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it('should confirm Infinity Gauntlet item was created', async () => {
|
|
|
|
let result = await nightmare
|
|
|
|
.wait(selectors.itemBasicData.nameInput)
|
|
|
|
.getInputValue(selectors.itemBasicData.nameInput);
|
|
|
|
|
|
|
|
expect(result).toEqual('Infinity Gauntlet');
|
|
|
|
|
|
|
|
|
|
|
|
result = await nightmare
|
2018-02-26 15:06:49 +00:00
|
|
|
.getInputValue(selectors.itemBasicData.typeSelect);
|
2018-10-31 10:58:10 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Crisantemo');
|
|
|
|
|
|
|
|
result = await nightmare
|
|
|
|
.waitProperty(selectors.itemBasicData.intrastatSelect, 'value')
|
|
|
|
.getProperty(selectors.itemBasicData.intrastatSelect, 'value');
|
|
|
|
|
|
|
|
expect(result).toEqual('6021010 Plantas vivas: Esqueje/injerto, Vid');
|
|
|
|
|
|
|
|
result = await nightmare
|
2018-02-26 15:06:49 +00:00
|
|
|
.getInputValue(selectors.itemBasicData.originSelect);
|
2018-10-31 10:58:10 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Spain');
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Clone path', () => {
|
2018-10-31 10:58:10 +00:00
|
|
|
it('should return to the items index by clicking the return to items button', async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.click(selectors.itemBasicData.goToItemIndexButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
|
|
|
.waitForURL('#!/item/index')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('#!/item/index');
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it(`should search for the item Infinity Gauntlet`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it(`should clone the Infinity Gauntlet`, async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet')
|
|
|
|
.click(selectors.itemsIndex.searchResultCloneButton)
|
|
|
|
.waitToClick(selectors.itemsIndex.acceptClonationAlertButton)
|
|
|
|
.waitForURL('tags')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('tags');
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-31 10:58:10 +00:00
|
|
|
it('should search for the item Infinity Gauntlet and find two', async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.itemTags.goToItemIndexButton)
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
|
|
|
|
.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(2);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|