salix/e2e/paths/item-module/08_item_clone.spec.js

53 lines
1.9 KiB
JavaScript
Raw Normal View History

2018-02-23 08:42:19 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Item clone path', () => {
const nightmare = createNightmare();
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 Iron Patriot', () => {
return nightmare
.wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Iron Patriot')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countSearchResults(selectors.itemsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
it(`should clone the Iron Patriot`, () => {
return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Iron Patriot')
.click(selectors.itemsIndex.searchResultCloneButton)
.waitToClick(selectors.itemsIndex.acceptClonationAlertButton)
.waitForURL('tags')
.parsedUrl()
.then(url => {
expect(url.hash).toContain('tags');
});
});
it('should search for the item Iron Patriot and find two', () => {
return nightmare
.wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Iron Patriot')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
.countSearchResults(selectors.itemsIndex.searchResult)
.then(result => {
expect(result).toEqual(2);
});
});
});