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
|
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-10-22 15:12:41 +00:00
|
|
|
it('should access to the items index by clicking the items button', done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
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-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
2018-08-02 12:04:46 +00:00
|
|
|
.countElement(selectors.itemsIndex.searchResult)
|
2018-02-26 15:06:49 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(0);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should access to the create item view by clicking the create floating button', done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
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');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-22 14:25:44 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should return to the item index by clickig the cancel button', done => {
|
2018-04-22 14:25:44 +00:00
|
|
|
return nightmare
|
|
|
|
.click(selectors.itemCreateView.cancelButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
2018-05-25 08:03:45 +00:00
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-22 14:25:44 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should now access to the create item view by clicking the create floating button', done => {
|
2018-04-22 14:25:44 +00:00
|
|
|
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');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should create the Infinity Gauntlet item', done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
return nightmare
|
|
|
|
.type(selectors.itemCreateView.name, 'Infinity Gauntlet')
|
|
|
|
.waitToClick(selectors.itemCreateView.typeSelect)
|
2018-09-13 10:32:33 +00:00
|
|
|
.waitToClick(selectors.itemCreateView.typeSelectOptionThree)
|
2018-02-26 15:06:49 +00:00
|
|
|
.waitToClick(selectors.itemCreateView.intrastatSelect)
|
|
|
|
.waitToClick(selectors.itemCreateView.intrastatSelectOptionOne)
|
|
|
|
.waitToClick(selectors.itemCreateView.originSelect)
|
|
|
|
.waitToClick(selectors.itemCreateView.originSelectOptionOne)
|
|
|
|
.click(selectors.itemCreateView.createButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-02-26 15:06:49 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm Infinity Gauntlet item was created', done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
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-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Clone path', () => {
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should return to the items index by clicking the return to items button', done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
return nightmare
|
|
|
|
.click(selectors.itemBasicData.goToItemIndexButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
2018-05-25 08:03:45 +00:00
|
|
|
.waitForURL('#!/item/index')
|
2018-02-26 15:06:49 +00:00
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
2018-05-25 08:03:45 +00:00
|
|
|
expect(url.hash).toContain('#!/item/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should search for the item Infinity Gauntlet`, done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
2018-08-02 12:04:46 +00:00
|
|
|
.countElement(selectors.itemsIndex.searchResult)
|
2018-02-26 15:06:49 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should clone the Infinity Gauntlet`, done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
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');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should search for the item Infinity Gauntlet and find two', done => {
|
2018-02-26 15:06:49 +00:00
|
|
|
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)
|
2018-08-02 12:04:46 +00:00
|
|
|
.countElement(selectors.itemsIndex.searchResult)
|
2018-02-26 15:06:49 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(2);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 15:06:49 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|