Skip to content

Commit 24bb5bd

Browse files
authored
chore(e2e): add e2e tests for global header (#2412)
* fix(global-header): add e2e tests for global header Signed-off-by: Yi Cai <[email protected]> * Added global header e2e tests Signed-off-by: Yi Cai <[email protected]> * fixed prettier issues Signed-off-by: Yi Cai <[email protected]> * added header search bar test Signed-off-by: Yi Cai <[email protected]> * added notifications button tests Signed-off-by: Yi Cai <[email protected]> * updated config Signed-off-by: Yi Cai <[email protected]> * updated failed tests Signed-off-by: Yi Cai <[email protected]> * updated failed tests Signed-off-by: Yi Cai <[email protected]> * fixed profile dropdown label Signed-off-by: Yi Cai <[email protected]> * fixed failed tests Signed-off-by: Yi Cai <[email protected]> * addressed review comments Signed-off-by: Yi Cai <[email protected]> --------- Signed-off-by: Yi Cai <[email protected]>
1 parent a1f5948 commit 24bb5bd

20 files changed

+241
-65
lines changed

.ibm/pipelines/resources/config_map/app-config-rhdh.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
app:
2+
support:
3+
url: https://github.com/redhat-developer/rhdh/issues
4+
items:
5+
- title: Red Hat Developer Hub
6+
links:
7+
- url: https://access.redhat.com/products/red-hat-developer-hub
8+
title: Product Information
29
baseUrl: ${RHDH_BASE_URL}
310
title: Red Hat Developer Hub
411
branding:

.ibm/pipelines/value_files/values_showcase-rbac.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ global:
9696
disabled: false
9797
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import
9898
disabled: false
99-
# Disable global header plugin for now. See https://issues.redhat.com/browse/RHIDP-5474
10099
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-header
101-
disabled: true
100+
disabled: false
102101
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-dynamic-home-page
103102
disabled: false
104103
# Enable tech-radar plugin.

.ibm/pipelines/value_files/values_showcase.yaml

+19-2
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,17 @@ global:
117117
disabled: false
118118
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import
119119
disabled: false
120-
# Disable global header plugin for now. See https://issues.redhat.com/browse/RHIDP-5474
121120
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-header
122-
disabled: true
121+
disabled: false
122+
# Enable notifications plugins.
123+
- package: ./dynamic-plugins/dist/backstage-plugin-notifications
124+
disabled: false
125+
- package: ./dynamic-plugins/dist/backstage-plugin-notifications-backend-dynamic
126+
disabled: false
127+
- package: ./dynamic-plugins/dist/backstage-plugin-signals-backend-dynamic
128+
disabled: false
129+
- package: ./dynamic-plugins/dist/backstage-plugin-signals
130+
disabled: false
123131
# Enable tech-radar plugins.
124132
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar
125133
disabled: false
@@ -168,6 +176,15 @@ upstream:
168176
commonLabels:
169177
backstage.io/kubernetes-id: developer-hub
170178
backstage:
179+
appConfig:
180+
backend:
181+
auth:
182+
dangerouslyDisableDefaultAuthPolicy: true
183+
externalAccess:
184+
- type: static
185+
options:
186+
token: test-token
187+
subject: test-subject
171188
image:
172189
pullPolicy: Always
173190
registry: quay.io

e2e-tests/playwright/e2e/audit-log/scaffold.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ test.describe("Audit Log check for Catalog Plugin", () => {
2222
common = new Common(page);
2323
catalogImport = new CatalogImport(page);
2424
await common.loginAsGuest();
25-
await uiHelper.openSidebar("Create");
25+
await uiHelper.clickLink({ ariaLabel: "Create..." });
2626
});
2727

2828
test("Should fetch logs for ScaffolderParameterSchemaFetch event and validate log structure and values", async ({
2929
baseURL,
3030
}) => {
3131
await uiHelper.clickButton("Register Existing Component");
3232
await catalogImport.registerExistingComponent(template, false);
33-
await uiHelper.openSidebar("Create");
33+
await uiHelper.clickLink({ ariaLabel: "Create..." });
3434
await common.waitForLoad();
3535
await uiHelper.clickBtnInCard("Hello World 2", "Choose");
3636
await LogUtils.validateLogEvent(

e2e-tests/playwright/e2e/authProviders/basic-authentication.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ test.describe("Standard authentication providers: Basic authentication", () => {
5151

5252
// Guest login should work
5353
await common.loginAsGuest();
54-
await page.goto("/settings");
54+
await uiHelper.goToSettingsPage();
5555
await common.signOut();
5656
});
5757

@@ -123,15 +123,15 @@ test.describe("Standard authentication providers: Basic authentication", () => {
123123
constants.AZURE_LOGIN_PASSWORD,
124124
);
125125

126-
await page.goto("/settings");
126+
await uiHelper.goToSettingsPage();
127127
await uiHelper.verifyParagraph(constants.AZURE_LOGIN_USERNAME);
128128

129129
// check no entities are in the catalog
130130
const api = new APIHelper();
131131
api.UseStaticToken(constants.STATIC_API_TOKEN);
132132
const catalogUsers = await api.getAllCatalogUsersFromAPI();
133133
expect(catalogUsers.totalItems).toBe(0);
134-
await page.goto("/settings");
134+
await uiHelper.goToSettingsPage();
135135
await common.signOut();
136136
});
137137

e2e-tests/playwright/e2e/authProviders/github-provider.spec.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
117117
timeout: 90 * 1000,
118118
});
119119

120-
await page.goto("/settings");
120+
await uiHelper.goToSettingsPage();
121121
await common.signOut();
122122
await context.clearCookies();
123123
});
@@ -243,7 +243,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
243243
constants.GH_USER_PASSWORD,
244244
constants.AUTH_PROVIDERS_GH_USER_2FA,
245245
);
246-
await page.goto("/settings");
246+
await uiHelper.goToSettingsPage();
247247
await common.signOut();
248248
await context.clearCookies();
249249
});
@@ -340,7 +340,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
340340
timeout: 90 * 1000,
341341
});
342342

