diff --git a/cypress/e2e/scenario-2.1-basic-service.cy.js b/cypress/e2e/scenario-2.1-basic-service.cy.js index bcc3b423b..d6504be8e 100644 --- a/cypress/e2e/scenario-2.1-basic-service.cy.js +++ b/cypress/e2e/scenario-2.1-basic-service.cy.js @@ -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"); @@ -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 @@ -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); diff --git a/cypress/e2e/scenario-2.2-child-parent-service.cy.js b/cypress/e2e/scenario-2.2-child-parent-service.cy.js index 9af285628..59b0091d8 100644 --- a/cypress/e2e/scenario-2.2-child-parent-service.cy.js +++ b/cypress/e2e/scenario-2.2-child-parent-service.cy.js @@ -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. @@ -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. diff --git a/cypress/e2e/scenario-2.3-embedded-entity.cy.js b/cypress/e2e/scenario-2.3-embedded-entity.cy.js index a9851a3ab..80d37f60b 100644 --- a/cypress/e2e/scenario-2.3-embedded-entity.cy.js +++ b/cypress/e2e/scenario-2.3-embedded-entity.cy.js @@ -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"); }); diff --git a/cypress/e2e/scenario-2.4-expert-mode.cy.js b/cypress/e2e/scenario-2.4-expert-mode.cy.js index 313c1751a..fdbecc5e3 100644 --- a/cypress/e2e/scenario-2.4-expert-mode.cy.js +++ b/cypress/e2e/scenario-2.4-expert-mode.cy.js @@ -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") @@ -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}"); diff --git a/cypress/e2e/scenario-3-service-details.cy.js b/cypress/e2e/scenario-3-service-details.cy.js index e3bc1a1ce..4f82eec69 100644 --- a/cypress/e2e/scenario-3-service-details.cy.js +++ b/cypress/e2e/scenario-3-service-details.cy.js @@ -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, @@ -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") diff --git a/cypress/e2e/scenario-4-desired-state.cy.js b/cypress/e2e/scenario-4-desired-state.cy.js index 61a3987df..b50113bdc 100644 --- a/cypress/e2e/scenario-4-desired-state.cy.js +++ b/cypress/e2e/scenario-4-desired-state.cy.js @@ -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"); diff --git a/cypress/e2e/scenario-5-compile-reports.cy.js b/cypress/e2e/scenario-5-compile-reports.cy.js index 81b045875..c43300f04 100644 --- a/cypress/e2e/scenario-5-compile-reports.cy.js +++ b/cypress/e2e/scenario-5-compile-reports.cy.js @@ -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") @@ -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"]'); diff --git a/cypress/e2e/scenario-6-resources.cy.js b/cypress/e2e/scenario-6-resources.cy.js index ce2f2ca6a..76ec149ee 100644 --- a/cypress/e2e/scenario-6-resources.cy.js +++ b/cypress/e2e/scenario-6-resources.cy.js @@ -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") @@ -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") @@ -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( diff --git a/cypress/e2e/scenario-8-instance-composer.cy.js b/cypress/e2e/scenario-8-instance-composer.cy.js index 0c5fbcb0f..6fc9f3cdd 100644 --- a/cypress/e2e/scenario-8-instance-composer.cy.js +++ b/cypress/e2e/scenario-8-instance-composer.cy.js @@ -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(); @@ -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 @@ -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 }) @@ -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") @@ -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); @@ -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 @@ -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( @@ -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", @@ -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 }); @@ -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 }); diff --git a/src/UI/Components/Diagram/components/ComposerActions.test.tsx b/src/UI/Components/Diagram/components/ComposerActions.test.tsx index 161b44760..5e96ba836 100644 --- a/src/UI/Components/Diagram/components/ComposerActions.test.tsx +++ b/src/UI/Components/Diagram/components/ComposerActions.test.tsx @@ -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" } }); }), ); @@ -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", + ), ); });