Github user nickwallen commented on a diff in the pull request: https://github.com/apache/metron/pull/1004#discussion_r187948446 --- Diff: metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts --- @@ -19,139 +19,142 @@ import { MetronAlertsPage } from '../alerts-list.po'; import {customMatchers} from '../../matchers/custom-matchers'; import {LoginPage} from '../../login/login.po'; -import {loadTestData, deleteTestData} from '../../utils/e2e_util'; +import {loadTestData, deleteTestData, createMetaAlertsIndex} from '../../utils/e2e_util'; import {TreeViewPage} from '../tree-view/tree-view.po'; import {MetronAlertDetailsPage} from '../../alert-details/alert-details.po'; import {MetaAlertPage} from './meta-alert.po'; import {AlertFacetsPage} from '../alert-filters/alert-filters.po'; -describe('meta-alerts workflow', function() { +describe('Test spec for meta alerts workflow', function() { let detailsPage: MetronAlertDetailsPage; let tablePage: MetronAlertsPage; let metaAlertPage: MetaAlertPage; let treePage: TreeViewPage; let loginPage: LoginPage; let alertFacetsPage: AlertFacetsPage; - beforeAll(() => { - loadTestData(); - + beforeAll(async function() : Promise<any> { loginPage = new LoginPage(); - loginPage.login(); tablePage = new MetronAlertsPage(); treePage = new TreeViewPage(); tablePage = new MetronAlertsPage(); metaAlertPage = new MetaAlertPage(); detailsPage = new MetronAlertDetailsPage(); alertFacetsPage = new AlertFacetsPage(); + + await createMetaAlertsIndex(); + await loadTestData(); + await loginPage.login(); }); - afterAll(() => { - loginPage.logout(); - deleteTestData(); + afterAll(async function() : Promise<any> { + await loginPage.logout(); + await deleteTestData(); }); beforeEach(() => { jasmine.addMatchers(customMatchers); }); - it('should have all the steps for meta alerts workflow', () => { + it('should have all the steps for meta alerts workflow', async function() : Promise<any> { let comment1 = 'This is a sample comment'; let userNameAndTimestamp = '- admin - a few seconds ago'; - let confirmText = 'Do you wish to create a meta alert with 113 selected alerts?'; + let confirmText = 'Do you wish to create a meta alert with 13 selected alerts?'; let dashRowValues = { - 'firstDashRow': ['0', '192.168.138.158', 'ALERTS', '113'], - 'secondDashRow': ['0', '192.168.66.1', 'ALERTS', '56'] + 'firstDashRow': ['0', 'runlove.us', 'ALERTS', '13'] }; - tablePage.navigateTo(); + await tablePage.navigateTo(); + expect(await tablePage.getChangesAlertTableTitle('Alerts (0)')).toEqual('Alerts (169)'); /* Create Meta Alert */ - treePage.selectGroup('ip_src_addr'); - expect(treePage.getDashGroupValues('192.168.138.158')).toEqualBcoz(dashRowValues.firstDashRow, 'First Dashrow to be present'); - expect(treePage.getDashGroupValues('192.168.66.1')).toEqualBcoz(dashRowValues.secondDashRow, 'Second Dashrow to be present'); + await treePage.selectGroup('host'); + expect(await treePage.getDashGroupValues('runlove.us')).toEqualBcoz(dashRowValues.firstDashRow, 'First Dashrow to be present'); - treePage.clickOnMergeAlerts('192.168.138.158'); - expect(treePage.getConfirmationText()).toEqualBcoz(confirmText, 'confirmation text to be present'); - treePage.clickNoForConfirmation(); + await treePage.clickOnMergeAlerts('runlove.us'); + expect(await treePage.getConfirmationText()).toEqualBcoz(confirmText, 'confirmation text to be present'); + await treePage.clickNoForConfirmation(); - treePage.clickOnMergeAlerts('192.168.138.158'); - treePage.clickYesForConfirmation(); + await treePage.clickOnMergeAlerts('runlove.us'); + await treePage.clickYesForConfirmation(); - treePage.waitForElementToDisappear('192.168.138.158'); + await treePage.waitForElementToDisappear('runlove.us'); - treePage.unGroup(); + await treePage.unGroup(); /* Table should have all alerts */ - tablePage.waitForMetaAlert(); - expect(tablePage.getPaginationText()).toEqualBcoz('1 - 25 of 57', 'pagination text to be present'); - expect(tablePage.getCellValue(0, 2, '(114)')).toContain('(113)', 'number of alerts in a meta alert should be correct'); - expect(tablePage.getNonHiddenRowCount()).toEqualBcoz(25, '25 rows to be visible'); - expect(tablePage.getAllRowsCount()).toEqualBcoz(138, '138 rows to be available'); - expect(tablePage.getHiddenRowCount()).toEqualBcoz(113, '113 rows to be hidden'); - tablePage.expandMetaAlert(0); - expect(tablePage.getNonHiddenRowCount()).toEqualBcoz(138, '138 rows to be visible after group expand'); - expect(tablePage.getAllRowsCount()).toEqualBcoz(138, '138 rows to be available after group expand'); - expect(tablePage.getHiddenRowCount()).toEqualBcoz(0, '0 rows to be hidden after group expand'); - - /* Meta Alert Status Change */ - tablePage.toggleAlertInList(0); - tablePage.clickActionDropdownOption('Open'); - expect(tablePage.getAlertStatus(0, 'NEW', 2)).toEqual('OPEN'); - expect(tablePage.getAlertStatus(1, 'NEW')).toEqual('OPEN'); - expect(tablePage.getAlertStatus(2, 'NEW')).toEqual('OPEN'); + await tablePage.waitForMetaAlert(157); + expect(await tablePage.getChangedPaginationText('1 - 25 of 169')).toEqualBcoz('1 - 25 of 157', 'pagination text to be present'); + expect(await tablePage.getCellValue(0, 2, '(14)')).toContain('(13)', 'number of alerts in a meta alert should be correct'); + expect(await tablePage.getNonHiddenRowCount()).toEqualBcoz(25, '25 rows to be visible'); + expect(await tablePage.getAllRowsCount()).toEqualBcoz(38, '38 rows to be available'); + expect(await tablePage.getHiddenRowCount()).toEqualBcoz(13, '13 rows to be hidden'); + await tablePage.expandMetaAlert(0); + expect(await tablePage.getNonHiddenRowCount()).toEqualBcoz(38, '38 rows to be visible after group expand'); + expect(await tablePage.getAllRowsCount()).toEqualBcoz(38, '38 rows to be available after group expand'); + expect(await tablePage.getHiddenRowCount()).toEqualBcoz(0, '0 rows to be hidden after group expand'); + + /* Meta Alert Status Change // These do not work till patch works */ + // await tablePage.toggleAlertInList(0); --- End diff -- What do these commented out sections mean? What patch? When will the patch work?
---