Skip to content

Commit 647a166

Browse files
chore(e2e): reformat after pedantic rebase onto Oxfmt defaults
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f585c82 commit 647a166

65 files changed

Lines changed: 735 additions & 2158 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

e2e-tests/oxlint.config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ export default defineConfig({
102102
// Facade modules aggregate many submodules by design (e.g. KubeClient re-exports,
103103
// rhdh-deployment orchestration, locale translation maps). A flat import count
104104
// does not reflect coupling when each import is a focused submodule.
105-
files: [
106-
"playwright/utils/**/*.ts",
107-
"playwright/e2e/localization/**/*.ts",
108-
],
105+
files: ["playwright/utils/**/*.ts", "playwright/e2e/localization/**/*.ts"],
109106
rules: {
110107
"import/max-dependencies": "off",
111108
},

e2e-tests/playwright/data/rbac-constants-roles.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ export const EXPECTED_ROLES: Role[] = [
2626
name: "role:default/qe_rbac_admin",
2727
},
2828
{
29-
memberReferences: [
30-
"group:default/rhdh-qe-parent-team",
31-
"group:default/rhdh-qe-child-team",
32-
],
29+
memberReferences: ["group:default/rhdh-qe-parent-team", "group:default/rhdh-qe-child-team"],
3330
name: "role:default/transitive-owner",
3431
},
3532
{

e2e-tests/playwright/e2e/audit-log/log-utils.ts

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import { expect } from "@playwright/test";
21
import { execFile, exec } from "child_process";
2+
33
import { type JsonObject } from "@backstage/types";
4-
import {
5-
Log,
6-
type LogRequest,
7-
type EventStatus,
8-
type EventSeverityLevel,
9-
} from "./logs";
4+
import { expect } from "@playwright/test";
5+
106
import { getBackstageDeploySelector } from "../../utils/helper";
7+
import { Log, type LogRequest, type EventStatus, type EventSeverityLevel } from "./logs";
118

129
function formatError(error: unknown): string {
1310
if (error instanceof Error) {
@@ -138,10 +135,7 @@ export const LogUtils = {
138135
console.log(`Command executed successfully on attempt ${attempt + 1}`);
139136
return output;
140137
} catch (error) {
141-
console.error(
142-
`Error executing command on attempt ${attempt + 1}:`,
143-
error,
144-
);
138+
console.error(`Error executing command on attempt ${attempt + 1}:`, error);
145139
attempt++;
146140
}
147141
}
@@ -181,10 +175,9 @@ export const LogUtils = {
181175
return await LogUtils.executeCommand("oc", args);
182176
} catch (error) {
183177
console.error("Error listing pods:", error);
184-
throw new Error(
185-
`Failed to list pods in namespace "${namespace}": ${formatError(error)}`,
186-
{ cause: error },
187-
);
178+
throw new Error(`Failed to list pods in namespace "${namespace}": ${formatError(error)}`, {
179+
cause: error,
180+
});
188181
}
189182
},
190183

@@ -226,14 +219,10 @@ export const LogUtils = {
226219
let attempt = 0;
227220
while (attempt <= maxRetries) {
228221
try {
229-
console.log(
230-
`Attempt ${attempt + 1}/${maxRetries + 1}: Fetching logs with grep...`,
231-
);
222+
console.log(`Attempt ${attempt + 1}/${maxRetries + 1}: Fetching logs with grep...`);
232223
const output = await LogUtils.executeShellCommand(grepCommand);
233224

234-
const logLines = output
235-
.split("\n")
236-
.filter((line) => line.trim() !== "");
225+
const logLines = output.split("\n").filter((line) => line.trim() !== "");
237226
if (logLines.length > 0) {
238227
console.log("Matching log line found:", logLines[0]);
239228
return logLines[0];
@@ -243,10 +232,7 @@ export const LogUtils = {
243232
`No matching logs found for filter ${JSON.stringify(filterWords)} on attempt ${attempt + 1}. Retrying...`,
244233
);
245234
} catch (error) {
246-
console.error(
247-
`Error fetching logs on attempt ${attempt + 1}:`,
248-
formatError(error),
249-
);
235+
console.error(`Error fetching logs on attempt ${attempt + 1}:`, formatError(error));
250236
}
251237

252238
attempt++;
@@ -271,9 +257,7 @@ export const LogUtils = {
271257
const server = process.env.K8S_CLUSTER_URL ?? "";
272258

273259
if (token === "" || server === "") {
274-
throw new Error(
275-
"Environment variables K8S_CLUSTER_TOKEN and K8S_CLUSTER_URL must be set.",
276-
);
260+
throw new Error("Environment variables K8S_CLUSTER_TOKEN and K8S_CLUSTER_URL must be set.");
277261
}
278262

279263
const command = "oc";
@@ -316,22 +300,16 @@ export const LogUtils = {
316300
filterWordsAll.push(request.url);
317301
}
318302
try {
319-
const actualLog = await LogUtils.getPodLogsWithGrep(
320-
filterWordsAll,
321-
namespace,
322-
);
303+
const actualLog = await LogUtils.getPodLogsWithGrep(filterWordsAll, namespace);
323304

324305
let parsedLog: Log;
325306
try {
326307
parsedLog = parseLogFromJson(actualLog);
327308
} catch (parseError) {
328309
console.error("Failed to parse log JSON. Log content:", actualLog);
329-
throw new Error(
330-
`Invalid JSON received for log: ${formatError(parseError)}`,
331-
{
332-
cause: parseError,
333-
},
334-
);
310+
throw new Error(`Invalid JSON received for log: ${formatError(parseError)}`, {
311+
cause: parseError,
312+
});
335313
}
336314

337315
const expectedLog: Partial<Log> = {

e2e-tests/playwright/e2e/auth-providers/github.spec.ts

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { test, expect, Page, BrowserContext } from "@support/coverage/test";
2+
23
import RHDHDeployment from "../../utils/authentication-providers/rhdh-deployment";
34
import { Common, setupBrowser } from "../../utils/common";
4-
import { UIhelper } from "../../utils/ui-helper";
55
import { NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE } from "../../utils/constants";
6+
import { UIhelper } from "../../utils/ui-helper";
67
let page: Page;
78
let context: BrowserContext;
89

@@ -133,9 +134,7 @@ test.describe("Configure Github Provider", async () => {
133134

134135
test.beforeEach(() => {
135136
test.info().setTimeout(600 * 1000);
136-
console.log(
137-
`Running test case ${test.info().title} - Attempt #${test.info().retry}`,
138-
);
137+
console.log(`Running test case ${test.info().title} - Attempt #${test.info().retry}`);
139138
});
140139

141140
test("Login with Github default resolver", async () => {
@@ -178,10 +177,7 @@ test.describe("Configure Github Provider", async () => {
178177

179178
test("Login with Github emailMatchingUserEntityProfileEmail resolver", async () => {
180179
//A common sign-in resolver that looks up the user using the local part of their email address as the entity name.
181-
await deployment.setGithubResolver(
182-
"emailMatchingUserEntityProfileEmail",
183-
false,
184-
);
180+
await deployment.setGithubResolver("emailMatchingUserEntityProfileEmail", false);
185181
await deployment.updateAllConfigs();
186182
await deployment.restartLocalDeployment();
187183
await deployment.waitForConfigReconciled();
@@ -197,18 +193,13 @@ test.describe("Configure Github Provider", async () => {
197193
);
198194
expect(login).toBe("Login successful");
199195

200-
await uiHelper.verifyAlertErrorMessage(
201-
NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE,
202-
);
196+
await uiHelper.verifyAlertErrorMessage(NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE);
203197
await context.clearCookies();
204198
});
205199

206200
test("Login with Github emailLocalPartMatchingUserEntityName resolver", async () => {
207201
//A common sign-in resolver that looks up the user using the local part of their email address as the entity name.
208-
await deployment.setGithubResolver(
209-
"emailLocalPartMatchingUserEntityName",
210-
false,
211-
);
202+
await deployment.setGithubResolver("emailLocalPartMatchingUserEntityName", false);
212203
await deployment.updateAllConfigs();
213204
await deployment.restartLocalDeployment();
214205
await deployment.waitForConfigReconciled();
@@ -227,17 +218,12 @@ test.describe("Configure Github Provider", async () => {
227218

228219
expect(login).toBe("Login successful");
229220

230-
await uiHelper.verifyAlertErrorMessage(
231-
NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE,
232-
);
221+
await uiHelper.verifyAlertErrorMessage(NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE);
233222
await context.clearCookies();
234223
});
235224

236225
test(`Set Github sessionDuration and confirm in auth cookie duration has been set`, async () => {
237-
deployment.setAppConfigProperty(
238-
"auth.providers.github.production.sessionDuration",
239-
"3days",
240-
);
226+
deployment.setAppConfigProperty("auth.providers.github.production.sessionDuration", "3days");
241227
await deployment.updateAllConfigs();
242228
await deployment.restartLocalDeployment();
243229
await deployment.waitForConfigReconciled();
@@ -256,9 +242,7 @@ test.describe("Configure Github Provider", async () => {
256242
await page.reload();
257243

258244
const cookies = await context.cookies();
259-
const authCookie = cookies.find(
260-
(cookie) => cookie.name === "github-refresh-token",
261-
);
245+
const authCookie = cookies.find((cookie) => cookie.name === "github-refresh-token");
262246
expect(authCookie).toBeDefined();
263247

264248
// expected duration of 3 days in ms
@@ -281,35 +265,18 @@ test.describe("Configure Github Provider", async () => {
281265
test.setTimeout(300 * 1000);
282266

283267
await expect
284-
.poll(
285-
() =>
286-
deployment.checkUserIsIngestedInCatalog([
287-
"RHDH QE User 1",
288-
"RHDH QE Admin",
289-
]),
290-
{ timeout: 120_000 },
291-
)
268+
.poll(() => deployment.checkUserIsIngestedInCatalog(["RHDH QE User 1", "RHDH QE Admin"]), {
269+
timeout: 120_000,
270+
})
292271
.toBe(true);
293272
expect(
294-
await deployment.checkGroupIsIngestedInCatalog([
295-
"test_admins",
296-
"test_all",
297-
"test_users",
298-
]),
299-
).toBe(true);
300-
expect(
301-
await deployment.checkUserIsInGroup("rhdhqeauthadmin", "test_admins"),
302-
).toBe(true);
303-
expect(
304-
await deployment.checkUserIsInGroup("rhdhqeauth1", "test_users"),
273+
await deployment.checkGroupIsIngestedInCatalog(["test_admins", "test_all", "test_users"]),
305274
).toBe(true);
275+
expect(await deployment.checkUserIsInGroup("rhdhqeauthadmin", "test_admins")).toBe(true);
276+
expect(await deployment.checkUserIsInGroup("rhdhqeauth1", "test_users")).toBe(true);
306277

307-
expect(
308-
await deployment.checkGroupIsChildOfGroup("test_users", "test_all"),
309-
).toBe(true);
310-
expect(
311-
await deployment.checkGroupIsChildOfGroup("test_admins", "test_all"),
312-
).toBe(true);
278+
expect(await deployment.checkGroupIsChildOfGroup("test_users", "test_all")).toBe(true);
279+
expect(await deployment.checkGroupIsChildOfGroup("test_admins", "test_all")).toBe(true);
313280

314281
expect(
315282
await deployment.checkUserHasAnnotation(
@@ -319,11 +286,7 @@ test.describe("Configure Github Provider", async () => {
319286
),
320287
).toBe(true);
321288
expect(
322-
await deployment.checkUserHasAnnotation(
323-
"rhdhqeauth1",
324-
"MY_CUSTOM_ANNOTATION",
325-
"rhdhqeauth1",
326-
),
289+
await deployment.checkUserHasAnnotation("rhdhqeauth1", "MY_CUSTOM_ANNOTATION", "rhdhqeauth1"),
327290
).toBe(true);
328291
});
329292

0 commit comments

Comments
 (0)