From f411b11de6085272dbde1522170594447b893ce1 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 20 Mar 2019 08:23:12 +0100 Subject: [PATCH] #777 e2e item.log unfinished --- e2e/helpers/selectors.js | 4 ++ e2e/paths/item-module/11_item_log.spec.js | 73 +++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 e2e/paths/item-module/11_item_log.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 35a7eb3fc..80f828d03 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -292,6 +292,10 @@ export default { fifthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(5) > vn-td.balance', warehouseAutocomplete: 'vn-item-diary vn-autocomplete[field="$ctrl.warehouseFk"]', }, + itemLog: { + firstLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(1) > vn-td > vn-one:nth-child(3) > div span:nth-child(3)', + thirdLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(4) > vn-td > vn-one:nth-child(3) > div span:nth-child(3)', + }, ticketSummary: { sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr', firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span', diff --git a/e2e/paths/item-module/11_item_log.spec.js b/e2e/paths/item-module/11_item_log.spec.js new file mode 100644 index 000000000..a08c94e31 --- /dev/null +++ b/e2e/paths/item-module/11_item_log.spec.js @@ -0,0 +1,73 @@ +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'); + }); +});