Skip to content

Commit

Permalink
added notifications button tests
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Cai <[email protected]>
  • Loading branch information
ciiay committed Feb 19, 2025
1 parent 01d4dfd commit 845f5a7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .ibm/pipelines/value_files/values_showcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ global:
disabled: false
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-header
disabled: false
pluginConfig:
app:
sidebar:
search: false
settings: false
support:
url: https://github.com/redhat-developer/rhdh/issues
items:
- title: Red Hat Developer Hub
links:
- url: https://access.redhat.com/products/red-hat-developer-hub
title: Product Information
# Enable notifications plugins.
- package: ./dynamic-plugins/dist/backstage-plugin-notifications
disabled: false
Expand Down Expand Up @@ -143,6 +155,15 @@ upstream:
commonLabels:
backstage.io/kubernetes-id: developer-hub
backstage:
appConfig:
backend:
auth:
dangerouslyDisableDefaultAuthPolicy: true
externalAccess:
- type: static
options:
token: test-token
subject: test-subject
image:
pullPolicy: Always
registry: quay.io
Expand Down
34 changes: 33 additions & 1 deletion e2e-tests/playwright/e2e/default-global-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ test.describe("Default Global Header", () => {
test.beforeEach(async ({ page }) => {
uiHelper = new UIhelper(page);
common = new Common(page);
await common.loginAsGuest();
await common.loginAsKeycloakUser(
process.env.GH_USER2_ID,
process.env.GH_USER2_PASS,
);
await expect(page.locator("nav[id='global-header']")).toBeVisible();
});

Expand Down Expand Up @@ -82,4 +85,33 @@ test.describe("Default Global Header", () => {
);
await expect(searchResultPageInput).toHaveValue("test query term");
});

test("Verify Notifications button behaves as expected", async ({
baseURL,
request,
page,
}) => {
await uiHelper.clickLinkByAriaLabel("Notifications");
await uiHelper.verifyHeading("Notifications");

const response = await request.post(`${baseURL}/api/notifications`, {
headers: {
"Content-Type": "application/json",
Authorization: "Bearer test-token",
},
data: {
recipients: { type: "broadcast" },
payload: {
title: "Demo test notification message!",
link: "http://foo.com/bar",
severity: "high",
topic: "The topic",
},
},
});

expect(response.status()).toBe(200);
const notificationsBadge = page.locator("span[class*='-badge']");
await expect(notificationsBadge).toHaveText("1");
});
});

0 comments on commit 845f5a7

Please sign in to comment.