343-
await page.goto("/settings");
343+
await uiHelper.goToSettingsPage();
344344
await common.signOut();
345345

346346
await waitForNextSync("github", syncTime);
@@ -385,7 +385,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
385385
timeout: 60 * 1000,
386386
});
387387

388-
await page.goto("/settings");
388+
await uiHelper.goToSettingsPage();
389389
await common.signOut();
390390
await context.clearCookies();
391391
});
@@ -453,7 +453,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
453453
timeout: 30 * 1000,
454454
});
455455

456-
await page.goto("/settings");
456+
await uiHelper.goToSettingsPage();
457457
await common.signOut();
458458
await context.clearCookies();
459459
});
@@ -531,7 +531,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
531531
constants.GH_TEAMS["team_2"].name + "_renamed",
532532
);
533533

534-
await page.goto("/settings");
534+
await uiHelper.goToSettingsPage();
535535
// user should see the entities again
536536
await expect(async () => {
537537
await page.reload();
@@ -550,7 +550,7 @@ test.describe("Standard authentication providers: Github Provider", () => {
550550
constants.GH_TEAMS["team_2"].name + "_renamed",
551551
);
552552

553-
await page.goto("/settings");
553+
await uiHelper.goToSettingsPage();
554554
await common.signOut();
555555
await context.clearCookies();
556556
});

e2e-tests/playwright/e2e/authProviders/microsoft-provider.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
135135
timeout: 90 * 1000,
136136
});
137137

138-
await page.goto("/settings");
138+
await uiHelper.goToSettingsPage();
139139
await common.signOut();
140140
await context.clearCookies();
141141
});
@@ -342,7 +342,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
342342
timeout: 120 * 1000,
343343
});
344344

345-
await page.goto("/settings");
345+
await uiHelper.goToSettingsPage();
346346
await common.signOut();
347347
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
348348

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

398-
await page.goto("/settings");
398+
await uiHelper.goToSettingsPage();
399399
await common.signOut();
400400
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
401401
});
@@ -429,7 +429,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
429429
constants.RHSSO76_DEFAULT_PASSWORD,
430430
);
431431

432-
await page.goto("/settings");
432+
await uiHelper.goToSettingsPage();
433433
await common.signOut();
434434
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
435435

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

472-
await page.goto("/settings");
472+
await uiHelper.goToSettingsPage();
473473
await common.signOut();
474474
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
475475
});
@@ -531,7 +531,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
531531
constants.RHSSO76_DEFAULT_PASSWORD,
532532
);
533533

534-
await page.goto("/settings");
534+
await uiHelper.goToSettingsPage();
535535
await common.signOut();
536536
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
537537
});
@@ -566,7 +566,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
566566
constants.RHSSO76_DEFAULT_PASSWORD,
567567
);
568568

569-
await page.goto("/settings");
569+
await uiHelper.goToSettingsPage();
570570
await common.signOut();
571571
await context.clearCookies();
572572

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

658-
await page.goto("/settings");
658+
await uiHelper.goToSettingsPage();
659659
// user should see the entities again
660660
await expect(async () => {
661661
await page.reload();
@@ -674,7 +674,7 @@ test.describe("Standard authentication providers: Micorsoft Azure EntraID", () =
674674
constants.MSGRAPH_GROUPS["group_6"].displayName + "_renamed",
675675
);
676676

677-
await page.goto("/settings");
677+
await uiHelper.goToSettingsPage();
678678
await common.signOut();
679679
await context.clearCookies(); // If we don't clear cookies, Microsoft Login popup will present the last logger user
680680
});

