Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(e2e): [Test automation] Verify Topology is a supported plugin and E2E scenario follow-up #2191

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
18a0a85
[Test automation] Verify Topology is a supported plugin and E2E scena…
teknaS47 Dec 13, 2024
a759ab8
Namespace removed
teknaS47 Dec 15, 2024
63626d0
Merge branch 'main' into topology-plugin-test
teknaS47 Dec 19, 2024
d8411a2
[Test automation] Verify Topology is a supported plugin and E2E scena…
teknaS47 Dec 13, 2024
58906fd
Namespace removed
teknaS47 Dec 15, 2024
053f817
Merge branch 'topology-plugin-test' of https://github.com/teknaS47/ba…
teknaS47 Dec 19, 2024
2a9bba4
[Test automation] Verify Topology is a supported plugin and E2E scena…
teknaS47 Dec 13, 2024
fa26971
Namespace removed
teknaS47 Dec 15, 2024
7fc199a
Merge branch 'topology-plugin-test' of https://github.com/teknaS47/ba…
teknaS47 Dec 27, 2024
ec48cc0
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 2, 2025
038f308
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 7, 2025
4512654
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 13, 2025
2ea02bb
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 15, 2025
ed11673
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 15, 2025
7f84c2a
Sleep test
teknaS47 Jan 16, 2025
5f02079
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 16, 2025
d065abc
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 16, 2025
05eadf8
TLS issue
teknaS47 Jan 17, 2025
f9833f4
Merge branch 'topology-plugin-test' of https://github.com/teknaS47/ba…
teknaS47 Jan 17, 2025
c8f0562
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 17, 2025
f4c1164
pipeline config change
teknaS47 Jan 17, 2025
f0e8bc7
Merge branch 'topology-plugin-test' of https://github.com/teknaS47/ba…
teknaS47 Jan 17, 2025
bb9e27e
cleanup
teknaS47 Jan 17, 2025
25e9dc3
cleanup
teknaS47 Jan 17, 2025
d18a9a5
cleanup
teknaS47 Jan 17, 2025
cb6fa88
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 17, 2025
e851de1
1.4 changes
teknaS47 Jan 17, 2025
cd03a29
Merge branch 'topology-plugin-test' of https://github.com/teknaS47/ba…
teknaS47 Jan 17, 2025
256413a
fix
teknaS47 Jan 17, 2025
45483f8
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 17, 2025
d4671ef
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 17, 2025
7cc57e0
Merge branch 'main' into topology-plugin-test
teknaS47 Jan 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .ibm/pipelines/resources/topology_test/topology-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: topology-test
labels:
app.kubernetes.io/instance: topology-test
app.kubernetes.io/name: topology-test
backstage.io/kubernetes-id: developer-hub
spec:
tasks:
- name: deploy
taskSpec:
steps:
- name: oc
image: 'quay.io/openshift/origin-cli:latest'
script: |
#!/bin/sh
oc "$@"
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: topology-test-run
labels:
app: topology-test
backstage.io/kubernetes-id: developer-hub
spec:
pipelineRef:
name: topology-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: topology-test
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
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
labels:
app: topology-test
backstage.io/kubernetes-id: developer-hub
spec:
to:
kind: Service
name: topology-test-service
port:
targetPort: 8080
wildcardPolicy: None
5 changes: 4 additions & 1 deletion .ibm/pipelines/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,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() {
Expand Down Expand Up @@ -542,7 +545,7 @@ run_tests() {
cd "${DIR}/../../e2e-tests"
local e2e_tests_dir
e2e_tests_dir=$(pwd)

yarn install
yarn playwright install chromium

Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/value_files/values_showcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ upstream:
value: 'true'
- name: NODE_OPTIONS
value: '--no-node-snapshot'
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: '0'
extraAppConfig:
- configMapRef: app-config-rhdh
filename: app-config-rhdh.yaml
Expand Down
41 changes: 31 additions & 10 deletions e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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("status-ok").first().click();
await uiHelper.verifyDivHasText("Pipeline SucceededTask");
await uiHelper.verifyText("2 Succeeded");
});
});
36 changes: 31 additions & 5 deletions e2e-tests/playwright/utils/ui-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,24 @@ 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);
}

Expand Down Expand Up @@ -603,4 +616,17 @@ export class UIhelper {
await expect(enabledColumn).toHaveText(expectedEnabled);
await expect(preinstalledColumn).toHaveText(expectedPreinstalled);
}

async hoverOnPodStatusIndicator() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@teknaS47 we shouldn't add page specific methods to UIhelper. can you please move to respective e2e-tests/playwright/support/pages/?

await this.page
.locator('[data-test-id="topology-test"]')
.getByText("Pod")
.first()
.hover({});
}

async verifyTextInTooltip(text: string | RegExp) {
const tooltip = await this.page.getByRole("tooltip").getByText(text);
expect(tooltip).toBeVisible();
}
}
Loading