Skip to content

Commit

Permalink
notif integ tests
Browse files Browse the repository at this point in the history
Signed-off-by: Riya Saxena <[email protected]>
  • Loading branch information
riysaxen-amzn committed Sep 28, 2024
1 parent 5a06cc3 commit cce3e6a
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,53 +195,56 @@ 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);

deniedIps.forEach((ip) => {
// Constructing the custom webhook URL for each IP
const webhookUrl = `https://${ip}:8888/test-path?params1=value1&params2=value2&params3=value3&params4=value4&params5=values5&params6=values6&params7=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');

Expand Down

0 comments on commit cce3e6a

Please sign in to comment.