Skip to content

Commit

Permalink
[EAPQE-2915][EAPQE-2914] Integrate OpenTelemetry with the MP Reactive…
Browse files Browse the repository at this point in the history
… Messaging AMQP & Kafka connector Web UI tests
  • Loading branch information
istraka committed Jan 10, 2025
1 parent 5e694bd commit f1fd865
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/manual-test-matrix-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
"jpa",
"jsf",
"mail",
"microprofile",
"metrics",
"runtime",
"security-manager",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
describe("TESTS: Configuration => Subsystem => Undertow => Global settings", () => {
let managementEndpoint: string;

const testValues = {

Check warning on line 4 in packages/testsuite/cypress/e2e/microprofile/mp-reactive-messaging-otel.cy.ts

View workflow job for this annotation

GitHub Actions / Verify codebase

'testValues' is assigned a value but never used
serverName: "default-server",
ajpListener: "test-ajp",
ajpSocketBindings: "ajp",
allowedReqAttrsPatternExpression: "${NON-EXISTING:value.*}",
allowedReqAttrsPatternResolved: "value.*",
};

// workaround for JBEAP-28819 - form id is not the base for edit btn id ad so on.
function editFormJBEAP28819(formId: String) {

Check failure on line 13 in packages/testsuite/cypress/e2e/microprofile/mp-reactive-messaging-otel.cy.ts

View workflow job for this annotation

GitHub Actions / Verify codebase

Don't use `String` as a type. Use string instead
const editButton = "#" + formId + ' a.clickable[data-operation="edit"]';

Check failure on line 14 in packages/testsuite/cypress/e2e/microprofile/mp-reactive-messaging-otel.cy.ts

View workflow job for this annotation

GitHub Actions / Verify codebase

Operands of '+' operation must either be both strings or both numbers. Consider using a template literal
const formIdWithSingleDash = formId.replace(/-+/g, "-")
cy.get(`#${formIdWithSingleDash}-editing`).should("not.be.visible");
cy.get(editButton).click();
// Workaround - JBEAP-25005,JBEAP-25046 - the form is sometimes not loaded in time and Cypress is not able to recover
// from such state and click the button. Waiting does not help, but multiple manual checks for the visibility
// of the button do. Note that the button is clicked just one time (probably) once visible.
for (let reClickTry = 0; reClickTry < 5; reClickTry++) {
cy.get(editButton).then(($button) => {
if ($button.is(":visible")) {
cy.get(editButton).click();
}
});
}
// workaround - end
cy.get(`#${formIdWithSingleDash}-editing`).should("be.visible");
}

const mpRmSrSelectors = {
otelTracing: "#model-browser-root___opentelemetry-tracing",
config: "#model-browser-root___opentelemetry-tracing___config",
}

const configForm = {
id: "model-browser-model-browser-root---opentelemetry-tracing---config-form",
idNoDash: "model-browser-model-browser-root-opentelemetry-tracing-config-form",
amqpConnector: "amqp-connector",
kafkaConnector: "kafka-connector",
};

const verifyAddress = ["subsystem", "microprofile-reactive-messaging-smallrye", "opentelemetry-tracing", "config"]

before(() => {
cy.startWildflyContainer()
.then((result) => {
managementEndpoint = result as string;
})
.then(() => {
cy.executeInWildflyContainer(
`"/extension=org.wildfly.extension.microprofile.reactive-streams-operators-smallrye:add(),
/extension=org.wildfly.extension.microprofile.reactive-messaging-smallrye:add(),
/extension=org.wildfly.extension.microprofile.telemetry:add(),
/extension=org.wildfly.extension.opentelemetry:add(),
/subsystem=microprofile-reactive-streams-operators-smallrye:add(),
/subsystem=microprofile-reactive-messaging-smallrye:add(),
/subsystem=opentelemetry:add(),
/subsystem=microprofile-telemetry:add(),
/subsystem=microprofile-reactive-messaging-smallrye/opentelemetry-tracing=config:add(),
reload"`
);
});
});

after(() => {
cy.task("stop:containers");
});

beforeEach(() => {
cy.navigateTo(managementEndpoint, "generic-subsystem;address=%255C0subsystem%255C2microprofile-reactive-messaging-smallrye");
// the form takes a brief moment to initialize
cy.wait(200);
cy.get(mpRmSrSelectors.otelTracing).dblclick();
cy.get(mpRmSrSelectors.config).click();
});

it("Set AMQP to undefined", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.amqpConnector, "");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"amqp-connector",
"NEVER"
);
});

it("Set AMQP to NEVER", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.amqpConnector, "NEVER");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"amqp-connector",
"NEVER"
);
});

it("Set AMQP to OFF", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.amqpConnector, "OFF");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"amqp-connector",
"OFF"
);
});

it("Set AMQP to ON", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.amqpConnector, "ON");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"amqp-connector",
"ON"
);
});

it("Set AMQP to ALWAYS", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.amqpConnector, "ALWAYS");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"amqp-connector",
"ALWAYS"
);
});

it("Set Kafka to undefined", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.kafkaConnector, "");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"kafka-connector",
"NEVER"
);
});

it("Set Kafka to NEVER", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.kafkaConnector, "NEVER");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"kafka-connector",
"NEVER"
);
});

it("Set Kafka to OFF", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.kafkaConnector, "OFF");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"kafka-connector",
"OFF"
);
});

it("Set Kafka to ON", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.kafkaConnector, "ON");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"kafka-connector",
"ON"
);
});

it("Set Kafka to ALWAYS", () => {
editFormJBEAP28819(configForm.id);
cy.selectInDropdownMenu(configForm.idNoDash, configForm.kafkaConnector, "ALWAYS");
cy.saveForm(configForm.idNoDash);
cy.verifyAttribute(
managementEndpoint,
verifyAddress,
"kafka-connector",
"ALWAYS"
);
});
});
6 changes: 5 additions & 1 deletion packages/testsuite/cypress/support/form-editing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ Cypress.Commands.add("selectInDropdownMenuOnPage", (elementId, value) => {
cy.get(`button[data-id="${elementId}"]`)
.parent()
.within(() => {
cy.get(`a.dropdown-item`).contains(value).click();
if (value == "") {
cy.get(`a.dropdown-item:has(span:empty)`).click();
} else {
cy.get(`a.dropdown-item`).contains(value).click();
}
});
});

Expand Down
8 changes: 5 additions & 3 deletions packages/testsuite/cypress/support/verification-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ Cypress.Commands.add("verifyUserRole", (expectedRoleName) => {
});

Cypress.Commands.add("closeAllPopUpNotifications", () => {
cy.get(".alert.alert-dismissable").each(($popupNotification) => {
$popupNotification.find(".close").trigger("click");
});
if (Cypress.$(".alert.alert-dismissable").length > 0) {
cy.get(".alert.alert-dismissable").each(($popupNotification) => {
$popupNotification.find(".close").trigger("click");
});
}
});

export {};
Expand Down

0 comments on commit f1fd865

Please sign in to comment.