Skip to content

Commit fe5a5fe

Browse files
feat(e2e): replace fixed waits with pollUntil and project timeouts
Centralize condition-based polling for K8s, log-follow, and login flows so tests fail fast instead of sleeping, and move per-spec timeouts into Playwright project config. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent c1b749b commit fe5a5fe

31 files changed

Lines changed: 406 additions & 342 deletions

e2e-tests/playwright.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export default defineConfig({
9696
},
9797
{
9898
name: PW_PROJECT.SHOWCASE,
99+
timeout: 180 * 1000,
99100
dependencies: [PW_PROJECT.SMOKE_TEST],
100101
testIgnore: [
101102
"**/playwright/seed.spec.ts",
@@ -119,6 +120,7 @@ export default defineConfig({
119120
},
120121
{
121122
name: PW_PROJECT.SHOWCASE_AUTH_PROVIDERS,
123+
timeout: 600 * 1000,
122124
testMatch: ["**/playwright/e2e/auth-providers/*.spec.ts"],
123125
testIgnore: [
124126
// temporarily disable github-happy-path
@@ -182,6 +184,7 @@ export default defineConfig({
182184
},
183185
{
184186
name: PW_PROJECT.SHOWCASE_RUNTIME_DB,
187+
timeout: 600 * 1000,
185188
workers: 1,
186189
testMatch: [
187190
"**/playwright/e2e/external-database/verify-tls-config-with-external-rds.spec.ts",
@@ -190,6 +193,7 @@ export default defineConfig({
190193
},
191194
{
192195
name: PW_PROJECT.SHOWCASE_RUNTIME,
196+
timeout: 900 * 1000,
193197
workers: 1,
194198
dependencies: [PW_PROJECT.SHOWCASE_RUNTIME_DB],
195199
testMatch: [

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
type EventSeverityLevel,
99
} from "./logs";
1010
import { getBackstageDeploySelector } from "../../utils/helper";
11+
import { sleep } from "../../utils/poll-until";
1112

1213
function formatError(error: unknown): string {
1314
if (error instanceof Error) {
@@ -252,9 +253,7 @@ export const LogUtils = {
252253
attempt++;
253254
if (attempt <= maxRetries) {
254255
console.log(`Waiting ${retryDelay / 1000} seconds before retrying...`);
255-
await new Promise<void>((resolve) => {
256-
setTimeout(resolve, retryDelay);
257-
});
256+
await sleep(retryDelay);
258257
}
259258
}
260259

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ test.describe("Configure Github Provider", async () => {
5353
description: "authentication",
5454
});
5555

56-
test.info().setTimeout(600 * 1000);
5756
// load default configs from yaml files
5857
await deployment.loadAllConfigs();
5958

@@ -139,7 +138,6 @@ test.describe("Configure Github Provider", async () => {
139138
});
140139

141140
test.beforeEach(() => {
142-
test.info().setTimeout(600 * 1000);
143141
console.log(
144142
`Running test case ${test.info().title} - Attempt #${test.info().retry}`,
145143
);
@@ -285,8 +283,6 @@ test.describe("Configure Github Provider", async () => {
285283
});
286284

287285
test(`Ingestion of Github users and groups: verify the user entities and groups are created with the correct relationships`, async () => {
288-
test.setTimeout(300 * 1000);
289-
290286
await expect
291287
.poll(
292288
() =>

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ test.describe("Configure GitLab Provider", async () => {
5555
description: "authentication",
5656
});
5757

58-
test.info().setTimeout(600 * 1000);
5958
// load default configs from yaml files
6059
await deployment.loadAllConfigs();
6160

@@ -152,7 +151,6 @@ test.describe("Configure GitLab Provider", async () => {
152151
});
153152

154153
test.beforeEach(() => {
155-
test.info().setTimeout(60 * 1000);
156154
console.log(
157155
`Running test case ${test.info().title} - Attempt #${test.info().retry}`,
158156
);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ test.describe("Configure LDAP Provider", () => {
4949
description: "authentication",
5050
});
5151

52-
test.info().setTimeout(600 * 1000);
5352
// load default configs from yaml files
5453
await deployment.loadAllConfigs();
5554

@@ -222,7 +221,6 @@ test.describe("Configure LDAP Provider", () => {
222221
});
223222

224223
test.beforeEach(() => {
225-
test.info().setTimeout(600 * 1000);
226224
console.log(
227225
`Running test case ${test.info().title} - Attempt #${test.info().retry}`,
228226
);

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ test.describe("Configure Microsoft Provider", async () => {
5454
description: "authentication",
5555
});
5656

57-
test.info().setTimeout(600 * 1000);
5857
// load default configs from yaml files
5958
await deployment.loadAllConfigs();
6059

@@ -155,7 +154,6 @@ test.describe("Configure Microsoft Provider", async () => {
155154
});
156155

157156
test.beforeEach(() => {
158-
test.info().setTimeout(600 * 1000);
159157
console.log(
160158
`Running test case ${test.info().title} - Attempt #${test.info().retry}`,
161159
);
@@ -317,8 +315,6 @@ test.describe("Configure Microsoft Provider", async () => {
317315
});
318316

319317
test(`Ingestion of Microsoft users and groups: verify the user entities and groups are created with the correct relationships`, async () => {
320-
test.setTimeout(300 * 1000);
321-
322318
await expect
323319
.poll(
324320
() =>

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ test.describe("Configure OIDC provider (using RHBK)", async () => {
6363
description: "authentication",
6464
});
6565

66-
test.info().setTimeout(600 * 1000);
6766
// load default configs from yaml files
6867
await deployment.loadAllConfigs();
6968
// setup playwright helpers
@@ -152,7 +151,6 @@ test.describe("Configure OIDC provider (using RHBK)", async () => {
152151
});
153152

154153
test.beforeEach(() => {
155-
test.info().setTimeout(600 * 1000);
156154
console.log(
157155
`Running test case ${test.info().title} - Attempt #${test.info().retry}`,
158156
);

e2e-tests/playwright/e2e/configuration-test/config-map.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ test.describe("Change app-config at e2e test runtime", () => {
1818
});
1919

2020
test("Verify title change after ConfigMap modification", async ({ page }) => {
21-
test.setTimeout(300000);
22-
2321
const configMapName = "app-config-rhdh";
2422

2523
const namespace = process.env.NAME_SPACE_RUNTIME ?? "showcase-runtime";

e2e-tests/playwright/e2e/external-database/verify-tls-config-with-external-azure-db.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ test.describe("Verify TLS configuration with Azure Database for PostgreSQL healt
7171
for (const config of azureConfigurations) {
7272
test.describe.serial(`Azure DB ${config.name} PostgreSQL version`, () => {
7373
test.beforeAll(async () => {
74-
test.setTimeout(180000);
7574
test.info().annotations.push({
7675
type: "database",
7776
description: config.host?.split(".")[0] || "unknown",
@@ -86,7 +85,6 @@ test.describe("Verify TLS configuration with Azure Database for PostgreSQL healt
8685

8786
test("Configure and restart deployment", async () => {
8887
const kubeClient = new KubeClient();
89-
test.setTimeout(600000);
9088
await configurePostgresCredentials(kubeClient, namespace, {
9189
host: config.host,
9290
user: azureUser,

e2e-tests/playwright/e2e/external-database/verify-tls-config-with-external-rds.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ test.describe("Verify TLS configuration with RDS PostgreSQL health check", () =>
6767
for (const config of rdsConfigurations) {
6868
test.describe.serial(`RDS ${config.name} PostgreSQL version`, () => {
6969
test.beforeAll(async () => {
70-
test.setTimeout(135000);
7170
test.info().annotations.push({
7271
type: "database",
7372
description: config.host?.split(".")[0] || "unknown",
@@ -82,7 +81,6 @@ test.describe("Verify TLS configuration with RDS PostgreSQL health check", () =>
8281

8382
test("Configure and restart deployment", async () => {
8483
const kubeClient = new KubeClient();
85-
test.setTimeout(600000);
8684
await configurePostgresCredentials(kubeClient, namespace, {
8785
host: config.host,
8886
user: rdsUser,

0 commit comments

Comments
 (0)