Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .ibm/pipelines/openshift-ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ main() {
exit "${OVERALL_RESULT}"
}

main
main

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { test } from "@playwright/test";
import { UIhelper } from "../../../utils/ui-helper";
import { Common } from "../../../utils/common";
import RhdhNotficationsApi from "../../../support/api/notifications";
import { Notifications } from "../../../support/api/notifications-api-structures";
import { NotificationPage } from "../../../support/pages/notifications";

test.describe("Filter critical notification tests", () => {
let uiHelper: UIhelper;
let common: Common;
let notificationPage: NotificationPage;
let apiToken: string;

const severities = ["Critical", "High", "Normal", "Low"];

test.beforeEach(async ({ page }) => {
uiHelper = new UIhelper(page);
common = new Common(page);
notificationPage = new NotificationPage(page);
await common.loginAsKeycloakUser();
apiToken = "test-token";
});

for (const severity of severities) {
test(`Filter notifications by severity - ${severity}`, async () => {
const r = (Math.random() + 1).toString(36).substring(7);
const notificationsApi = await RhdhNotficationsApi.build(apiToken);
const notificationTitle = "UI Notification By Severity";
const notification: Notifications = {
recipients: {
type: "broadcast",
entityRef: [""],
},
payload: {
title: `${notificationTitle} ${severity}-${r}`,
description: `Test ${notificationTitle} ${severity}-${r}`,
severity: severity,
topic: `Testing ${notificationTitle} ${severity}-${r}`,
},
};
await notificationsApi.createNotification(notification);
await uiHelper.openSidebar("Notifications");
await notificationPage.selectSeverity(severity);
await notificationPage.notificationContains(
`${notificationTitle} ${severity}-${r}`,
);
});
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { test } from "@playwright/test";
import { UIhelper } from "../../../utils/ui-helper";
import { Common } from "../../../utils/common";
import RhdhNotificationsApi from "../../../support/api/notifications";
import { Notifications } from "../../../support/api/notifications-api-structures";
import { NotificationPage } from "../../../support/pages/notifications";

test.describe("Mark notification tests", () => {
let uiHelper: UIhelper;
let common: Common;
let notificationPage: NotificationPage;
let apiToken: string;

test.beforeEach(async ({ page }) => {
uiHelper = new UIhelper(page);
common = new Common(page);
notificationPage = new NotificationPage(page);
await common.loginAsKeycloakUser();
apiToken = "test-token";
});

test("Mark notification as read", async () => {
const r = (Math.random() + 1).toString(36).substring(7);
const notificationsApi = await RhdhNotificationsApi.build(apiToken);
const notificationTitle = `UI Notification Mark as read`;
const notification: Notifications = {
recipients: {
type: "broadcast",
entityRef: [""],
},
payload: {
title: `${notificationTitle}-${r}`,
description: `Test ${notificationTitle}-${r}`,
severity: "Normal",
topic: `Testing ${notificationTitle}-${r}`,
},
};
await notificationsApi.createNotification(notification);
await uiHelper.openSidebar("Notifications");
await notificationPage.notificationContains(`${notificationTitle}-${r}`);
await notificationPage.markNotificationAsRead(`${notificationTitle}-${r}`);
await notificationPage.viewRead();
await notificationPage.notificationContains(
RegExp(`${notificationTitle}-${r}.*(a few seconds ago)|(a minute ago)`),
);
});

test("Mark notification as unread", async () => {
const r = (Math.random() + 1).toString(36).substring(7);
const notificationsApi = await RhdhNotificationsApi.build(apiToken);
const notificationTitle = `UI Notification Mark as unread`;
const notification: Notifications = {
recipients: {
type: "broadcast",
entityRef: [""],
},
payload: {
title: `${notificationTitle}-${r}`,
description: `Test ${notificationTitle}-${r}`,
severity: "Normal",
topic: `Testing ${notificationTitle}-${r}`,
},
};
await notificationsApi.createNotification(notification);
await uiHelper.openSidebar("Notifications");
await notificationPage.notificationContains(`${notificationTitle}-${r}`);
await notificationPage.markNotificationAsRead(`${notificationTitle}-${r}`);
await notificationPage.viewRead();
await notificationPage.notificationContains(
RegExp(`${notificationTitle}-${r}.*(a few seconds ago)|(a minute ago)`),
);
await notificationPage.markLastNotificationAsUnRead();
await notificationPage.viewUnRead();
await notificationPage.notificationContains(
RegExp(`${notificationTitle}-${r}.*(a few seconds ago)|(a minute ago)`),
);
});

test("Mark notification as saved", async () => {
const r = (Math.random() + 1).toString(36).substring(7);
const notificationsApi = await RhdhNotificationsApi.build(apiToken);
const notificationTitle = `UI Notification Mark as saved`;
const notification: Notifications = {
recipients: {
type: "broadcast",
entityRef: [""],
},
payload: {
title: `${notificationTitle}-${r}`,
description: `Test ${notificationTitle}-${r}`,
severity: "Normal",
topic: `Testing ${notificationTitle}-${r}`,
},
};
await notificationsApi.createNotification(notification);
await uiHelper.openSidebar("Notifications");
await notificationPage.selectNotification();
await notificationPage.saveSelected();
await notificationPage.viewSaved();
await notificationPage.notificationContains(
RegExp(`${notificationTitle}-${r}.*(a few seconds ago)|(a minute ago)`),
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { test } from "@playwright/test";
import { UIhelper } from "../../../utils/ui-helper";
import { Common } from "../../../utils/common";
import { Orchestrator } from "../../../support/pages/orchestrator";

test.describe("Orchestrator greeting workflow tests", () => {
let uiHelper: UIhelper;
let common: Common;
let orchestrator: Orchestrator;

test.beforeEach(async ({ page }) => {
uiHelper = new UIhelper(page);
common = new Common(page);
orchestrator = new Orchestrator(page);
await common.loginAsKeycloakUser();
});

test("Greeting workflow execution and workflow tab validation", async () => {
await uiHelper.openSidebar("Orchestrator");
await orchestrator.selectGreetingWorkflowItem();
await orchestrator.runGreetingWorkflow();
await uiHelper.openSidebar("Orchestrator");
await orchestrator.validateGreetingWorkflow();
});

test("Greeting workflow run details validation", async () => {
await uiHelper.openSidebar("Orchestrator");
await orchestrator.selectGreetingWorkflowItem();
await orchestrator.runGreetingWorkflow();
await orchestrator.reRunGreetingWorkflow();
await orchestrator.validateWorkflowRunsDetails();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { test } from "@playwright/test";
import { UIhelper } from "../../../utils/ui-helper";
import { Common } from "../../../utils/common";
import { Orchestrator } from "../../../support/pages/orchestrator";

test.describe("Orchestrator Workflow Runs tests", () => {
let uiHelper: UIhelper;
let common: Common;
let orchestrator: Orchestrator;

test.beforeEach(async ({ page }) => {
uiHelper = new UIhelper(page);
common = new Common(page);
orchestrator = new Orchestrator(page);
await common.loginAsKeycloakUser();
});

test("Workflow All Runs Validation", async () => {
await uiHelper.openSidebar("Orchestrator");
await orchestrator.validateWorkflowAllRuns();
});
});
30 changes: 12 additions & 18 deletions e2e-tests/playwright/support/pages/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export class NotificationPage {

async clickNotificationsNavBarItem() {
await this.uiHelper.openSidebar("Notifications");
await expect(
this.page.getByRole("table").filter({ hasText: "Rows per page" }),
).toBeVisible();
await expect(
this.page.getByTestId("loading-indicator").getByRole("img"),
).toHaveCount(0);
}

async notificationContains(text: string | RegExp) {
Expand All @@ -25,10 +31,6 @@ export class NotificationPage {
await expect(row).toHaveCount(1);
}

async notificationTextExists(text: string | RegExp) {
await expect(this.page.getByRole("cell", { name: text })).toHaveCount(1);
}

async clickNotificationHeadingLink(text: string | RegExp) {
await this.page
.getByRole("cell", { name: text, exact: true })
Expand Down Expand Up @@ -119,27 +121,19 @@ export class NotificationPage {

async viewRead() {
await this.page.getByLabel("View").click();
if (`${process.env.MILESTONE}` == "5") {
await this.page
.getByRole("option", { name: "Read notifications", exact: true })
.click();
} else {
await this.page.getByRole("option", { name: "Marked as read" }).click();
}
await this.page
.getByRole("option", { name: "Read notifications", exact: true })
.click();
await expect(
this.page.getByTestId("loading-indicator").getByRole("img"),
).toHaveCount(0);
}

async viewUnRead() {
await this.page.getByLabel("View").click();
if (`${process.env.MILESTONE}` == "5") {
await this.page
.getByRole("option", { name: "Unread notifications", exact: true })
.click();
} else {
await this.page.getByRole("option", { name: "New only" }).click();
}
await this.page
.getByRole("option", { name: "Unread notifications", exact: true })
.click();
await expect(
this.page.getByTestId("loading-indicator").getByRole("img"),
).toHaveCount(0);
Expand Down
Loading
Loading