Skip to content

Commit 83cc9a1

Browse files
authored
chore(e2e): fix Kubernetes Actions plugin by adding wait (#3226) (#3245)
* chore(e2e): fix Kubernetes Actions plugin by adding wait (#3226) * Fix indentation * Use playwright wait
1 parent 542f03b commit 83cc9a1

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

e2e-tests/playwright/e2e/plugins/kubernetes-actions/kubernetes-actions.spec.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { UIhelper } from "../../../utils/ui-helper";
44
import { KubeClient } from "../../../utils/kube-client";
55
import { UI_HELPER_ELEMENTS } from "../../../support/pageObjects/global-obj";
66

7-
test.describe.skip("Test Kubernetes Actions plugin", () => {
7+
test.describe("Test Kubernetes Actions plugin", () => {
88
let common: Common;
99
let uiHelper: UIhelper;
1010
let page: Page;
@@ -17,11 +17,24 @@ test.describe.skip("Test Kubernetes Actions plugin", () => {
1717
uiHelper = new UIhelper(page);
1818
kubeClient = new KubeClient();
1919

20+
test.setTimeout(testInfo.timeout + 6500);
21+
2022
await common.loginAsGuest();
2123
await uiHelper.clickLink({ ariaLabel: "Self-service" });
2224
});
2325

24-
//TODO https://issues.redhat.com/browse/RHDHBUGS-1912
26+
// eslint-disable-next-line no-empty-pattern
27+
test.beforeEach(async ({}, testInfo) => {
28+
// Add cool-down period before retries (except on first attempt)
29+
if (testInfo.retry > 0) {
30+
const coolDownMs = 2000;
31+
console.log(
32+
`Attempt ${testInfo.retry + 1} failed, waiting ${coolDownMs}ms before retry...`,
33+
);
34+
await page.waitForTimeout(coolDownMs);
35+
}
36+
});
37+
2538
test("Creates kubernetes namespace", async () => {
2639
namespace = `test-kubernetes-actions-${Date.now()}`;
2740
await uiHelper.verifyHeading("Self-service");
@@ -32,11 +45,15 @@ test.describe.skip("Test Kubernetes Actions plugin", () => {
3245
await uiHelper.fillTextInputByLabel("Url", process.env.K8S_CLUSTER_URL);
3346
await uiHelper.fillTextInputByLabel("Token", process.env.K8S_CLUSTER_TOKEN);
3447
await uiHelper.checkCheckbox("Skip TLS verification");
48+
await page.waitForTimeout(2000);
3549
await uiHelper.clickButton("Review");
50+
await page.waitForTimeout(1500);
3651
await uiHelper.clickButton("Create");
52+
await page.waitForTimeout(1500);
3753
await page.waitForSelector(
3854
`${UI_HELPER_ELEMENTS.MuiTypography}:has-text("second")`,
3955
);
56+
await page.waitForTimeout(1500);
4057
await expect(
4158
page.locator(`${UI_HELPER_ELEMENTS.MuiTypography}:has-text("Error")`),
4259
).not.toBeVisible();

e2e-tests/playwright/utils/common.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ export class Common {
292292
await popup
293293
.locator("[type='submit'][value='Sign in']:not(webauthn-status *)")
294294
.first()
295-
.click({ timeout: 5000 }); const twofactorcode = authenticator.generate(twofactor);
295+
.click({ timeout: 5000 });
296+
const twofactorcode = authenticator.generate(twofactor);
296297
await popup.locator("#app_totp").click({ timeout: 5000 });
297298
await popup.locator("#app_totp").fill(twofactorcode, { timeout: 5000 });
298299

0 commit comments

Comments
 (0)