53 lines
1.9 KiB
JavaScript
53 lines
1.9 KiB
JavaScript
|
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);
|
||
|
});
|
||
|
});
|
||
|
});
|