Github user iraghumitra commented on a diff in the pull request:

    https://github.com/apache/metron/pull/768#discussion_r142671246
  
    --- Diff: 
metron-interface/metron-alerts/e2e/alerts-list/tree-view/tree-view.e2e-spec.ts 
---
    @@ -0,0 +1,183 @@
    +/// <reference path="../../matchers/custom-matchers.d.ts"/>
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +import {customMatchers} from  '../../matchers/custom-matchers';
    +import {LoginPage} from '../../login/login.po';
    +import {TreeViewPage} from './tree-view.po';
    +import {loadTestData, deleteTestData} from '../../utils/e2e_util';
    +import {MetronAlertsPage} from '../alerts-list.po';
    +
    +describe('metron-alerts tree view', function () {
    +  let page: TreeViewPage;
    +  let listPage: MetronAlertsPage;
    +  let loginPage: LoginPage;
    +
    +  beforeAll(() => {
    +    loadTestData();
    +    loginPage = new LoginPage();
    +    page = new TreeViewPage();
    +    listPage = new MetronAlertsPage();
    +    loginPage.login();
    +    page.navigateToAlertsList();
    +  });
    +
    +  afterAll(() => {
    +    loginPage.logout();
    +    deleteTestData();
    +  });
    +
    +  beforeEach(() => {
    +    jasmine.addMatchers(customMatchers);
    +  });
    +
    +  it('should have all group by elements', () => {
    +    let groupByItems = {
    +      'source:type': '1',
    +      'ip_dst_addr': '8',
    +      'host': '9',
    +      'enrichm...:country': '3',
    +      'ip_src_addr': '2'
    +    };
    +    
expect(page.getGroupByCount()).toEqualBcoz(Object.keys(groupByItems).length, '5 
Group By Elements should be present');
    +    
expect(page.getGroupByItemNames()).toEqualBcoz(Object.keys(groupByItems), 
'Group By Elements names should be present');
    +    
expect(page.getGroupByItemCounts()).toEqualBcoz(Object.keys(groupByItems).map(key
 => groupByItems[key]),
    +                                                    '5 Group By Elements 
values should be present');
    +  });
    +
    +  it('should have group details for single group by', () => {
    +    let dashRowValues = ['0', 'alerts_ui_e2e', 'ALERTS', '169'];
    +    let row1_page1 = ['-', 'dcda4423-7...0962fafc47', '2017-09-13 
17:59:32', 'alerts_ui_e2e',
    +      '192.168.138.158', 'US', '72.34.49.86', 'comarksecurity.com', 'NEW', 
''];
    +    let row1_page2 = ['-', '07b29c29-9...ff19eaa888', '2017-09-13 
17:59:37', 'alerts_ui_e2e',
    +      '192.168.138.158', 'FR', '62.75.195.236', '62.75.195.236', 'NEW', 
''];
    +
    +    page.selectGroup('source:type');
    +    expect(page.getActiveGroups()).toEqualBcoz(['source:type'], 'only 
source type group should be selected');
    +    
expect(page.getDashGroupValues('alerts_ui_e2e')).toEqualBcoz(dashRowValues, 
'Dash Group Values should be present');
    +
    +    page.expandDashGroup('alerts_ui_e2e');
    +    expect(page.getDashGroupTableValuesForRow('alerts_ui_e2e', 
0)).toEqualBcoz(row1_page1, 'Dash Group Values should be present');
    +
    +    page.clickOnNextPage('alerts_ui_e2e');
    +    expect(page.getTableValuesByRowId('alerts_ui_e2e', 0, 
'FR')).toEqualBcoz(row1_page2, 'Dash Group Values should be present');
    +
    +    page.unGroup();
    +    expect(page.getActiveGroups()).toEqualBcoz([], 'no groups should be 
selected');
    +  });
    +
    +  it('should have group details for multiple group by', () => {
    +
    +    let dashRow_runLoveUs = {
    +      'dashRow': ['0', 'runlove.us', 'ALERTS', '13'],
    +      'firstSubGroup': '0 US (13)',
    +      'firstSubGroupIdCol': ['9a969c64-b...001cb011a3', 
'a651f7c3-1...a97d4966c9', 'afc36901-3...d931231ab2',
    +        'd860ac35-1...f9e282d571', '04a5c3d0-9...af17c06fbc']
    +    };
    +
    +    let dashRow_62_75_195_236 = {
    +      'dashRow': ['0', '62.75.195.236', 'ALERTS', '18'],
    +      'firstSubGroup': '0 FR (18)',
    +      'firstSubGroupIdCol': ['07b29c29-9...ff19eaa888', 
'7cd91565-1...de5be54a6e', 'ca5bde58-a...f3a88d2df4',
    +        '5d6faf83-8...b88a407647', 'e2883424-f...79bb8b0606']
    +    };
    +
    +    page.selectGroup('host');
    +    page.selectGroup('enrichments:geo:ip_dst_addr:country');
    +    expect(page.getActiveGroups()).toEqualBcoz(['host', 
'enrichments:geo:ip_dst_addr:country'], 'two groups should be selected');
    +
    +    
expect(page.getDashGroupValues('runlove.us')).toEqualBcoz(dashRow_runLoveUs.dashRow,
    +                                                              'Dash Group 
Values should be present for runlove.us');
    --- End diff --
    
    I am just holding the expected values in a map for easy understanding. 
    The actual values that we are expecting are dashRow, firstSubGroup, 
firstSubGroupIdCol which are present in the map named dashRow_runLoveUs.


---

Reply via email to