From 5279ec5aa0ec25d13b9bc020143d57a6fe7a9f86 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Thu, 26 Sep 2024 19:48:43 -0700 Subject: [PATCH 1/6] notification dashboards integ tests fix Signed-off-by: Riya Saxena --- .../1_email_senders_and_groups.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress/integration/plugins/notifications-dashboards/1_email_senders_and_groups.spec.js b/cypress/integration/plugins/notifications-dashboards/1_email_senders_and_groups.spec.js index 530a3c0c4..799236639 100644 --- a/cypress/integration/plugins/notifications-dashboards/1_email_senders_and_groups.spec.js +++ b/cypress/integration/plugins/notifications-dashboards/1_email_senders_and_groups.spec.js @@ -128,8 +128,9 @@ describe('Test edit senders', () => { }); it('edits ses sender region', () => { - cy.get('.euiCheckbox__input[aria-label="Select this row"]').last().click(); // ses sender + cy.get('.euiCheckbox__input[aria-label="Select this row"]').eq(2).click(); // ses sender cy.get('[data-test-subj="ses-senders-table-edit-button"]').click(); + cy.wait(NOTIFICATIONS_DELAY); cy.get('[data-test-subj="create-ses-sender-form-aws-region-input"]').type( '{selectall}{backspace}us-west-2' ); From bf7f7afb39804f7f69534eff9826ce7f4b7b4c00 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Fri, 27 Sep 2024 17:02:20 -0700 Subject: [PATCH 2/6] notif integ tests Signed-off-by: Riya Saxena --- .../2_channels.spec.js | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js index be783bec4..bfc2da632 100644 --- a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js +++ b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js @@ -171,6 +171,71 @@ describe('Test create channels', () => { cy.contains('successfully created.').should('exist'); }); + const updateLocalClusterSettings = (denyList) => { + cy.request({ + method: 'PUT', + url: 'http://localhost:9200/_cluster/settings', + body: { + persistent: { + opensearch: { + notifications: { + core: { + http: { + host_deny_list: denyList, + }, + }, + }, + }, + }, + }, + }).then((response) => { + expect(response.status).to.eq(200); + expect(response.body).to.have.property('acknowledged', true); + }); + }; + + it('sends a test message for denied IPs', () => { + const deniedIps = [ + '127.0.0.1', + '169.254.0.1', + '10.0.0.1', + '255.255.255.255' + ]; + + updateLocalClusterSettings(deniedIps); + + cy.get('[placeholder="Enter channel name"]').type('Test denied webhook channels'); + + cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true }); + cy.wait(delay); + // Optionally, add a check to ensure the dropdown options are visible/loaded + cy.get('.euiContextMenuItem__text').should('be.visible'); + cy.get('.euiContextMenuItem__text') + .contains('Custom webhook') + .click({ force: true }); + cy.wait(delay); + + deniedIps.forEach(ip => { + // Constructing the custom webhook URL for each IP + const webhookUrl = `https://${ip}:8888/test-path?params1=value1¶ms2=value2¶ms3=value3¶ms4=value4¶ms5=values5¶ms6=values6¶ms7=values7`; + + cy.get('[data-test-subj="custom-webhook-url-input"]').clear().type(webhookUrl); + + // Send the test message + cy.get('[data-test-subj="create-channel-send-test-message-button"]').click({ + force: true, + }); + cy.wait(delay); + + // Check for the expected error message indicating the host is denied + cy.contains('Failed to send the test message').should('exist'); + cy.get('.euiButton__text').should('be.visible'); + cy.get('.euiButton__text').contains('See the full error').click({ force: true }); + cy.contains('Host of url is denied').should('exist'); + cy.get('.euiButton__text').contains('Close').click({ force: true }); + }); + }); + it('creates an sns channel', () => { cy.get('[placeholder="Enter channel name"]').type('test-sns-channel'); From 4d87aa32a2cb7f5b11b72ff9266d07a2a75fe94a Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Fri, 27 Sep 2024 17:14:46 -0700 Subject: [PATCH 3/6] notif integ tests Signed-off-by: Riya Saxena --- .../2_channels.spec.js | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js index bfc2da632..a140e117a 100644 --- a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js +++ b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js @@ -154,7 +154,9 @@ describe('Test create channels', () => { }); it('creates a webhook channel', () => { - cy.get('[placeholder="Enter channel name"]').type('Test webhook channel'); + cy.get('[placeholder="Enter channel name"]').type( + 'Test webhook channel' + ); cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true }); cy.wait(NOTIFICATIONS_DELAY); @@ -168,7 +170,8 @@ describe('Test create channels', () => { ); cy.get('[data-test-subj="create-channel-create-button"]').click(); - cy.contains('successfully created.').should('exist'); + cy.contains('successfully created.') + .should('exist'); }); const updateLocalClusterSettings = (denyList) => { @@ -204,35 +207,43 @@ describe('Test create channels', () => { updateLocalClusterSettings(deniedIps); - cy.get('[placeholder="Enter channel name"]').type('Test denied webhook channels'); + cy.get('[placeholder="Enter channel name"]').type( + 'Test denied webhook channels' + ); - cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true }); - cy.wait(delay); + cy.get('.euiSuperSelectControl').contains('Slack') + .click({ force: true }); + cy.wait(NOTIFICATIONS_DELAY); // Optionally, add a check to ensure the dropdown options are visible/loaded cy.get('.euiContextMenuItem__text').should('be.visible'); cy.get('.euiContextMenuItem__text') .contains('Custom webhook') .click({ force: true }); - cy.wait(delay); + cy.wait(NOTIFICATIONS_DELAY); - deniedIps.forEach(ip => { + deniedIps.forEach((ip) => { // Constructing the custom webhook URL for each IP const webhookUrl = `https://${ip}:8888/test-path?params1=value1¶ms2=value2¶ms3=value3¶ms4=value4¶ms5=values5¶ms6=values6¶ms7=values7`; - cy.get('[data-test-subj="custom-webhook-url-input"]').clear().type(webhookUrl); + cy.get('[data-test-subj="custom-webhook-url-input"]') + .clear() + .type(webhookUrl); // Send the test message cy.get('[data-test-subj="create-channel-send-test-message-button"]').click({ force: true, }); - cy.wait(delay); + cy.wait(NOTIFICATIONS_DELAY); // Check for the expected error message indicating the host is denied cy.contains('Failed to send the test message').should('exist'); cy.get('.euiButton__text').should('be.visible'); - cy.get('.euiButton__text').contains('See the full error').click({ force: true }); + cy.get('.euiButton__text').contains('See the full error') + .click({ force: true }); cy.contains('Host of url is denied').should('exist'); - cy.get('.euiButton__text').contains('Close').click({ force: true }); + cy.get('.euiButton__text') + .contains('Close') + .click({ force: true }); }); }); From 5a06cc3911aa23557060efb917239c6b827c1ec7 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Fri, 27 Sep 2024 17:25:23 -0700 Subject: [PATCH 4/6] notif integ tests Signed-off-by: Riya Saxena --- .../notifications-dashboards/2_channels.spec.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js index a140e117a..0d8281281 100644 --- a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js +++ b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js @@ -154,9 +154,7 @@ describe('Test create channels', () => { }); it('creates a webhook channel', () => { - cy.get('[placeholder="Enter channel name"]').type( - 'Test webhook channel' - ); + cy.get('[placeholder="Enter channel name"]').type('Test webhook channel'); cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true }); cy.wait(NOTIFICATIONS_DELAY); @@ -207,9 +205,8 @@ describe('Test create channels', () => { updateLocalClusterSettings(deniedIps); - cy.get('[placeholder="Enter channel name"]').type( - 'Test denied webhook channels' - ); + cy.get('[placeholder="Enter channel name"]') + .type('Test denied webhook channels'); cy.get('.euiSuperSelectControl').contains('Slack') .click({ force: true }); @@ -230,9 +227,8 @@ describe('Test create channels', () => { .type(webhookUrl); // Send the test message - cy.get('[data-test-subj="create-channel-send-test-message-button"]').click({ - force: true, - }); + cy.get('[data-test-subj="create-channel-send-test-message-button"]') + .click({ force: true }); cy.wait(NOTIFICATIONS_DELAY); // Check for the expected error message indicating the host is denied @@ -241,8 +237,7 @@ describe('Test create channels', () => { cy.get('.euiButton__text').contains('See the full error') .click({ force: true }); cy.contains('Host of url is denied').should('exist'); - cy.get('.euiButton__text') - .contains('Close') + cy.get('.euiButton__text').contains('Close') .click({ force: true }); }); }); From cce3e6a033ed12e1d75ae838e7ff1d4111a1b1f4 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Fri, 27 Sep 2024 17:42:49 -0700 Subject: [PATCH 5/6] notif integ tests Signed-off-by: Riya Saxena --- .../2_channels.spec.js | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js index 0d8281281..630cbf456 100644 --- a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js +++ b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js @@ -195,26 +195,27 @@ describe('Test create channels', () => { }); }; - it('sends a test message for denied IPs', () => { + it("sends a test message for denied IPs", () => { const deniedIps = [ - '127.0.0.1', - '169.254.0.1', - '10.0.0.1', - '255.255.255.255' + "127.0.0.1", + "169.254.0.1", + "10.0.0.1", + "255.255.255.255" ]; updateLocalClusterSettings(deniedIps); - cy.get('[placeholder="Enter channel name"]') - .type('Test denied webhook channels'); + cy.get("[placeholder=\"Enter channel name\"]").type( + "Test denied webhook channels" + ); - cy.get('.euiSuperSelectControl').contains('Slack') + cy.get(".euiSuperSelectControl").contains("Slack") .click({ force: true }); cy.wait(NOTIFICATIONS_DELAY); // Optionally, add a check to ensure the dropdown options are visible/loaded - cy.get('.euiContextMenuItem__text').should('be.visible'); - cy.get('.euiContextMenuItem__text') - .contains('Custom webhook') + cy.get(".euiContextMenuItem__text").should("be.visible"); + cy.get(".euiContextMenuItem__text") + .contains("Custom webhook") .click({ force: true }); cy.wait(NOTIFICATIONS_DELAY); @@ -222,26 +223,28 @@ describe('Test create channels', () => { // Constructing the custom webhook URL for each IP const webhookUrl = `https://${ip}:8888/test-path?params1=value1¶ms2=value2¶ms3=value3¶ms4=value4¶ms5=values5¶ms6=values6¶ms7=values7`; - cy.get('[data-test-subj="custom-webhook-url-input"]') + cy.get("[data-test-subj=\"custom-webhook-url-input\"]") .clear() .type(webhookUrl); // Send the test message - cy.get('[data-test-subj="create-channel-send-test-message-button"]') - .click({ force: true }); + cy.get("[data-test-subj=\"create-channel-send-test-message-button\"]").click({ + force: true, + }); cy.wait(NOTIFICATIONS_DELAY); // Check for the expected error message indicating the host is denied - cy.contains('Failed to send the test message').should('exist'); - cy.get('.euiButton__text').should('be.visible'); - cy.get('.euiButton__text').contains('See the full error') + cy.contains("Failed to send the test message").should("exist"); + cy.get(".euiButton__text").should("be.visible"); + cy.get(".euiButton__text").contains("See the full error") .click({ force: true }); - cy.contains('Host of url is denied').should('exist'); - cy.get('.euiButton__text').contains('Close') + cy.contains("Host of url is denied").should("exist"); + cy.get(".euiButton__text").contains("Close") .click({ force: true }); }); }); + it('creates an sns channel', () => { cy.get('[placeholder="Enter channel name"]').type('test-sns-channel'); From 1c57caa94c54a31d88f878587ced9b743ed9378d Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Mon, 30 Sep 2024 14:43:08 -0700 Subject: [PATCH 6/6] integ tests fixes Signed-off-by: Riya Saxena --- .../2_channels.spec.js | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js index 630cbf456..934e6e0fb 100644 --- a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js +++ b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js @@ -168,8 +168,7 @@ describe('Test create channels', () => { ); cy.get('[data-test-subj="create-channel-create-button"]').click(); - cy.contains('successfully created.') - .should('exist'); + cy.contains('successfully created.').should('exist'); }); const updateLocalClusterSettings = (denyList) => { @@ -195,27 +194,26 @@ describe('Test create channels', () => { }); }; - it("sends a test message for denied IPs", () => { + it('sends a test message for denied IPs', () => { const deniedIps = [ - "127.0.0.1", - "169.254.0.1", - "10.0.0.1", - "255.255.255.255" + '127.0.0.1', + '169.254.0.1', + '10.0.0.1', + '255.255.255.255', ]; updateLocalClusterSettings(deniedIps); - cy.get("[placeholder=\"Enter channel name\"]").type( - "Test denied webhook channels" + cy.get('[placeholder="Enter channel name"]').type( + 'Test denied webhook channels' ); - cy.get(".euiSuperSelectControl").contains("Slack") - .click({ force: true }); + cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true }); cy.wait(NOTIFICATIONS_DELAY); // Optionally, add a check to ensure the dropdown options are visible/loaded - cy.get(".euiContextMenuItem__text").should("be.visible"); - cy.get(".euiContextMenuItem__text") - .contains("Custom webhook") + cy.get('.euiContextMenuItem__text').should('be.visible'); + cy.get('.euiContextMenuItem__text') + .contains('Custom webhook') .click({ force: true }); cy.wait(NOTIFICATIONS_DELAY); @@ -223,28 +221,29 @@ describe('Test create channels', () => { // Constructing the custom webhook URL for each IP const webhookUrl = `https://${ip}:8888/test-path?params1=value1¶ms2=value2¶ms3=value3¶ms4=value4¶ms5=values5¶ms6=values6¶ms7=values7`; - cy.get("[data-test-subj=\"custom-webhook-url-input\"]") + cy.get('[data-test-subj="custom-webhook-url-input"]') .clear() .type(webhookUrl); // Send the test message - cy.get("[data-test-subj=\"create-channel-send-test-message-button\"]").click({ + cy.get( + '[data-test-subj="create-channel-send-test-message-button"]' + ).click({ force: true, }); cy.wait(NOTIFICATIONS_DELAY); // Check for the expected error message indicating the host is denied - cy.contains("Failed to send the test message").should("exist"); - cy.get(".euiButton__text").should("be.visible"); - cy.get(".euiButton__text").contains("See the full error") - .click({ force: true }); - cy.contains("Host of url is denied").should("exist"); - cy.get(".euiButton__text").contains("Close") + cy.contains('Failed to send the test message').should('exist'); + cy.get('.euiButton__text').should('be.visible'); + cy.get('.euiButton__text') + .contains('See the full error') .click({ force: true }); + cy.contains('Host of url is denied').should('exist'); + cy.get('.euiButton__text').contains('Close').click({ force: true }); }); }); - it('creates an sns channel', () => { cy.get('[placeholder="Enter channel name"]').type('test-sns-channel');