Skip to content

Commit

Permalink
fix(global-header): add e2e tests for global header
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Cai <[email protected]>
  • Loading branch information
ciiay committed Feb 18, 2025
1 parent 12bb302 commit 741341b
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 45 deletions.
3 changes: 1 addition & 2 deletions .ibm/pipelines/value_files/values_showcase-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ global:
disabled: false
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import
disabled: false
# Disable global header plugin for now. See https://issues.redhat.com/browse/RHIDP-5474
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-header
disabled: true
disabled: false
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-dynamic-home-page
disabled: false
# Enable tech-radar plugin.
Expand Down
3 changes: 1 addition & 2 deletions .ibm/pipelines/value_files/values_showcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ global:
disabled: false
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import
disabled: false
# Disable global header plugin for now. See https://issues.redhat.com/browse/RHIDP-5474
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-header
disabled: true
disabled: false
# Enable tech-radar plugins.
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar
disabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test.describe("Standard authentication providers: Basic authentication", () => {
// Guest login should work
await common.loginAsGuest();
await page.goto("/");
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
});

Expand Down Expand Up @@ -125,15 +125,15 @@ test.describe("Standard authentication providers: Basic authentication", () => {
constants.AZURE_LOGIN_PASSWORD,
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.verifyParagraph(constants.AZURE_LOGIN_USERNAME);

// check no entities are in the catalog
const api = new APIHelper();
api.UseStaticToken(constants.STATIC_API_TOKEN);
const catalogUsers = await api.getAllCatalogUsersFromAPI();
expect(catalogUsers.totalItems).toBe(0);
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
});

Expand Down
14 changes: 7 additions & 7 deletions e2e-tests/playwright/e2e/authProviders/github-provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
timeout: 90 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
});

Expand Down Expand Up @@ -242,7 +242,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
constants.GH_USER_PASSWORD,
constants.AUTH_PROVIDERS_GH_USER_2FA,
);
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies();
});
Expand Down Expand Up @@ -339,7 +339,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
timeout: 90 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();

await waitForNextSync("github", syncTime);
Expand Down Expand Up @@ -384,7 +384,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
timeout: 60 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies();
});
Expand Down Expand Up @@ -452,7 +452,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
timeout: 30 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies();
});
Expand Down Expand Up @@ -530,7 +530,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
constants.GH_TEAMS["team_2"].name + "_renamed",
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
// user should see the entities again
await expect(async () => {
await page.reload();
Expand All @@ -549,7 +549,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
constants.GH_TEAMS["team_2"].name + "_renamed",
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
timeout: 90 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies();
});
Expand Down Expand Up @@ -342,7 +342,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
timeout: 120 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user

Expand Down Expand Up @@ -395,7 +395,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
timeout: 120 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
});
Expand Down Expand Up @@ -429,7 +429,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
constants.RHSSO76_DEFAULT_PASSWORD,
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user

Expand Down Expand Up @@ -469,7 +469,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
timeout: 30 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
});
Expand Down Expand Up @@ -531,7 +531,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
constants.RHSSO76_DEFAULT_PASSWORD,
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
});
Expand Down Expand Up @@ -566,7 +566,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
constants.RHSSO76_DEFAULT_PASSWORD,
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies();

Expand Down Expand Up @@ -655,7 +655,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
constants.MSGRAPH_GROUPS["group_6"].displayName + "_renamed",
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
// user should see the entities again
await expect(async () => {
await page.reload();
Expand All @@ -674,7 +674,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
constants.MSGRAPH_GROUPS["group_6"].displayName + "_renamed",
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
});
Expand Down
25 changes: 13 additions & 12 deletions e2e-tests/playwright/e2e/authProviders/rhsso-76-provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_USERS["user_1"].username,
constants.RHSSO76_DEFAULT_PASSWORD,
);
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.verifyHeading(
await rhssoHelper.getRHSSOUserDisplayName(
constants.RHSSO76_USERS["user_1"],
Expand Down Expand Up @@ -184,7 +184,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_USERS["user_1"].username,
constants.RHSSO76_DEFAULT_PASSWORD,
);
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.verifyHeading(
await rhssoHelper.getRHSSOUserDisplayName(
constants.RHSSO76_USERS["user_1"],
Expand Down Expand Up @@ -241,7 +241,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_USERS["user_1"].username,
constants.RHSSO76_DEFAULT_PASSWORD,
);
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.verifyHeading(
rhssoHelper.getRHSSOUserDisplayName(constants.RHSSO76_USERS["user_1"]),
);
Expand All @@ -252,7 +252,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_USERS["jenny_doe"].username,
constants.RHSSO76_DEFAULT_PASSWORD,
);
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.verifyHeading(
rhssoHelper.getRHSSOUserDisplayName(
constants.RHSSO76_USERS["jenny_doe"],
Expand All @@ -265,7 +265,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_USERS["user_2"].username,
constants.RHSSO76_DEFAULT_PASSWORD,
);
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.verifyHeading(
rhssoHelper.getRHSSOUserDisplayName(constants.RHSSO76_USERS["user_2"]),
);
Expand Down Expand Up @@ -445,7 +445,8 @@ for (const version of ["RHBK"]) {
expect(statusBefore).toBe(403);

// logout
await uiHelper.openSidebar("Settings");
await uiHelper.clickByDataTestId("KeyboardArrowDownOutlinedIcon");
await uiHelper.clickLinkByHref("/settings");
await common.signOut();
}).toPass({
intervals: [1_000, 2_000, 5_000],
Expand Down Expand Up @@ -499,7 +500,7 @@ for (const version of ["RHBK"]) {
timeout: 60 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
});

Expand All @@ -518,7 +519,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_DEFAULT_PASSWORD,
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();

// group_4 should exist in rhdh
Expand Down Expand Up @@ -572,7 +573,7 @@ for (const version of ["RHBK"]) {
timeout: 30 * 1000,
});

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
});

