import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; // #777 e2e item.log xdescribe('Item log path', () => { const nightmare = createNightmare(); beforeAll(() => { nightmare .loginAndModule('developer', 'item'); }); it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => { const result = await nightmare .write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact') .waitToClick(selectors.itemsIndex.searchButton) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 0) .countElement(selectors.itemsIndex.searchResult); expect(result).toEqual(0); }); it('should access to the create item view by clicking the create floating button', async() => { const url = await nightmare .waitToClick(selectors.itemsIndex.createItemButton) .wait(selectors.itemCreateView.createButton) .parsedUrl(); expect(url.hash).toEqual('#!/item/create'); }); it('should create the Knowledge artifact item', async() => { const result = await nightmare .write(selectors.itemCreateView.temporalName, 'Knowledge artifact') .autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo') .autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares') .autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand') .waitToClick(selectors.itemCreateView.createButton) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should return to the items index by clicking the return to items button', async() => { const url = await nightmare .waitToClick(selectors.itemBasicData.goToItemIndexButton) .wait(selectors.itemsIndex.createItemButton) .waitForURL('#!/item/index') .parsedUrl(); expect(url.hash).toContain('#!/item/index'); }); it(`should search for the created item and navigate to it's log section`, async() => { const url = await nightmare .accessToSearchResult('Knowledge artifact') .accessToSection('item.card.log') .wait(selectors.itemLog.firstLineCreatedProperty) .parsedUrl(); expect(url.hash).toContain('/log'); }); it(`should search for the created item and navigate to it's log section`, async() => { const firstLineCreatedProperty = await nightmare .waitToGetProperty(selectors.itemLog.firstLineCreatedProperty, 'innerText'); const thirdLineCreatedProperty = await nightmare .waitToGetProperty(selectors.itemLog.thirdLineCreatedProperty, 'innerText'); expect(firstLineCreatedProperty).toContain('Knoledge artifact'); expect(thirdLineCreatedProperty).toContain('nos e que'); }); });