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

68 lines
2.8 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() => {
2020-02-03 14:55:11 +00:00
await page.write(selectors.itemsIndex.topbarSearch, 'Knowledge artifact');
2020-01-09 12:07:16 +00:00
await page.waitToClick(selectors.itemsIndex.searchButton);
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
const result = await page.countElement(selectors.itemsIndex.searchResult);
2019-03-20 07:23:12 +00:00
expect(result).toEqual(0);
});
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);
const result = await page.waitForLastSnackbar();
2019-03-20 07:23:12 +00:00
expect(result).toEqual('Data saved!');
});
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);
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');
await page.waitForState('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
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');
2019-03-20 07:23:12 +00:00
});
});