salix/e2e/paths/04-item/11_item_log.spec.js

65 lines
2.6 KiB
JavaScript
Raw Normal View History

2019-03-20 07:23:12 +00:00
import selectors from '../../helpers/selectors.js';
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', () => {
let browser;
2020-01-09 12:07:16 +00:00
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
2020-01-09 12:07:16 +00:00
await page.loginAndModule('developer', 'item');
});
afterAll(async() => {
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() => {
await page.doSearch('Knowledge artifact');
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
2019-03-20 07:23:12 +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);
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-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
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.waitForSelector(selectors.itemsIndex.createItemButton);
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() => {
await page.waitForSelector(selectors.itemLog.anyLineCreated);
2020-01-09 12:07:16 +00:00
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
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');
2019-03-20 07:23:12 +00:00
});
});