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