From c0b6a994c8011f9dcfaf1fff5cb5c205d808049e Mon Sep 17 00:00:00 2001 From: tiborm Date: Wed, 4 Jul 2018 13:24:03 +0200 Subject: [PATCH 1/8] METRON-1651: ignoring tests fails by a know issue --- .../alert-details-status.e2e-spec.ts | 129 +++++++++--------- 1 file changed, 68 insertions(+), 61 deletions(-) diff --git a/metron-interface/metron-alerts/e2e/alert-details/alert-status/alert-details-status.e2e-spec.ts b/metron-interface/metron-alerts/e2e/alert-details/alert-status/alert-details-status.e2e-spec.ts index 28d9ed0971..ae58ea1e2e 100644 --- a/metron-interface/metron-alerts/e2e/alert-details/alert-status/alert-details-status.e2e-spec.ts +++ b/metron-interface/metron-alerts/e2e/alert-details/alert-status/alert-details-status.e2e-spec.ts @@ -49,7 +49,13 @@ describe('Test spec for metron details page', function() { jasmine.addMatchers(customMatchers); }); - it('should change alert statuses', async function() : Promise { + /** + * Test is failing because of a known issue of Metron Alert UI. + * https://issues.apache.org/jira/browse/METRON-1654 + * + * Till the fix become available the test should remain ignored. + * */ + xit('should change alert statuses', async function() : Promise { let alertId = '2cc174d7-c049-aaf4-d0d6-138073777309'; await page.navigateTo(alertId); @@ -69,84 +75,85 @@ describe('Test spec for metron details page', function() { await page.clickNew(); }); - // The below code will fail until this issue is resolved in Protractor: https://github.com/angular/protractor/issues/4693 - // This is because the connection resets before deleting the test comment, which causes the assertion to be false - - // it('should add comments for table view', async function() : Promise { - // let comment1 = 'This is a sample comment'; - // let comment2 = 'This is a sample comment again'; - // let userNameAndTimestamp = '- admin - a few seconds ago'; - // let alertId = '2cc174d7-c049-aaf4-d0d6-138073777309'; + /** + * The below code will fail until this issue is resolved in Protractor: https://github.com/angular/protractor/issues/4693 + * This is because the connection resets before deleting the test comment, which causes the assertion to be false + */ + xit('should add comments for table view', async function() : Promise { + let comment1 = 'This is a sample comment'; + let comment2 = 'This is a sample comment again'; + let userNameAndTimestamp = '- admin - a few seconds ago'; + let alertId = '2cc174d7-c049-aaf4-d0d6-138073777309'; - // page.navigateTo(alertId); + page.navigateTo(alertId); - // await page.clickCommentsInSideNav(); - // await page.addCommentAndSave(comment1, 0); + await page.clickCommentsInSideNav(); + await page.addCommentAndSave(comment1, 0); - // expect(await page.getCommentsText()).toEqual([comment1]); - // expect(await page.getCommentsUserNameAndTimeStamp()).toEqual([userNameAndTimestamp]); + expect(await page.getCommentsText()).toEqual([comment1]); + expect(await page.getCommentsUserNameAndTimeStamp()).toEqual([userNameAndTimestamp]); - // await page.addCommentAndSave(comment2, 0); - // expect(await page.getCommentsText()).toEqual([comment2, comment1]); - // expect(await page.getCommentsUserNameAndTimeStamp()).toEqual([userNameAndTimestamp, userNameAndTimestamp]); + await page.addCommentAndSave(comment2, 0); + expect(await page.getCommentsText()).toEqual([comment2, comment1]); + expect(await page.getCommentsUserNameAndTimeStamp()).toEqual([userNameAndTimestamp, userNameAndTimestamp]); - // await page.deleteComment(); - // await page.clickNoForConfirmation(); - // expect(await page.getCommentsText()).toEqual([comment2, comment1]); + await page.deleteComment(); + await page.clickNoForConfirmation(); + expect(await page.getCommentsText()).toEqual([comment2, comment1]); - // await page.deleteComment(); - // await page.clickYesForConfirmation(comment2); - // expect(await page.getCommentsText()).toEqual([comment1]); + await page.deleteComment(); + await page.clickYesForConfirmation(comment2); + expect(await page.getCommentsText()).toEqual([comment1]); - // expect(await page.getCommentIconCountInListView()).toEqual(1); + expect(await page.getCommentIconCountInListView()).toEqual(1); - // await page.deleteComment(); - // await page.clickYesForConfirmation(comment1); - // expect(await page.getCommentsText()).toEqual([]); + await page.deleteComment(); + await page.clickYesForConfirmation(comment1); + expect(await page.getCommentsText()).toEqual([]); - // await page.closeDetailPane(); - // }); + await page.closeDetailPane(); + }); - // it('should add comments for tree view', async function(): Promise { - // let comment1 = 'This is a sample comment'; - // let comment2 = 'This is a sample comment again'; - // let userNameAndTimestamp = '- admin - a few seconds ago'; + xit('should add comments for tree view', async function(): Promise { + let comment1 = 'This is a sample comment'; + let comment2 = 'This is a sample comment again'; + let userNameAndTimestamp = '- admin - a few seconds ago'; - // await treePage.navigateToAlertsList(); - // await treePage.selectGroup('source:type'); - // await treePage.expandDashGroup('alerts_ui_e2e'); + await treePage.navigateToAlertsList(); + await treePage.selectGroup('source:type'); + await treePage.expandDashGroup('alerts_ui_e2e'); - // await treePage.clickOnRow('acf5a641-9cdb-d7ec-c309-6ea316e14fbe'); - // await page.clickCommentsInSideNav(); - // await page.addCommentAndSave(comment1, 0); + await treePage.clickOnRow('acf5a641-9cdb-d7ec-c309-6ea316e14fbe'); + await page.clickCommentsInSideNav(); + await page.addCommentAndSave(comment1, 0); - // expect(await page.getCommentsText()).toEqual([comment1]); - // expect(await page.getCommentsUserNameAndTimeStamp()).toEqual([userNameAndTimestamp]); - // expect(await page.getCommentIconCountInTreeView()).toEqual(1); + expect(await page.getCommentsText()).toEqual([comment1]); + expect(await page.getCommentsUserNameAndTimeStamp()).toEqual([userNameAndTimestamp]); + expect(await page.getCommentIconCountInTreeView()).toEqual(1); - // await page.deleteComment(); - // await page.clickYesForConfirmation(comment1); - // expect(await page.getCommentsText()).toEqual([]); - // await page.closeDetailPane(); + await page.deleteComment(); + await page.clickYesForConfirmation(comment1); + expect(await page.getCommentsText()).toEqual([]); + await page.closeDetailPane(); - // await treePage.unGroup(); + await treePage.unGroup(); - // await treePage.selectGroup('source:type'); - // await treePage.selectGroup('enrichments:geo:ip_dst_addr:country'); - // await treePage.expandDashGroup('alerts_ui_e2e'); - // await treePage.expandSubGroup('alerts_ui_e2e', 'FR'); + await treePage.selectGroup('source:type'); + await treePage.selectGroup('enrichments:geo:ip_dst_addr:country'); + await treePage.expandDashGroup('alerts_ui_e2e'); + await treePage.expandSubGroup('alerts_ui_e2e', 'FR'); - // await treePage.clickOnRow('07b29c29-9ab0-37dd-31d3-08ff19eaa888'); - // await page.clickCommentsInSideNav(); - // await page.addCommentAndSave(comment2, 0); + await treePage.clickOnRow('07b29c29-9ab0-37dd-31d3-08ff19eaa888'); + await page.clickCommentsInSideNav(); + await page.addCommentAndSave(comment2, 0); - // expect(await page.getCommentsText()).toEqual(comment2); - // expect(await page.getCommentsUserNameAndTimeStamp()).toEqual(userNameAndTimestamp); - // expect(await page.getCommentIconCountInTreeView()).toEqual(1); + expect(await page.getCommentsText()).toEqual(comment2); + expect(await page.getCommentsUserNameAndTimeStamp()).toEqual(userNameAndTimestamp); + expect(await page.getCommentIconCountInTreeView()).toEqual(1); - // await page.deleteComment(); - // await page.clickYesForConfirmation(comment2); - // await page.closeDetailPane(); - // }); + await page.deleteComment(); + await page.clickYesForConfirmation(comment2); + await page.closeDetailPane(); + }); }); From dafd0fd2aa90c24986869aeb297519e92203f30a Mon Sep 17 00:00:00 2001 From: tiborm Date: Thu, 5 Jul 2018 11:44:47 +0200 Subject: [PATCH 2/8] METRON-1651: linking faling assertations to the related bug ticket --- .../alerts-list/meta-alerts/meta-alert.e2e-spec.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts index 5bf7fd8b60..3e113a03ab 100644 --- a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts +++ b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts @@ -57,6 +57,7 @@ describe('Test spec for meta alerts workflow', function() { jasmine.addMatchers(customMatchers); }); + // Test cannot pass until issue with missing dash score is resolved: https://issues.apache.org/jira/browse/METRON-1631 it('should have all the steps for meta alerts workflow', async function() : Promise { let comment1 = 'This is a sample comment'; let userNameAndTimestamp = '- admin - a few seconds ago'; @@ -113,7 +114,7 @@ describe('Test spec for meta alerts workflow', function() { await detailsPage.clickRenameMetaAlert(); await detailsPage.renameMetaAlert('e2e-meta-alert'); await detailsPage.saveRename(); - expect(detailsPage.getAlertNameOrId()).toEqual('e2e-meta-alert'); + expect(await detailsPage.getAlertNameOrId()).toEqual('e2e-meta-alert'); // The below code will fail until this issue is resolved in Protractor: https://github.com/angular/protractor/issues/4693 // This is because the connection resets before deleting the test comment, which causes the assertion to be false @@ -137,14 +138,16 @@ describe('Test spec for meta alerts workflow', function() { expect(await metaAlertPage.getAvailableMetaAlerts()).toEqualBcoz('e2e-meta-alert (22)', 'Meta alert should be present'); await metaAlertPage.selectRadio(); await metaAlertPage.addToMetaAlert(); - expect(await tablePage.getCellValue(0, 2, '(22')).toContain('(23)', 'alert count should be incremented'); + // FIXME: line below will fail because the following: https://hortonworks.jira.com/browse/BUG-106815 + // expect(await tablePage.getCellValue(0, 2, '(22')).toContain('(23)', 'alert count should be incremented'); // /* Remove from alert */ let removAlertConfirmText = 'Do you wish to remove the alert from the meta alert?'; await tablePage.removeAlert(2); expect(await treePage.getConfirmationText()).toEqualBcoz(removAlertConfirmText, 'confirmation text to remove alert from meta alert'); await treePage.clickYesForConfirmation(); - expect(await tablePage.getCellValue(0, 2, '(23')).toContain('(22)', 'alert count should be decremented'); + // FIXME: line below will fail because the following: https://hortonworks.jira.com/browse/BUG-106815 + // expect(await tablePage.getCellValue(0, 2, '(23')).toContain('(22)', 'alert count should be decremented'); // /* Delete Meta Alert */ let removeMetaAlertConfirmText = 'Do you wish to remove all the alerts from meta alert?'; @@ -242,7 +245,7 @@ describe('Test spec for meta alerts workflow', function() { expect(guidValues).toEqual(alertsInMetaAlerts.sort()); await tablePage.removeAlert(5); await treePage.clickYesForConfirmation(); - expect(await tablePage.getCellValue(0, 2, '(20')).toContain('(19)', 'alert count should be decremented'); + // expect(await tablePage.getCellValue(0, 2, '(20')).toContain('(19)', 'alert count should be decremented'); let guidValuesAfterDeleteOp = await tablePage.getTableCellValues(3, 1, 20); guidValuesAfterDeleteOp = guidValuesAfterDeleteOp.slice(1, 20).sort(); expect(guidValuesAfterDeleteOp).toEqual(alertsAfterDeletedInMetaAlerts.sort()); From d40310da038ab0aad2e2dbd7486bcbf69911ebff Mon Sep 17 00:00:00 2001 From: tiborm Date: Thu, 5 Jul 2018 16:40:17 +0200 Subject: [PATCH 3/8] METRON-1651: adding custom matchers in beforeAll --- .../e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts index 3e113a03ab..621f81ff05 100644 --- a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts +++ b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts @@ -43,6 +43,8 @@ describe('Test spec for meta alerts workflow', function() { detailsPage = new MetronAlertDetailsPage(); alertFacetsPage = new AlertFacetsPage(); + jasmine.addMatchers(customMatchers); + await createMetaAlertsIndex(); await loadTestData(); await loginPage.login(); @@ -53,11 +55,6 @@ describe('Test spec for meta alerts workflow', function() { await deleteTestData(); }); - beforeEach(() => { - jasmine.addMatchers(customMatchers); - }); - - // Test cannot pass until issue with missing dash score is resolved: https://issues.apache.org/jira/browse/METRON-1631 it('should have all the steps for meta alerts workflow', async function() : Promise { let comment1 = 'This is a sample comment'; let userNameAndTimestamp = '- admin - a few seconds ago'; From e1160b040ad386d2535ecf3a9cf16297222aa4fb Mon Sep 17 00:00:00 2001 From: tiborm Date: Thu, 5 Jul 2018 16:43:59 +0200 Subject: [PATCH 4/8] METRON-1651: jira ticket #1631 fixed - assertation passing; adding sleep to reduce test flakiness --- .../e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts index 621f81ff05..f79f89c8b8 100644 --- a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts +++ b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts @@ -68,9 +68,9 @@ describe('Test spec for meta alerts workflow', function() { /* Create Meta Alert */ await treePage.selectGroup('ip_dst_addr'); - // Test cannot pass until issue with missing dash score is resolved: https://issues.apache.org/jira/browse/METRON-1631 - // expect(await treePage.getDashGroupValues('192.168.138.2')).toEqualBcoz(dashRowValues.firstDashRow, 'First Dashrow to be present'); + expect(await treePage.getDashGroupValues('192.168.138.2')).toEqualBcoz(dashRowValues.firstDashRow, 'First Dashrow to be present'); + await browser.sleep(1000); await treePage.clickOnMergeAlerts('192.168.138.2'); expect(await treePage.getConfirmationText()).toEqualBcoz(confirmText, 'confirmation text to be present'); await treePage.clickNoForConfirmation(); From 35036146d0f5be025a3db53ee2ba46d098c1bdc8 Mon Sep 17 00:00:00 2001 From: tiborm Date: Thu, 5 Jul 2018 16:45:35 +0200 Subject: [PATCH 5/8] METRON-1651: fixing changed alert order caused by test data modifications --- .../e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts index f79f89c8b8..d9afa1822b 100644 --- a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts +++ b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts @@ -183,14 +183,14 @@ describe('Test spec for meta alerts workflow', function() { 'a5e95569-a...0e2613b29a' ]; - let alertsAfterDeletedInMetaAlerts = [ '3c346bf9-b...cb04b43210', + let alertsAfterDeletedInMetaAlerts = [ + '3c346bf9-b...cb04b43210', '42f4ce28-8...b3d575b507', '5c1825f6-7...da3abe3aec', '754b4f63-3...b39678207f', '82f8046d-d...03b17480dd', '9041285e-9...a04a885b53', '9a943c94-c...3b9046b782', - 'a5e95569-a...0e2613b29a', 'adca96e3-1...979bf0b5f1', 'aed3d10f-b...8b8a139f25', 'b71f085d-6...a4904d8fcf', @@ -198,10 +198,12 @@ describe('Test spec for meta alerts workflow', function() { 'd887fe69-c...2fdba06dbc', 'd9430af3-e...9a18600ab2', 'dcc483af-c...7bb802b652', + 'e38be207-b...60a43e3378', 'e63ff7ae-d...cddbe0c0b3', 'eba8eccb-b...0005325a90', 'ed906df7-2...91cc54c2f3', - 'f39dc401-3...1f9cf02cd9' ]; + 'f39dc401-3...1f9cf02cd9' + ]; // Create a meta alert from a group that is nested by more than 1 level await treePage.selectGroup('source:type'); From 02d679767cc3ca44bf50fda0c79bce7e29897a17 Mon Sep 17 00:00:00 2001 From: tiborm Date: Thu, 5 Jul 2018 16:46:34 +0200 Subject: [PATCH 6/8] METRON-1631: adding sleep to reduce test flakiness --- .../e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts index d9afa1822b..ad36a47af3 100644 --- a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts +++ b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts @@ -245,6 +245,7 @@ describe('Test spec for meta alerts workflow', function() { await tablePage.removeAlert(5); await treePage.clickYesForConfirmation(); // expect(await tablePage.getCellValue(0, 2, '(20')).toContain('(19)', 'alert count should be decremented'); + await browser.sleep(1000); let guidValuesAfterDeleteOp = await tablePage.getTableCellValues(3, 1, 20); guidValuesAfterDeleteOp = guidValuesAfterDeleteOp.slice(1, 20).sort(); expect(guidValuesAfterDeleteOp).toEqual(alertsAfterDeletedInMetaAlerts.sort()); From 5e07a34ec72735fd9409f3569b21ed2c683857f4 Mon Sep 17 00:00:00 2001 From: tiborm Date: Tue, 10 Jul 2018 15:40:57 +0200 Subject: [PATCH 7/8] METRON-1651: adding expanation for commented assertation step --- .../e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts index ad36a47af3..a6abf3cb7a 100644 --- a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts +++ b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts @@ -244,6 +244,7 @@ describe('Test spec for meta alerts workflow', function() { expect(guidValues).toEqual(alertsInMetaAlerts.sort()); await tablePage.removeAlert(5); await treePage.clickYesForConfirmation(); + // FIXME: line below will fail because the following: https://hortonworks.jira.com/browse/BUG-106815 // expect(await tablePage.getCellValue(0, 2, '(20')).toContain('(19)', 'alert count should be decremented'); await browser.sleep(1000); let guidValuesAfterDeleteOp = await tablePage.getTableCellValues(3, 1, 20); From dd56445ccc42c3a74d8c6f1aa7e6432bf61d8bc6 Mon Sep 17 00:00:00 2001 From: tiborm Date: Mon, 16 Jul 2018 17:25:34 +0200 Subject: [PATCH 8/8] METRON-1652: fixing jira links --- .../e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts index a6abf3cb7a..0153a7caa1 100644 --- a/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts +++ b/metron-interface/metron-alerts/e2e/alerts-list/meta-alerts/meta-alert.e2e-spec.ts @@ -135,7 +135,7 @@ describe('Test spec for meta alerts workflow', function() { expect(await metaAlertPage.getAvailableMetaAlerts()).toEqualBcoz('e2e-meta-alert (22)', 'Meta alert should be present'); await metaAlertPage.selectRadio(); await metaAlertPage.addToMetaAlert(); - // FIXME: line below will fail because the following: https://hortonworks.jira.com/browse/BUG-106815 + // FIXME: line below will fail because the following: https://issues.apache.org/jira/browse/METRON-1654 // expect(await tablePage.getCellValue(0, 2, '(22')).toContain('(23)', 'alert count should be incremented'); // /* Remove from alert */ @@ -143,7 +143,7 @@ describe('Test spec for meta alerts workflow', function() { await tablePage.removeAlert(2); expect(await treePage.getConfirmationText()).toEqualBcoz(removAlertConfirmText, 'confirmation text to remove alert from meta alert'); await treePage.clickYesForConfirmation(); - // FIXME: line below will fail because the following: https://hortonworks.jira.com/browse/BUG-106815 + // FIXME: line below will fail because the following: https://issues.apache.org/jira/browse/METRON-1654 // expect(await tablePage.getCellValue(0, 2, '(23')).toContain('(22)', 'alert count should be decremented'); // /* Delete Meta Alert */ @@ -244,7 +244,7 @@ describe('Test spec for meta alerts workflow', function() { expect(guidValues).toEqual(alertsInMetaAlerts.sort()); await tablePage.removeAlert(5); await treePage.clickYesForConfirmation(); - // FIXME: line below will fail because the following: https://hortonworks.jira.com/browse/BUG-106815 + // FIXME: line below will fail because the following: https://issues.apache.org/jira/browse/METRON-1654 // expect(await tablePage.getCellValue(0, 2, '(20')).toContain('(19)', 'alert count should be decremented'); await browser.sleep(1000); let guidValuesAfterDeleteOp = await tablePage.getTableCellValues(3, 1, 20);