Skip to content

Commit b499d8d

Browse files
refactor(e2e): restore helper-based assertions from oxlint burn-down
Await whitelisted POM helpers directly instead of expect().resolves.toBeUndefined(), revert inline locators to uiHelper.verify* where helpers encode strictness, and drop redundant post-YAML expects covered by inspectEntityAndVerifyYaml. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d58ca2a commit b499d8d

4 files changed

Lines changed: 73 additions & 122 deletions

File tree

e2e-tests/oxlint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export default defineConfig({
9494
"verifyQuickAccess",
9595
"verifyLink",
9696
"verifyRowsInTable",
97+
"verifyRowInTableByUniqueText",
9798
"verifyDivHasText",
9899
"verifyComponentInCatalog",
99100
"verifyParagraph",
@@ -105,6 +106,8 @@ export default defineConfig({
105106
"verifyPRRows",
106107
"verifyPRRowsPerPage",
107108
"registerExistingComponent",
109+
"inspectEntityAndVerifyYaml",
110+
"runAccessibilityTests",
108111
"validateLog",
109112
"validateLogEvent",
110113
"validateRbacLogEvent",

e2e-tests/playwright/e2e/audit-log/auditor-rbac.spec.ts

Lines changed: 54 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,12 @@ test.describe("Auditor check for RBAC Plugin", () => {
6161
for (const s of roleRead) {
6262
test(`role-read → ${s.name}`, async () => {
6363
await s.call();
64-
await expect(
65-
validateRbacLogEvent(
66-
"role-read",
67-
USER_ENTITY_REF,
68-
{ method: "GET", url: s.url },
69-
s.meta,
70-
),
71-
).resolves.toBeUndefined();
64+
await validateRbacLogEvent(
65+
"role-read",
66+
USER_ENTITY_REF,
67+
{ method: "GET", url: s.url },
68+
s.meta,
69+
);
7270
});
7371
}
7472

@@ -99,16 +97,14 @@ test.describe("Auditor check for RBAC Plugin", () => {
9997
for (const s of roleWrite) {
10098
test(`role-write → ${s.name}`, async () => {
10199
await s.call();
102-
await expect(
103-
validateRbacLogEvent(
104-
"role-write",
105-
USER_ENTITY_REF,
106-
{ method: httpMethod(s.action), url: s.url },
107-
{ actionType: s.action, source: "rest" },
108-
buildNotAllowedError(s.action, "role"),
109-
"failed",
110-
),
111-
).resolves.toBeUndefined();
100+
await validateRbacLogEvent(
101+
"role-write",
102+
USER_ENTITY_REF,
103+
{ method: httpMethod(s.action), url: s.url },
104+
{ actionType: s.action, source: "rest" },
105+
buildNotAllowedError(s.action, "role"),
106+
"failed",
107+
);
112108
});
113109
}
114110

@@ -153,14 +149,12 @@ test.describe("Auditor check for RBAC Plugin", () => {
153149
for (const s of policyRead) {
154150
test(`policy-read → ${s.name}`, async () => {
155151
await s.call();
156-
await expect(
157-
validateRbacLogEvent(
158-
"policy-read",
159-
USER_ENTITY_REF,
160-
{ method: "GET", url: s.url },
161-
s.meta,
162-
),
163-
).resolves.toBeUndefined();
152+
await validateRbacLogEvent(
153+
"policy-read",
154+
USER_ENTITY_REF,
155+
{ method: "GET", url: s.url },
156+
s.meta,
157+
);
164158
});
165159
}
166160

@@ -196,20 +190,18 @@ test.describe("Auditor check for RBAC Plugin", () => {
196190
for (const s of policyWrite) {
197191
test(`policy-write → ${s.name}`, async () => {
198192
await s.call();
199-
await expect(
200-
validateRbacLogEvent(
201-
"policy-write",
202-
USER_ENTITY_REF,
203-
{ method: httpMethod(s.action), url: s.url },
204-
{ actionType: s.action, source: "rest" },
205-
buildNotAllowedError(
206-
s.action,
207-
"policy",
208-
`${ROLE_NAME},policy-entity,read,allow`,
209-
),
210-
"failed",
193+
await validateRbacLogEvent(
194+
"policy-write",
195+
USER_ENTITY_REF,
196+
{ method: httpMethod(s.action), url: s.url },
197+
{ actionType: s.action, source: "rest" },
198+
buildNotAllowedError(
199+
s.action,
200+
"policy",
201+
`${ROLE_NAME},policy-entity,read,allow`,
211202
),
212-
).resolves.toBeUndefined();
203+
"failed",
204+
);
213205
});
214206
}
215207

@@ -263,16 +255,14 @@ test.describe("Auditor check for RBAC Plugin", () => {
263255
const response = await s.call();
264256
expect(s.acceptedStatuses).toContain(response.status());
265257
const status = auditStatus(response.ok());
266-
await expect(
267-
validateRbacLogEvent(
268-
"condition-read",
269-
USER_ENTITY_REF,
270-
{ method: "GET", url: s.url },
271-
s.meta,
272-
undefined,
273-
status,
274-
),
275-
).resolves.toBeUndefined();
258+
await validateRbacLogEvent(
259+
"condition-read",
260+
USER_ENTITY_REF,
261+
{ method: "GET", url: s.url },
262+
s.meta,
263+
undefined,
264+
status,
265+
);
276266
});
277267
}
278268

@@ -281,23 +271,21 @@ test.describe("Auditor check for RBAC Plugin", () => {
281271
/* --------------------------------------------------------------------- */
282272
test("permission-evaluation", async () => {
283273
await rbacApi.getRoles();
284-
await expect(
285-
validateRbacLogEvent(
286-
"permission-evaluation",
287-
PLUGIN_ACTOR_ID,
288-
undefined,
289-
{
290-
action: "read",
291-
permissionName: "policy.entity.read",
292-
resourceType: "policy-entity",
293-
result: "ALLOW",
294-
userEntityRef: USER_ENTITY_REF,
295-
},
296-
undefined,
297-
"succeeded",
298-
["policy.entity.read", USER_ENTITY_REF],
299-
),
300-
).resolves.toBeUndefined();
274+
await validateRbacLogEvent(
275+
"permission-evaluation",
276+
PLUGIN_ACTOR_ID,
277+
undefined,
278+
{
279+
action: "read",
280+
permissionName: "policy.entity.read",
281+
resourceType: "policy-entity",
282+
result: "ALLOW",
283+
userEntityRef: USER_ENTITY_REF,
284+
},
285+
undefined,
286+
"succeeded",
287+
["policy.entity.read", USER_ENTITY_REF],
288+
);
301289
});
302290

303291
test.afterAll(async ({}, testInfo) => {

e2e-tests/playwright/e2e/github-happy-path.spec.ts

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,8 @@ test.describe.fixme("GitHub Happy path", () => {
9191

9292
test("Verify Profile is Github Account Name in the Settings page", async () => {
9393
await uiHelper.goToSettingsPage();
94-
await expect(
95-
page.getByRole("heading", { name: process.env.GH_USER2_ID! }),
96-
).toBeVisible();
97-
await expect(
98-
page.getByRole("heading", {
99-
name: `User Entity: ${process.env.GH_USER2_ID!}`,
100-
}),
101-
).toBeVisible();
94+
await uiHelper.verifyHeading(process.env.GH_USER2_ID!);
95+
await uiHelper.verifyHeading(`User Entity: ${process.env.GH_USER2_ID!}`);
10296
});
10397

10498
test("Import an existing Git repository", async () => {
@@ -107,9 +101,6 @@ test.describe.fixme("GitHub Happy path", () => {
107101
await uiHelper.clickButton("Self-service");
108102
await uiHelper.clickButton("Import an existing Git repository");
109103
await catalogImport.registerExistingComponent(component);
110-
await expect(
111-
page.getByRole("button", { name: "Self-service" }),
112-
).toBeVisible();
113104
});
114105

115106
test("Verify that the following components were ingested into the Catalog", async () => {
@@ -135,9 +126,6 @@ test.describe.fixme("GitHub Happy path", () => {
135126
await uiHelper.selectMuiBox("Kind", "User");
136127
await uiHelper.searchInputPlaceholder("rhdh");
137128
await uiHelper.verifyRowsInTable(["rhdh-qe rhdh-qe"]);
138-
await expect(
139-
page.getByRole("cell", { name: "rhdh-qe rhdh-qe" }),
140-
).toBeVisible();
141129
});
142130

143131
test("Verify all 12 Software Templates appear in the Create page", async () => {
@@ -146,9 +134,7 @@ test.describe.fixme("GitHub Happy path", () => {
146134

147135
for (const template of TEMPLATES) {
148136
await uiHelper.waitForTitle(template, 4);
149-
await expect(
150-
page.getByRole("heading", { name: template, exact: true }),
151-
).toBeVisible();
137+
await uiHelper.verifyHeading(template);
152138
}
153139
});
154140

@@ -179,9 +165,7 @@ test.describe.fixme("GitHub Happy path", () => {
179165
test("Verify that the Pull/Merge Requests tab renders the 5 most recently updated Open Pull Requests", async () => {
180166
await uiHelper.clickTab("Pull/Merge Requests");
181167
const openPRs = await getShowcasePullRequests("open");
182-
await expect(
183-
backstageShowcase.verifyPRRows(openPRs, 0, 5),
184-
).resolves.toBeUndefined();
168+
await backstageShowcase.verifyPRRows(openPRs, 0, 5);
185169
});
186170

187171
test("Click on the CLOSED filter and verify that the 5 most recently updated Closed PRs are rendered (same with ALL)", async () => {
@@ -192,9 +176,7 @@ test.describe.fixme("GitHub Happy path", () => {
192176
await closedButton.click();
193177
const closedPRs = await getShowcasePullRequests("closed");
194178
await common.waitForLoad();
195-
await expect(
196-
backstageShowcase.verifyPRRows(closedPRs, 0, 5),
197-
).resolves.toBeUndefined();
179+
await backstageShowcase.verifyPRRows(closedPRs, 0, 5);
198180
});
199181

200182
test("Click on the arrows to verify that the next/previous/first/last pages of PRs are loaded", async () => {
@@ -207,31 +189,27 @@ test.describe.fixme("GitHub Happy path", () => {
207189
await expect(allButton).toBeVisible();
208190
await expect(allButton).toBeEnabled();
209191
await allButton.click();
210-
await expect(
211-
backstageShowcase.verifyPRRows(allPRs, 0, 5),
212-
).resolves.toBeUndefined();
192+
await backstageShowcase.verifyPRRows(allPRs, 0, 5);
213193

214194
console.log("Clicking on Next Page button");
215195
await backstageShowcase.clickNextPage();
216-
await expect(
217-
backstageShowcase.verifyPRRows(allPRs, 5, 10),
218-
).resolves.toBeUndefined();
196+
await backstageShowcase.verifyPRRows(allPRs, 5, 10);
219197

220198
// const lastPagePRs = Math.floor((allPRs.length - 1) / 5) * 5;
221199
const lastPagePRs = 996; // redhat-developer/rhdh have more than 1000 PRs open/closed and by default the latest 1000 PR results are displayed.
222200

223201
console.log("Clicking on Last Page button");
224202
await backstageShowcase.clickLastPage();
225-
await expect(
226-
backstageShowcase.verifyPRRows(allPRs, lastPagePRs, 1000),
227-
).resolves.toBeUndefined();
203+
await backstageShowcase.verifyPRRows(allPRs, lastPagePRs, 1000);
228204

229205
console.log("Clicking on Previous Page button");
230206
await backstageShowcase.clickPreviousPage();
231207
await common.waitForLoad();
232-
await expect(
233-
backstageShowcase.verifyPRRows(allPRs, lastPagePRs - 5, lastPagePRs - 1),
234-
).resolves.toBeUndefined();
208+
await backstageShowcase.verifyPRRows(
209+
allPRs,
210+
lastPagePRs - 5,
211+
lastPagePRs - 1,
212+
);
235213
});
236214

237215
test("Verify that the 5, 10, 20 items per page option properly displays the correct number of PRs", async () => {
@@ -240,15 +218,9 @@ test.describe.fixme("GitHub Happy path", () => {
240218
await common.clickOnGHloginPopup();
241219
await uiHelper.clickTab("Pull/Merge Requests");
242220
const allPRs = await getShowcasePullRequests("open");
243-
await expect(
244-
backstageShowcase.verifyPRRowsPerPage(5, allPRs),
245-
).resolves.toBeUndefined();
246-
await expect(
247-
backstageShowcase.verifyPRRowsPerPage(10, allPRs),
248-
).resolves.toBeUndefined();
249-
await expect(
250-
backstageShowcase.verifyPRRowsPerPage(20, allPRs),
251-
).resolves.toBeUndefined();
221+
await backstageShowcase.verifyPRRowsPerPage(5, allPRs);
222+
await backstageShowcase.verifyPRRowsPerPage(10, allPRs);
223+
await backstageShowcase.verifyPRRowsPerPage(20, allPRs);
252224
});
253225

254226
// TODO: https://issues.redhat.com/browse/RHDHBUGS-2099

e2e-tests/playwright/e2e/plugins/scaffolder-backend-module-annotator/annotator.spec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ test.describe.serial("Test Scaffolder Backend Module Annotator", () => {
129129
await catalogImport.inspectEntityAndVerifyYaml(
130130
`labels:\n custom: ${reactAppDetails.label}\n`,
131131
);
132-
await expect(
133-
page.getByRole("link", { name: reactAppDetails.componentName }),
134-
).toBeVisible();
135132
});
136133

137134
test("Verify custom annotation is added to scaffolded component", async () => {
@@ -146,9 +143,6 @@ test.describe.serial("Test Scaffolder Backend Module Annotator", () => {
146143
await catalogImport.inspectEntityAndVerifyYaml(
147144
`custom.io/annotation: ${reactAppDetails.annotation}`,
148145
);
149-
await expect(
150-
page.getByRole("link", { name: reactAppDetails.componentName }),
151-
).toBeVisible();
152146
});
153147

154148
test("Verify template version annotation is added to scaffolded component", async () => {
@@ -163,9 +157,6 @@ test.describe.serial("Test Scaffolder Backend Module Annotator", () => {
163157
await catalogImport.inspectEntityAndVerifyYaml(
164158
`backstage.io/template-version: 0.0.1`,
165159
);
166-
await expect(
167-
page.getByRole("link", { name: reactAppDetails.componentName }),
168-
).toBeVisible();
169160
});
170161

171162
test("Verify template version annotation is present on the template", async () => {
@@ -181,9 +172,6 @@ test.describe.serial("Test Scaffolder Backend Module Annotator", () => {
181172
await catalogImport.inspectEntityAndVerifyYaml(
182173
`backstage.io/template-version: 0.0.1`,
183174
);
184-
await expect(
185-
page.getByRole("link", { name: "Create React App Template" }),
186-
).toBeVisible();
187175
});
188176

189177
test.afterAll(async ({}, testInfo) => {

0 commit comments

Comments
 (0)