e2e-tests/playwright/e2e/authProviders/rhsso-76-provider.spec.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ for (const version of ["RHBK"]) {
120120
constants.RHSSO76_USERS["user_1"].username,
121121
constants.RHSSO76_DEFAULT_PASSWORD,
122122
);
123-
await page.goto("/settings");
123+
await uiHelper.goToSettingsPage();
124124
await uiHelper.verifyHeading(
125125
await rhssoHelper.getRHSSOUserDisplayName(
126126
constants.RHSSO76_USERS["user_1"],
@@ -184,7 +184,7 @@ for (const version of ["RHBK"]) {
184184
constants.RHSSO76_USERS["user_1"].username,
185185
constants.RHSSO76_DEFAULT_PASSWORD,
186186
);
187-
await page.goto("/settings");
187+
await uiHelper.goToSettingsPage();
188188
await uiHelper.verifyHeading(
189189
await rhssoHelper.getRHSSOUserDisplayName(
190190
constants.RHSSO76_USERS["user_1"],
@@ -241,7 +241,7 @@ for (const version of ["RHBK"]) {
241241
constants.RHSSO76_USERS["user_1"].username,
242242
constants.RHSSO76_DEFAULT_PASSWORD,
243243
);
244-
await page.goto("/settings");
244+
await uiHelper.goToSettingsPage();
245245
await uiHelper.verifyHeading(
246246
rhssoHelper.getRHSSOUserDisplayName(constants.RHSSO76_USERS["user_1"]),
247247
);
@@ -252,7 +252,7 @@ for (const version of ["RHBK"]) {
252252
constants.RHSSO76_USERS["jenny_doe"].username,
253253
constants.RHSSO76_DEFAULT_PASSWORD,
254254
);
255-
await page.goto("/settings");
255+
await uiHelper.goToSettingsPage();
256256
await uiHelper.verifyHeading(
257257
rhssoHelper.getRHSSOUserDisplayName(
258258
constants.RHSSO76_USERS["jenny_doe"],
@@ -265,7 +265,7 @@ for (const version of ["RHBK"]) {
265265
constants.RHSSO76_USERS["user_2"].username,
266266
constants.RHSSO76_DEFAULT_PASSWORD,
267267
);
268-
await page.goto("/settings");
268+
await uiHelper.goToSettingsPage();
269269
await uiHelper.verifyHeading(
270270
rhssoHelper.getRHSSOUserDisplayName(constants.RHSSO76_USERS["user_2"]),
271271
);
@@ -445,7 +445,7 @@ for (const version of ["RHBK"]) {
445445
expect(statusBefore).toBe(403);
446446

447447
// logout
448-
await page.goto("/settings");
448+
await uiHelper.goToSettingsPage();
449449
await common.signOut();
450450
}).toPass({
451451
intervals: [1_000, 2_000, 5_000],
@@ -499,7 +499,7 @@ for (const version of ["RHBK"]) {
499499
timeout: 60 * 1000,
500500
});
501501

502-
await page.goto("/settings");
502+
await uiHelper.goToSettingsPage();
503503
await common.signOut();
504504
});
505505

@@ -518,7 +518,7 @@ for (const version of ["RHBK"]) {
518518
constants.RHSSO76_DEFAULT_PASSWORD,
519519
);
520520

521-
await page.goto("/settings");
521+
await uiHelper.goToSettingsPage();
522522
await common.signOut();
523523

524524
// group_4 should exist in rhdh
@@ -572,7 +572,7 @@ for (const version of ["RHBK"]) {
572572
timeout: 30 * 1000,
573573
});
574574

575-
await page.goto("/settings");
575+
await uiHelper.goToSettingsPage();
576576
await common.signOut();
577577
});
578578

@@ -626,7 +626,7 @@ for (const version of ["RHBK"]) {
626626
constants.RHSSO76_DEFAULT_PASSWORD,
627627
);
628628

629-
await page.goto("/settings");
629+
await uiHelper.goToSettingsPage();
630630
await common.signOut();
631631
});
632632

@@ -722,7 +722,7 @@ for (const version of ["RHBK"]) {
722722
constants.RHSSO76_GROUPS["group_2"].name + "_renamed",
723723
);
724724

725-
await page.goto("/settings");
725+
await uiHelper.goToSettingsPage();
726726
// user should see the entities again
727727
await expect(async () => {
728728
await page.reload();
@@ -742,7 +742,7 @@ for (const version of ["RHBK"]) {
742742
constants.RHSSO76_GROUPS["group_2"].name + "_renamed",
743743
);
744744

745-
await page.goto("/settings");
745+
await uiHelper.goToSettingsPage();
746746
await common.signOut();
747747
});
748748

0 commit comments

Comments
 (0)