From 18a0a85b6d2b3fbe4a659445629acc9549898e4d Mon Sep 17 00:00:00 2001 From: teknaS47 Date: Fri, 13 Dec 2024 23:29:10 +0530 Subject: [PATCH 1/6] [Test automation] Verify Topology is a supported plugin and E2E scenario follow-up --- .../topology_test/topology-test.yaml | 88 +++++++++++++++++++ .ibm/pipelines/utils.sh | 3 + .../e2e/plugins/topology/topology.spec.ts | 41 ++++++--- e2e-tests/playwright/utils/ui-helper.ts | 36 ++++++-- 4 files changed, 153 insertions(+), 15 deletions(-) create mode 100644 .ibm/pipelines/resources/topology_test/topology-test.yaml diff --git a/.ibm/pipelines/resources/topology_test/topology-test.yaml b/.ibm/pipelines/resources/topology_test/topology-test.yaml new file mode 100644 index 0000000000..cab688c2ac --- /dev/null +++ b/.ibm/pipelines/resources/topology_test/topology-test.yaml @@ -0,0 +1,88 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: topology-test + namespace: rhdh + labels: + app.kubernetes.io/instance: topology-test + app.kubernetes.io/name: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + tasks: + - name: deploy + taskRef: + kind: ClusterTask + name: openshift-client +--- +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + name: topology-test-run + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + pipelineRef: + name: topology-test +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: topology-test + namespace: rhdh + labels: + app.kubernetes.io/instance: topology-test + app.kubernetes.io/name: topology-test + backstage.io/kubernetes-id: developer-hub + annotations: + app.openshift.io/vcs-uri: "https://github.com/janus-idp/backstage-showcase" +spec: + replicas: 1 + selector: + matchLabels: + app: topology-test + template: + metadata: + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub + spec: + containers: + - name: topology + image: nginxinc/nginx-unprivileged:stable-alpine + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: topology-test-service + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + selector: + app: topology-test + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: topology-test-route + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + to: + kind: Service + name: topology-test-service + port: + targetPort: 8080 + wildcardPolicy: None \ No newline at end of file diff --git a/.ibm/pipelines/utils.sh b/.ibm/pipelines/utils.sh index cae0016cc9..7fc47c8fdd 100755 --- a/.ibm/pipelines/utils.sh +++ b/.ibm/pipelines/utils.sh @@ -449,6 +449,9 @@ apply_yaml_files() { oc apply -f "$dir/resources/pipeline-run/hello-world-pipeline.yaml" oc apply -f "$dir/resources/pipeline-run/hello-world-pipeline-run.yaml" + # Create Deployment and Pipeline for Topology test. + oc apply -f "$dir/resources/topology_test/topology-test.yaml" + } deploy_test_backstage_provider() { diff --git a/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts b/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts index b29ffd22ff..57b301a7b0 100644 --- a/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts +++ b/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts @@ -3,8 +3,7 @@ import { Common } from "../../../utils/common"; import { UIhelper } from "../../../utils/ui-helper"; import { Catalog } from "../../../support/pages/catalog"; -// Test disabled due to comments in JIRA ticket RHIDP-3437 -test.describe.skip("Test Topology Plugin", () => { +test.describe("Test Topology Plugin", () => { let common: Common; let uiHelper: UIhelper; let catalog: Catalog; @@ -17,18 +16,17 @@ test.describe.skip("Test Topology Plugin", () => { }); test("Verify pods visibility in the Topology tab", async ({ page }) => { - test.setTimeout(40000); await catalog.goToBackstageJanusProject(); await uiHelper.clickTab("Topology"); await uiHelper.verifyText("backstage-janus"); await page.getByRole("button", { name: "Fit to Screen" }).click(); await uiHelper.verifyText("rhdh"); await uiHelper.verifyText("rhdh-rbac"); - await uiHelper.verifyButtonURL( - "Open URL", - "https://rhdh-backstage-showcase", - ); - await page.locator("image").first().click(); + await uiHelper.verifyText("topology-test"); + await uiHelper.verifyButtonURL("Open URL", "topology-test-route", { + locator: `[data-test-id="topology-test"]`, + }); + await page.locator("[data-test-id=topology-test] image").first().click(); await page.getByLabel("Pod").click(); await page.getByLabel("Pod").getByText("1", { exact: true }).click(); await uiHelper.clickTab("Details"); @@ -39,7 +37,7 @@ test.describe.skip("Test Topology Plugin", () => { await uiHelper.verifyHeading("Services"); await uiHelper.verifyHeading("Routes"); await expect( - page.getByRole("link", { name: "https://rhdh-backstage-" }), + page.getByRole("link", { name: "topology-test-route" }), ).toBeVisible(); await expect(page.getByTitle("Deployment")).toBeVisible(); await uiHelper.verifyText("S"); @@ -51,6 +49,29 @@ test.describe.skip("Test Topology Plugin", () => { await page.getByLabel("Pod count").click(); await uiHelper.verifyText("1"); await uiHelper.verifyText("Pod"); - await page.getByLabel("Pod count").click(); + await uiHelper.hoverOnPodStatusIndicator(); + await uiHelper.verifyTextInTooltip("Running"); + await uiHelper.verifyText("1Running"); + await uiHelper.verifyButtonURL( + "Edit source code", + "https://github.com/janus-idp/backstage-showcase", + ); + await uiHelper.clickTab("Resources"); + await uiHelper.verifyText("P"); + expect(await page.getByTestId("icon-with-title-Running")).toBeVisible(); + expect( + await page.getByTestId("icon-with-title-Running").locator("svg"), + ).toBeVisible(); + expect( + await page + .getByTestId("icon-with-title-Running") + .getByTestId("status-text"), + ).toHaveText("Running"); + await uiHelper.verifyHeading("PipelineRuns"); + await uiHelper.verifyText("PL"); + await uiHelper.verifyText("PLR"); + await page.getByTestId("icon-only-Succeeded").hover(); + await uiHelper.verifyDivHasText("Pipeline SucceededTask"); + await uiHelper.verifyText("1 Succeeded"); }); }); diff --git a/e2e-tests/playwright/utils/ui-helper.ts b/e2e-tests/playwright/utils/ui-helper.ts index 9d2f5167f2..958f8779a4 100644 --- a/e2e-tests/playwright/utils/ui-helper.ts +++ b/e2e-tests/playwright/utils/ui-helper.ts @@ -298,13 +298,27 @@ export class UIhelper { }); } - async verifyButtonURL(label: string | RegExp, url: string | RegExp) { - const buttonUrl = await this.page - .getByRole("button", { name: label }) - .first() - .getAttribute("href"); + async verifyButtonURL( + label: string | RegExp, + url: string | RegExp, + options: { locator?: string } = { + locator: "", + }, + ) { + const buttonUrl = + options.locator == "" + ? await this.page + .getByRole("button", { name: label }) + .first() + .getAttribute("href") + : await this.page + .locator(options.locator) + .getByRole("button", { name: label }) + .first() + .getAttribute("href"); expect(buttonUrl).toContain(url); } + // locator('[data-test-id="topology-test"]').getByRole('button', { name: 'Open URL' }) /** * Verifies that a table row, identified by unique text, contains specific cell texts. @@ -539,4 +553,16 @@ export class UIhelper { await expect(enabledColumn).toHaveText(expectedEnabled); await expect(preinstalledColumn).toHaveText(expectedPreinstalled); } + + async hoverOnPodStatusIndicator() { + await this.page + .locator('[data-test-id="topology-test"]') + .getByText("Pod") + .hover({}); + } + + async verifyTextInTooltip(text: string | RegExp) { + const tooltip = await this.page.getByRole("tooltip").getByText(text); + expect(tooltip).toBeVisible(); + } } From a759ab890412bdbeb77d39c3d1f964ae2cd28ac4 Mon Sep 17 00:00:00 2001 From: teknaS47 Date: Sun, 15 Dec 2024 18:48:25 +0530 Subject: [PATCH 2/6] Namespace removed --- .ibm/pipelines/resources/topology_test/topology-test.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.ibm/pipelines/resources/topology_test/topology-test.yaml b/.ibm/pipelines/resources/topology_test/topology-test.yaml index cab688c2ac..d30e9b9f24 100644 --- a/.ibm/pipelines/resources/topology_test/topology-test.yaml +++ b/.ibm/pipelines/resources/topology_test/topology-test.yaml @@ -3,7 +3,6 @@ apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: topology-test - namespace: rhdh labels: app.kubernetes.io/instance: topology-test app.kubernetes.io/name: topology-test @@ -19,7 +18,6 @@ apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: topology-test-run - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub @@ -31,7 +29,6 @@ apiVersion: apps/v1 kind: Deployment metadata: name: topology-test - namespace: rhdh labels: app.kubernetes.io/instance: topology-test app.kubernetes.io/name: topology-test @@ -59,7 +56,6 @@ apiVersion: v1 kind: Service metadata: name: topology-test-service - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub @@ -75,7 +71,6 @@ apiVersion: route.openshift.io/v1 kind: Route metadata: name: topology-test-route - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub From d8411a2519985e3c00558915b4eb3ee591b01614 Mon Sep 17 00:00:00 2001 From: teknaS47 Date: Fri, 13 Dec 2024 23:29:10 +0530 Subject: [PATCH 3/6] [Test automation] Verify Topology is a supported plugin and E2E scenario follow-up --- .../topology_test/topology-test.yaml | 88 +++++++++++++++++++ .ibm/pipelines/utils.sh | 3 + .../e2e/plugins/topology/topology.spec.ts | 41 ++++++--- e2e-tests/playwright/utils/ui-helper.ts | 36 ++++++-- 4 files changed, 153 insertions(+), 15 deletions(-) create mode 100644 .ibm/pipelines/resources/topology_test/topology-test.yaml diff --git a/.ibm/pipelines/resources/topology_test/topology-test.yaml b/.ibm/pipelines/resources/topology_test/topology-test.yaml new file mode 100644 index 0000000000..cab688c2ac --- /dev/null +++ b/.ibm/pipelines/resources/topology_test/topology-test.yaml @@ -0,0 +1,88 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: topology-test + namespace: rhdh + labels: + app.kubernetes.io/instance: topology-test + app.kubernetes.io/name: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + tasks: + - name: deploy + taskRef: + kind: ClusterTask + name: openshift-client +--- +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + name: topology-test-run + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + pipelineRef: + name: topology-test +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: topology-test + namespace: rhdh + labels: + app.kubernetes.io/instance: topology-test + app.kubernetes.io/name: topology-test + backstage.io/kubernetes-id: developer-hub + annotations: + app.openshift.io/vcs-uri: "https://github.com/janus-idp/backstage-showcase" +spec: + replicas: 1 + selector: + matchLabels: + app: topology-test + template: + metadata: + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub + spec: + containers: + - name: topology + image: nginxinc/nginx-unprivileged:stable-alpine + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: topology-test-service + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + selector: + app: topology-test + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: topology-test-route + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + to: + kind: Service + name: topology-test-service + port: + targetPort: 8080 + wildcardPolicy: None \ No newline at end of file diff --git a/.ibm/pipelines/utils.sh b/.ibm/pipelines/utils.sh index 23117fbbe9..4c71aebe03 100755 --- a/.ibm/pipelines/utils.sh +++ b/.ibm/pipelines/utils.sh @@ -449,6 +449,9 @@ apply_yaml_files() { oc apply -f "$dir/resources/pipeline-run/hello-world-pipeline.yaml" oc apply -f "$dir/resources/pipeline-run/hello-world-pipeline-run.yaml" + # Create Deployment and Pipeline for Topology test. + oc apply -f "$dir/resources/topology_test/topology-test.yaml" + } deploy_test_backstage_provider() { diff --git a/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts b/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts index b29ffd22ff..57b301a7b0 100644 --- a/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts +++ b/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts @@ -3,8 +3,7 @@ import { Common } from "../../../utils/common"; import { UIhelper } from "../../../utils/ui-helper"; import { Catalog } from "../../../support/pages/catalog"; -// Test disabled due to comments in JIRA ticket RHIDP-3437 -test.describe.skip("Test Topology Plugin", () => { +test.describe("Test Topology Plugin", () => { let common: Common; let uiHelper: UIhelper; let catalog: Catalog; @@ -17,18 +16,17 @@ test.describe.skip("Test Topology Plugin", () => { }); test("Verify pods visibility in the Topology tab", async ({ page }) => { - test.setTimeout(40000); await catalog.goToBackstageJanusProject(); await uiHelper.clickTab("Topology"); await uiHelper.verifyText("backstage-janus"); await page.getByRole("button", { name: "Fit to Screen" }).click(); await uiHelper.verifyText("rhdh"); await uiHelper.verifyText("rhdh-rbac"); - await uiHelper.verifyButtonURL( - "Open URL", - "https://rhdh-backstage-showcase", - ); - await page.locator("image").first().click(); + await uiHelper.verifyText("topology-test"); + await uiHelper.verifyButtonURL("Open URL", "topology-test-route", { + locator: `[data-test-id="topology-test"]`, + }); + await page.locator("[data-test-id=topology-test] image").first().click(); await page.getByLabel("Pod").click(); await page.getByLabel("Pod").getByText("1", { exact: true }).click(); await uiHelper.clickTab("Details"); @@ -39,7 +37,7 @@ test.describe.skip("Test Topology Plugin", () => { await uiHelper.verifyHeading("Services"); await uiHelper.verifyHeading("Routes"); await expect( - page.getByRole("link", { name: "https://rhdh-backstage-" }), + page.getByRole("link", { name: "topology-test-route" }), ).toBeVisible(); await expect(page.getByTitle("Deployment")).toBeVisible(); await uiHelper.verifyText("S"); @@ -51,6 +49,29 @@ test.describe.skip("Test Topology Plugin", () => { await page.getByLabel("Pod count").click(); await uiHelper.verifyText("1"); await uiHelper.verifyText("Pod"); - await page.getByLabel("Pod count").click(); + await uiHelper.hoverOnPodStatusIndicator(); + await uiHelper.verifyTextInTooltip("Running"); + await uiHelper.verifyText("1Running"); + await uiHelper.verifyButtonURL( + "Edit source code", + "https://github.com/janus-idp/backstage-showcase", + ); + await uiHelper.clickTab("Resources"); + await uiHelper.verifyText("P"); + expect(await page.getByTestId("icon-with-title-Running")).toBeVisible(); + expect( + await page.getByTestId("icon-with-title-Running").locator("svg"), + ).toBeVisible(); + expect( + await page + .getByTestId("icon-with-title-Running") + .getByTestId("status-text"), + ).toHaveText("Running"); + await uiHelper.verifyHeading("PipelineRuns"); + await uiHelper.verifyText("PL"); + await uiHelper.verifyText("PLR"); + await page.getByTestId("icon-only-Succeeded").hover(); + await uiHelper.verifyDivHasText("Pipeline SucceededTask"); + await uiHelper.verifyText("1 Succeeded"); }); }); diff --git a/e2e-tests/playwright/utils/ui-helper.ts b/e2e-tests/playwright/utils/ui-helper.ts index 9d2f5167f2..958f8779a4 100644 --- a/e2e-tests/playwright/utils/ui-helper.ts +++ b/e2e-tests/playwright/utils/ui-helper.ts @@ -298,13 +298,27 @@ export class UIhelper { }); } - async verifyButtonURL(label: string | RegExp, url: string | RegExp) { - const buttonUrl = await this.page - .getByRole("button", { name: label }) - .first() - .getAttribute("href"); + async verifyButtonURL( + label: string | RegExp, + url: string | RegExp, + options: { locator?: string } = { + locator: "", + }, + ) { + const buttonUrl = + options.locator == "" + ? await this.page + .getByRole("button", { name: label }) + .first() + .getAttribute("href") + : await this.page + .locator(options.locator) + .getByRole("button", { name: label }) + .first() + .getAttribute("href"); expect(buttonUrl).toContain(url); } + // locator('[data-test-id="topology-test"]').getByRole('button', { name: 'Open URL' }) /** * Verifies that a table row, identified by unique text, contains specific cell texts. @@ -539,4 +553,16 @@ export class UIhelper { await expect(enabledColumn).toHaveText(expectedEnabled); await expect(preinstalledColumn).toHaveText(expectedPreinstalled); } + + async hoverOnPodStatusIndicator() { + await this.page + .locator('[data-test-id="topology-test"]') + .getByText("Pod") + .hover({}); + } + + async verifyTextInTooltip(text: string | RegExp) { + const tooltip = await this.page.getByRole("tooltip").getByText(text); + expect(tooltip).toBeVisible(); + } } From 58906fd5a8d066e014b4ee62f2e42737fd0dd6f8 Mon Sep 17 00:00:00 2001 From: teknaS47 Date: Sun, 15 Dec 2024 18:48:25 +0530 Subject: [PATCH 4/6] Namespace removed --- .ibm/pipelines/resources/topology_test/topology-test.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.ibm/pipelines/resources/topology_test/topology-test.yaml b/.ibm/pipelines/resources/topology_test/topology-test.yaml index cab688c2ac..d30e9b9f24 100644 --- a/.ibm/pipelines/resources/topology_test/topology-test.yaml +++ b/.ibm/pipelines/resources/topology_test/topology-test.yaml @@ -3,7 +3,6 @@ apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: topology-test - namespace: rhdh labels: app.kubernetes.io/instance: topology-test app.kubernetes.io/name: topology-test @@ -19,7 +18,6 @@ apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: topology-test-run - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub @@ -31,7 +29,6 @@ apiVersion: apps/v1 kind: Deployment metadata: name: topology-test - namespace: rhdh labels: app.kubernetes.io/instance: topology-test app.kubernetes.io/name: topology-test @@ -59,7 +56,6 @@ apiVersion: v1 kind: Service metadata: name: topology-test-service - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub @@ -75,7 +71,6 @@ apiVersion: route.openshift.io/v1 kind: Route metadata: name: topology-test-route - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub From 2a9bba4559812c0250034fe6370eb126a1a72548 Mon Sep 17 00:00:00 2001 From: teknaS47 Date: Fri, 13 Dec 2024 23:29:10 +0530 Subject: [PATCH 5/6] [Test automation] Verify Topology is a supported plugin and E2E scenario follow-up --- .../topology_test/topology-test.yaml | 88 +++++++++++++++++++ .ibm/pipelines/utils.sh | 3 + .../e2e/plugins/topology/topology.spec.ts | 41 ++++++--- e2e-tests/playwright/utils/ui-helper.ts | 36 ++++++-- 4 files changed, 153 insertions(+), 15 deletions(-) create mode 100644 .ibm/pipelines/resources/topology_test/topology-test.yaml diff --git a/.ibm/pipelines/resources/topology_test/topology-test.yaml b/.ibm/pipelines/resources/topology_test/topology-test.yaml new file mode 100644 index 0000000000..cab688c2ac --- /dev/null +++ b/.ibm/pipelines/resources/topology_test/topology-test.yaml @@ -0,0 +1,88 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: topology-test + namespace: rhdh + labels: + app.kubernetes.io/instance: topology-test + app.kubernetes.io/name: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + tasks: + - name: deploy + taskRef: + kind: ClusterTask + name: openshift-client +--- +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + name: topology-test-run + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + pipelineRef: + name: topology-test +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: topology-test + namespace: rhdh + labels: + app.kubernetes.io/instance: topology-test + app.kubernetes.io/name: topology-test + backstage.io/kubernetes-id: developer-hub + annotations: + app.openshift.io/vcs-uri: "https://github.com/janus-idp/backstage-showcase" +spec: + replicas: 1 + selector: + matchLabels: + app: topology-test + template: + metadata: + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub + spec: + containers: + - name: topology + image: nginxinc/nginx-unprivileged:stable-alpine + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: topology-test-service + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + selector: + app: topology-test + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: topology-test-route + namespace: rhdh + labels: + app: topology-test + backstage.io/kubernetes-id: developer-hub +spec: + to: + kind: Service + name: topology-test-service + port: + targetPort: 8080 + wildcardPolicy: None \ No newline at end of file diff --git a/.ibm/pipelines/utils.sh b/.ibm/pipelines/utils.sh index 1d236b4a80..95885c7d70 100755 --- a/.ibm/pipelines/utils.sh +++ b/.ibm/pipelines/utils.sh @@ -450,6 +450,9 @@ apply_yaml_files() { oc apply -f "$dir/resources/pipeline-run/hello-world-pipeline.yaml" oc apply -f "$dir/resources/pipeline-run/hello-world-pipeline-run.yaml" + # Create Deployment and Pipeline for Topology test. + oc apply -f "$dir/resources/topology_test/topology-test.yaml" + } deploy_test_backstage_provider() { diff --git a/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts b/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts index b29ffd22ff..57b301a7b0 100644 --- a/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts +++ b/e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts @@ -3,8 +3,7 @@ import { Common } from "../../../utils/common"; import { UIhelper } from "../../../utils/ui-helper"; import { Catalog } from "../../../support/pages/catalog"; -// Test disabled due to comments in JIRA ticket RHIDP-3437 -test.describe.skip("Test Topology Plugin", () => { +test.describe("Test Topology Plugin", () => { let common: Common; let uiHelper: UIhelper; let catalog: Catalog; @@ -17,18 +16,17 @@ test.describe.skip("Test Topology Plugin", () => { }); test("Verify pods visibility in the Topology tab", async ({ page }) => { - test.setTimeout(40000); await catalog.goToBackstageJanusProject(); await uiHelper.clickTab("Topology"); await uiHelper.verifyText("backstage-janus"); await page.getByRole("button", { name: "Fit to Screen" }).click(); await uiHelper.verifyText("rhdh"); await uiHelper.verifyText("rhdh-rbac"); - await uiHelper.verifyButtonURL( - "Open URL", - "https://rhdh-backstage-showcase", - ); - await page.locator("image").first().click(); + await uiHelper.verifyText("topology-test"); + await uiHelper.verifyButtonURL("Open URL", "topology-test-route", { + locator: `[data-test-id="topology-test"]`, + }); + await page.locator("[data-test-id=topology-test] image").first().click(); await page.getByLabel("Pod").click(); await page.getByLabel("Pod").getByText("1", { exact: true }).click(); await uiHelper.clickTab("Details"); @@ -39,7 +37,7 @@ test.describe.skip("Test Topology Plugin", () => { await uiHelper.verifyHeading("Services"); await uiHelper.verifyHeading("Routes"); await expect( - page.getByRole("link", { name: "https://rhdh-backstage-" }), + page.getByRole("link", { name: "topology-test-route" }), ).toBeVisible(); await expect(page.getByTitle("Deployment")).toBeVisible(); await uiHelper.verifyText("S"); @@ -51,6 +49,29 @@ test.describe.skip("Test Topology Plugin", () => { await page.getByLabel("Pod count").click(); await uiHelper.verifyText("1"); await uiHelper.verifyText("Pod"); - await page.getByLabel("Pod count").click(); + await uiHelper.hoverOnPodStatusIndicator(); + await uiHelper.verifyTextInTooltip("Running"); + await uiHelper.verifyText("1Running"); + await uiHelper.verifyButtonURL( + "Edit source code", + "https://github.com/janus-idp/backstage-showcase", + ); + await uiHelper.clickTab("Resources"); + await uiHelper.verifyText("P"); + expect(await page.getByTestId("icon-with-title-Running")).toBeVisible(); + expect( + await page.getByTestId("icon-with-title-Running").locator("svg"), + ).toBeVisible(); + expect( + await page + .getByTestId("icon-with-title-Running") + .getByTestId("status-text"), + ).toHaveText("Running"); + await uiHelper.verifyHeading("PipelineRuns"); + await uiHelper.verifyText("PL"); + await uiHelper.verifyText("PLR"); + await page.getByTestId("icon-only-Succeeded").hover(); + await uiHelper.verifyDivHasText("Pipeline SucceededTask"); + await uiHelper.verifyText("1 Succeeded"); }); }); diff --git a/e2e-tests/playwright/utils/ui-helper.ts b/e2e-tests/playwright/utils/ui-helper.ts index 9f82004c11..a54f99f354 100644 --- a/e2e-tests/playwright/utils/ui-helper.ts +++ b/e2e-tests/playwright/utils/ui-helper.ts @@ -353,13 +353,27 @@ export class UIhelper { }); } - async verifyButtonURL(label: string | RegExp, url: string | RegExp) { - const buttonUrl = await this.page - .getByRole("button", { name: label }) - .first() - .getAttribute("href"); + async verifyButtonURL( + label: string | RegExp, + url: string | RegExp, + options: { locator?: string } = { + locator: "", + }, + ) { + const buttonUrl = + options.locator == "" + ? await this.page + .getByRole("button", { name: label }) + .first() + .getAttribute("href") + : await this.page + .locator(options.locator) + .getByRole("button", { name: label }) + .first() + .getAttribute("href"); expect(buttonUrl).toContain(url); } + // locator('[data-test-id="topology-test"]').getByRole('button', { name: 'Open URL' }) /** * Verifies that a table row, identified by unique text, contains specific cell texts. @@ -594,4 +608,16 @@ export class UIhelper { await expect(enabledColumn).toHaveText(expectedEnabled); await expect(preinstalledColumn).toHaveText(expectedPreinstalled); } + + async hoverOnPodStatusIndicator() { + await this.page + .locator('[data-test-id="topology-test"]') + .getByText("Pod") + .hover({}); + } + + async verifyTextInTooltip(text: string | RegExp) { + const tooltip = await this.page.getByRole("tooltip").getByText(text); + expect(tooltip).toBeVisible(); + } } From fa269714c22fd9a5637833634a03971fcb01cf65 Mon Sep 17 00:00:00 2001 From: teknaS47 Date: Sun, 15 Dec 2024 18:48:25 +0530 Subject: [PATCH 6/6] Namespace removed --- .ibm/pipelines/resources/topology_test/topology-test.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.ibm/pipelines/resources/topology_test/topology-test.yaml b/.ibm/pipelines/resources/topology_test/topology-test.yaml index cab688c2ac..d30e9b9f24 100644 --- a/.ibm/pipelines/resources/topology_test/topology-test.yaml +++ b/.ibm/pipelines/resources/topology_test/topology-test.yaml @@ -3,7 +3,6 @@ apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: topology-test - namespace: rhdh labels: app.kubernetes.io/instance: topology-test app.kubernetes.io/name: topology-test @@ -19,7 +18,6 @@ apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: topology-test-run - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub @@ -31,7 +29,6 @@ apiVersion: apps/v1 kind: Deployment metadata: name: topology-test - namespace: rhdh labels: app.kubernetes.io/instance: topology-test app.kubernetes.io/name: topology-test @@ -59,7 +56,6 @@ apiVersion: v1 kind: Service metadata: name: topology-test-service - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub @@ -75,7 +71,6 @@ apiVersion: route.openshift.io/v1 kind: Route metadata: name: topology-test-route - namespace: rhdh labels: app: topology-test backstage.io/kubernetes-id: developer-hub