2019-03-20 07:23:12 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-03-20 10:47:00 +00:00
|
|
|
describe('Item log path', () => {
|
2019-03-20 07:23:12 +00:00
|
|
|
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')
|
2019-03-20 10:47:00 +00:00
|
|
|
.waitForURL('/log')
|
2019-03-20 07:23:12 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('/log');
|
|
|
|
});
|
|
|
|
|
2019-03-20 13:43:38 +00:00
|
|
|
it(`should confirm the log is showing 5 entries`, async() => {
|
|
|
|
const anyLineCreatedCount = await nightmare
|
|
|
|
.wait(selectors.itemLog.anyLineCreated)
|
|
|
|
.countElement(selectors.itemLog.anyLineCreated);
|
2019-03-20 07:23:12 +00:00
|
|
|
|
2019-03-20 13:43:38 +00:00
|
|
|
expect(anyLineCreatedCount).toEqual(5);
|
2019-03-20 12:44:06 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the log is showing the intrastat for the created item`, async() => {
|
2019-03-20 10:47:00 +00:00
|
|
|
const fifthLineCreatedProperty = await nightmare
|
|
|
|
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
|
2019-03-20 07:23:12 +00:00
|
|
|
|
2019-03-20 10:47:00 +00:00
|
|
|
expect(fifthLineCreatedProperty).toEqual('5080000');
|
2019-03-20 07:23:12 +00:00
|
|
|
});
|
|
|
|
});
|