Expand Down Expand Up @@ -626,7 +627,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_DEFAULT_PASSWORD,
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
});

Expand Down Expand Up @@ -722,7 +723,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_GROUPS["group_2"].name + "_renamed",
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
// user should see the entities again
await expect(async () => {
await page.reload();
Expand All @@ -742,7 +743,7 @@ for (const version of ["RHBK"]) {
constants.RHSSO76_GROUPS["group_2"].name + "_renamed",
);

await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
});

Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/playwright/e2e/github-happy-path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test.describe.skip("GitHub Happy path", () => {
);

test("Verify Profile is Github Account Name in the Settings page", async () => {
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await expect(page).toHaveURL("/settings");
await uiHelper.verifyHeading(process.env.GH_USER_ID);
await uiHelper.verifyHeading(`User Entity: ${process.env.GH_USER_ID}`);
Expand Down Expand Up @@ -76,7 +76,7 @@ test.describe.skip("GitHub Happy path", () => {
});

test("Verify all 12 Software Templates appear in the Create page", async () => {
await uiHelper.openSidebar("Create...");
await uiHelper.clickLinkByAriaLabel("Create...");
await uiHelper.verifyHeading("Templates");

for (const template of TEMPLATES) {
Expand Down Expand Up @@ -192,7 +192,7 @@ test.describe.skip("GitHub Happy path", () => {
});

test("Sign out and verify that you return back to the Sign in page", async () => {
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await common.signOut();
});

Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/playwright/e2e/google-signin-happy-path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.describe.skip("Google signin happy path", () => {
});

test("Verify Google Sign in", async () => {
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.clickTab("Authentication Providers");
await page.getByTitle("Sign in to Google").click();
await uiHelper.clickButton("Log in");
Expand Down
5 changes: 3 additions & 2 deletions e2e-tests/playwright/e2e/guest-signin-happy-path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ test.describe("Guest Signing Happy path", () => {
});

test("Verify Profile is Guest in the Settings page", async () => {
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.verifyHeading("Guest");
await uiHelper.verifyHeading("User Entity: guest");
});

test("Sign Out and Verify that you return to the Sign-in page", async () => {
await uiHelper.openSidebar("Settings");
await uiHelper.goToSettingsPage();
await uiHelper.goToSettingsPage();
await common.signOut();
});
});
2 changes: 1 addition & 1 deletion e2e-tests/playwright/e2e/plugins/http-request.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test.describe("Testing scaffolder-backend-module-http-request to invoke an exter

test("Create a software template using http-request plugin", async () => {
test.setTimeout(130000);
await uiHelper.openSidebar("Create...");
await uiHelper.clickLinkByAriaLabel("Create...");
await uiHelper.verifyHeading("Templates");
await uiHelper.clickButton("Register Existing Component");
await catalogImport.registerExistingComponent(template, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe("Test Kubernetes Actions plugin", () => {
kubeClient = new KubeClient();

await common.loginAsGuest();
await uiHelper.openSidebar("Create...");
await uiHelper.clickLinkByAriaLabel("Create...");
});

test("Creates kubernetes namespace", async () => {
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/playwright/e2e/plugins/rbac/rbac.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ test.describe.serial("Test RBAC", () => {
await uiHelper.openSidebar("Catalog");
await uiHelper.selectMuiBox("Kind", "Component");
await uiHelper.verifyTableIsEmpty();
await uiHelper.openSidebar("Create...");
await uiHelper.clickLinkByAriaLabel("Create...");
await page.reload();
await uiHelper.verifyText(
"No templates found that match your filter. Learn more about",
Expand All @@ -463,7 +463,7 @@ test.describe.serial("Test RBAC", () => {
});

test("Test catalog-entity create is allowed", async () => {
await uiHelper.openSidebar("Create...");
await uiHelper.clickLinkByAriaLabel("Create...");
expect(await uiHelper.isLinkVisible("Register Existing Component"));
await uiHelper.clickButton("Register Existing Component");
const catalogImport = new CatalogImport(page);
Expand Down
Loading

0 comments on commit 741341b

Please sign in to comment.