Skip to content

Commit

Permalink
repair test
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasStordeur committed Jan 28, 2025
1 parent 64a9305 commit a7cd222
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 28 deletions.
13 changes: 9 additions & 4 deletions cypress/e2e/scenario-2.1-basic-service.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ if (Cypress.env("edition") === "iso") {
cy.get("#ip_r2").clear().type("1.2.2.1");
cy.get("button").contains("Confirm").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#basic-service").contains("Show inventory").click();

// Should show the chart
cy.get(".pf-v5-c-chart").should("be.visible");

Expand Down Expand Up @@ -247,9 +252,6 @@ if (Cypress.env("edition") === "iso") {
cy.get("button").contains("Confirm").click();

// check attributes on instance details page
cy.get('[aria-label="instance-details-link"]', { timeout: 20000 })
.first()
.click();
cy.get(".pf-v6-c-tabs__list").contains("Attributes").click();

// Expect to find new value as candidate and old value in active
Expand Down Expand Up @@ -333,7 +335,10 @@ if (Cypress.env("edition") === "iso") {
cy.get("button").contains("Confirm").click();

// expect to land on Service Inventory page
cy.get('[aria-label="ServiceInventory-Success"]').should("to.be.visible");
cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#basic-service").contains("Show inventory").click();

// expect two rows in inventory now
cy.get('[aria-label="InstanceRow-Intro"]').should("have.length", 2);
Expand Down
12 changes: 11 additions & 1 deletion cypress/e2e/scenario-2.2-child-parent-service.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ if (Cypress.env("edition") === "iso") {
cy.get("#name").type("parent");
cy.get("button").contains("Confirm").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#parent-service").contains("Show inventory").click();

// Should show the ServiceInventory-Success Component.
cy.get('[aria-label="ServiceInventory-Success"]').should("to.be.visible");
// Check if only one row has been added to the table.
Expand All @@ -102,7 +107,12 @@ if (Cypress.env("edition") === "iso") {
cy.get('[aria-label="parent_entity-select-toggleFilterInput"]').click();
cy.get('[role="option"]').first().click();
cy.get("button").contains("Confirm").click();
// Expect to be redirected to service inventory

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#child-service").contains("Show inventory").click();

cy.get('[aria-label="ServiceInventory-Success"]').should("to.be.visible");

// Check if only one row has been added to the table.
Expand Down
7 changes: 6 additions & 1 deletion cypress/e2e/scenario-2.3-embedded-entity.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ if (Cypress.env("edition") === "iso") {
cy.get("#address").type("1.2.3.7/32");
cy.get("#vlan_id").type("3");
cy.get("button").contains("Confirm").click();
// check if the view is still empty, also means we have been redirected as expected.

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#embedded-entity-service").contains("Show inventory").click();

cy.get('[aria-label="ServiceInventory-Success"]').should("to.be.visible");
});

Expand Down
5 changes: 2 additions & 3 deletions cypress/e2e/scenario-2.4-expert-mode.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ if (Cypress.env("edition") === "iso") {
// Make sure the call to get inventory has been executed
cy.wait("@GetServiceInventory");

// Check if the view is still empty, also means we have been redirected as expected.
cy.get('[aria-label="ServiceInventory-Success"]').should("to.be.visible");

// Go to the settings, then to the configuration tab
cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Settings")
Expand Down Expand Up @@ -188,6 +185,8 @@ if (Cypress.env("edition") === "iso") {
cy.get('[aria-label="attributes-content"]').click();
cy.get("#JSON").click();

cy.get(".monaco-editor", { timeout: 15000 }).should("be.visible"); // assure the editor is loaded before further assertions.

// edit the first line to make editor invalid (Delete the first character of the name property)
cy.get(".mtk20").contains("name").type("{home}{rightArrow}{del}");

Expand Down
10 changes: 10 additions & 0 deletions cypress/e2e/scenario-3-service-details.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ if (Cypress.env("edition") === "iso") {
cy.get("#name").type("basic-service");
cy.get("button").contains("Confirm").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#basic-service").contains("Show inventory").click();

// expect newly created instance to be visible in table
cy.get('[aria-label="ServiceInventory-Success"]', {
timeout: 20000,
Expand Down Expand Up @@ -263,6 +268,11 @@ if (Cypress.env("edition") === "iso") {
cy.get(".pf-v6-c-switch").first().click();
cy.get("button").contains("Confirm").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#basic-service").contains("Show inventory").click();

// Expect the number in the chart to be 2
cy.get(".pf-v5-c-chart").within(() => {
cy.get("svg")
Expand Down
5 changes: 5 additions & 0 deletions cypress/e2e/scenario-4-desired-state.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ describe("Scenario 4 Desired State", () => {
cy.get("#name").type("basic-service");
cy.get("button").contains("Confirm").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#basic-service").contains("Show inventory").click();

// Should show the chart
cy.get(".pf-v5-c-chart").should("be.visible");

Expand Down
7 changes: 5 additions & 2 deletions cypress/e2e/scenario-5-compile-reports.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ describe("5 Compile reports", () => {
cy.get("#name").type("basic-service");
cy.get("button").contains("Confirm").click();

cy.get(".pf-v5-c-chart").should("be.visible");

// Go to compiled Reports page
cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Compile Reports")
Expand Down Expand Up @@ -258,6 +256,11 @@ describe("5 Compile reports", () => {
cy.get("#name").type("2");
cy.get("button").contains("Confirm").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#basic-service").contains("Show inventory").click();

// Expect to see a rejected service instance in the table
cy.get("tbody", { timeout: 30000 }).should(($tableBody) => {
const $rows = $tableBody.find('tr[aria-label="InstanceRow-Intro"]');
Expand Down
9 changes: 5 additions & 4 deletions cypress/e2e/scenario-6-resources.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ describe("Scenario 6 : Resources", () => {
cy.get("#name").type("basic-service");
cy.get("button").contains("Confirm").click();

cy.get(".pf-v5-c-chart").should("be.visible");

// Go back to Resources page
cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Resources")
Expand Down Expand Up @@ -337,8 +335,6 @@ describe("Scenario 6 : Resources", () => {

cy.get("button").contains("Confirm").click();

cy.get(".pf-v5-c-chart").should("be.visible");

// Go to Resource page
cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Resources")
Expand Down Expand Up @@ -575,6 +571,11 @@ describe("Scenario 6 : Resources", () => {

cy.get("button").contains("Confirm").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();
cy.get("#waiting_entity").contains("Show inventory").click();

// Expect the number in the chart to the success label to be 8
cy.get(".pf-v5-c-chart").within(() => {
cy.get("#legend-ChartLabel-2", { timeout: 90000 }).should(
Expand Down
76 changes: 74 additions & 2 deletions cypress/e2e/scenario-8-instance-composer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if (Cypress.env("edition") === "iso") {
cy.get("#inventory-stencil").should("not.be.visible");
});

it("8.2 composer create view can perform it's required functions and deploy created instance", () => {
it("8.2 composer create view can perform its required functions and deploy created instance", () => {
// Select 'test' environment
cy.visit("/console/");
cy.get(`[aria-label="Select-environment-test"]`).click();
Expand Down Expand Up @@ -221,6 +221,15 @@ if (Cypress.env("edition") === "iso") {

cy.get("button").contains("Deploy").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of parent service
cy.get("#parent-service", { timeout: 60000 })
.contains("Show inventory")
.click();

cy.get('[aria-label="InstanceRow-Intro"]').should("have.length", 1);

//add another parent instance
Expand All @@ -236,6 +245,15 @@ if (Cypress.env("edition") === "iso") {

cy.get("button").contains("Deploy").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of parent service
cy.get("#parent-service", { timeout: 60000 })
.contains("Show inventory")
.click();

cy.get('[aria-label="InstanceRow-Intro"]').should("have.length", 2);
// await until two parent_service are deployed and up
cy.get('[data-label="State"]', { timeout: 90000 })
Expand All @@ -245,10 +263,10 @@ if (Cypress.env("edition") === "iso") {
.eq(0, { timeout: 90000 })
.should("have.text", "up", { timeout: 90000 });

//Add child_service instance
cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of many-defaults service, expect no instances
cy.get("#many-defaults", { timeout: 60000 })
.contains("Show inventory")
Expand Down Expand Up @@ -545,6 +563,15 @@ if (Cypress.env("edition") === "iso") {

cy.get("button").contains("Deploy").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of parent service
cy.get("#many-defaults", { timeout: 60000 })
.contains("Show inventory")
.click();

//assert that many-defaults is deployed and up

cy.get('[aria-label="InstanceRow-Intro"]').should("have.length", 1);
Expand Down Expand Up @@ -676,6 +703,15 @@ if (Cypress.env("edition") === "iso") {

cy.get("button").contains("Deploy").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of parent service
cy.get("#many-defaults", { timeout: 60000 })
.contains("Show inventory")
.click();

//assert that many-defaults is deployed and up
cy.get('[aria-label="InstanceRow-Intro"]').should("have.length", 1);
// await until parent_service is deployed and up
Expand Down Expand Up @@ -799,6 +835,15 @@ if (Cypress.env("edition") === "iso") {
cy.get('[data-type="Link"]').should("have.length", 1);

cy.get("button").contains("Deploy").click();
cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of parent service
cy.get("#child-service", { timeout: 60000 })
.contains("Show inventory")
.click();

cy.get('[aria-label="InstanceRow-Intro"]').should("have.length", 1);
// await until parent_service is deployed and up
cy.get('[data-label="State"]', { timeout: 90000 }).should(
Expand Down Expand Up @@ -866,6 +911,15 @@ if (Cypress.env("edition") === "iso") {

cy.get("button").contains("Deploy").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of parent service
cy.get("#child-service", { timeout: 60000 })
.contains("Show inventory")
.click();

// await until parent_service is deployed and up
cy.get('[data-label="State"]', { timeout: 90000 }).should(
"have.text",
Expand Down Expand Up @@ -990,6 +1044,15 @@ if (Cypress.env("edition") === "iso") {

cy.get("button").contains("Deploy").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of parent service
cy.get("#child-with-many-parents-service", { timeout: 60000 })
.contains("Show inventory")
.click();

cy.get('[data-label="State"]', { timeout: 90000 })
.eq(0, { timeout: 90000 })
.should("have.text", "up", { timeout: 90000 });
Expand All @@ -1005,6 +1068,15 @@ if (Cypress.env("edition") === "iso") {
cy.get("button").contains("Remove").click();
cy.get("button").contains("Deploy").click();

cy.get('[aria-label="Sidebar-Navigation-Item"]')
.contains("Service Catalog")
.click();

// click on Show Inventory of parent service
cy.get("#child-with-many-parents-service", { timeout: 60000 })
.contains("Show inventory")
.click();

cy.get('[data-label="State"]', { timeout: 90000 })
.eq(0, { timeout: 90000 })
.should("have.text", "up", { timeout: 90000 });
Expand Down
16 changes: 5 additions & 11 deletions src/UI/Components/Diagram/components/ComposerActions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe("ComposerActions.", () => {
it("shows success message and redirects when deploy button is clicked", async () => {
server.use(
http.post("/lsm/v2/order", async () => {
return HttpResponse.json();
return HttpResponse.json({ data: { id: "test" } });
}),
);

Expand All @@ -204,16 +204,10 @@ describe("ComposerActions.", () => {

await userEvent.click(screen.getByRole("button", { name: "Deploy" }));

expect(
await screen.findByText("The request got sent successfully"),
).toBeVisible();

await waitFor(
() =>
expect(mockedNavigate).toHaveBeenCalledWith(
"/lsm/catalog/child-service/inventory?env=aaa",
),
{ timeout: 1500 },
await waitFor(() =>
expect(mockedNavigate).toHaveBeenCalledWith(
"/order-details/test?env=aaa",
),
);
});

Expand Down

0 comments on commit a7cd222

Please sign in to comment.