2019-03-20 07:23:12 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-03-20 07:23:12 +00:00
|
|
|
|
2019-03-20 10:47:00 +00:00
|
|
|
describe('Item log path', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
2020-01-09 12:07:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.loginAndModule('developer', 'item');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
2019-03-20 07:23:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => {
|
2020-03-31 16:33:48 +00:00
|
|
|
await page.doSearch('Knowledge artifact');
|
|
|
|
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
|
2019-03-20 07:23:12 +00:00
|
|
|
|
2020-03-31 16:33:48 +00:00
|
|
|
expect(nResults).toEqual(0);
|
2019-03-20 07:23:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should access to the create item view by clicking the create floating button', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('item.create');
|
2019-03-20 07:23:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should create the Knowledge artifact item', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.write(selectors.itemCreateView.temporalName, 'Knowledge artifact');
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo');
|
|
|
|
await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares');
|
|
|
|
await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand');
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemCreateView.createButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-20 07:23:12 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
2019-03-20 07:23:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should return to the items index by clicking the return to items button', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
|
|
|
await page.wait(selectors.itemsIndex.createItemButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('item.index');
|
2019-03-20 07:23:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should search for the created item and navigate to it's log section`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.accessToSearchResult('Knowledge artifact');
|
|
|
|
await page.accessToSection('item.card.log');
|
2019-03-20 07:23:12 +00:00
|
|
|
});
|
|
|
|
|
2019-03-20 13:43:38 +00:00
|
|
|
it(`should confirm the log is showing 5 entries`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.wait(selectors.itemLog.anyLineCreated);
|
|
|
|
const anyLineCreatedCount = await page.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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const fifthLineCreatedProperty = await page
|
2019-03-20 10:47:00 +00:00
|
|
|
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
|
2019-03-20 07:23:12 +00:00
|
|
|
|
2019-03-29 06:36:26 +00:00
|
|
|
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');
|
2019-03-20 07:23:12 +00:00
|
|
|
});
|
|
|
|
});
|