diff --git a/ui/tests/providers/providers-page.ts b/ui/tests/providers/providers-page.ts index 2782c53106..256812fc05 100644 --- a/ui/tests/providers/providers-page.ts +++ b/ui/tests/providers/providers-page.ts @@ -940,62 +940,24 @@ export class ProvidersPage extends BasePage { const isWizardVisible = await this.wizardModal .isVisible() .catch(() => false); - const wizardText = isWizardVisible - ? await this.wizardModal.innerText().catch(() => "") - : ""; - const visibleButtons = isWizardVisible - ? await this.wizardModal - .getByRole("button") - .allTextContents() - .catch(() => []) - : []; - const wizardHtml = isWizardVisible - ? await this.wizardModal.innerHTML().catch(() => "") - : ""; + if (!isWizardVisible) { + return "Wizard visible: false"; + } + const wizardText = await this.wizardModal + .innerText() + .catch(() => ""); + const visibleButtons = await this.wizardModal + .getByRole("button") + .allTextContents() + .catch(() => []); return [ - `Wizard visible: ${isWizardVisible}`, + "Wizard visible: true", `Visible button text: ${visibleButtons.map((text) => text.trim()).join(" | ") || ""}`, `Wizard text:\n${wizardText.trim() || ""}`, - `Wizard HTML (first 6000 chars):\n${wizardHtml.slice(0, 6000)}`, ].join("\n\n"); } - private async waitForProviderReadyToClose(timeout = 30000): Promise { - const launchStepReady = this.page - .getByText("Account Connected!", { exact: true }) - .or(this.page.getByText("Loading scan options...", { exact: true })) - .or(this.page.getByRole("button", { name: "Save", exact: true })) - .or(this.page.getByRole("button", { name: "Launch scan", exact: true })) - .first(); - const connectionError = this.page.locator( - "div.border-border-error p.text-text-error-primary", - ); - - try { - await Promise.race([ - launchStepReady.waitFor({ state: "visible", timeout }), - this.wizardModal.waitFor({ state: "hidden", timeout }), - connectionError.waitFor({ state: "visible", timeout }), - ]); - } catch { - // Continue and inspect visible state below. - } - - if (await connectionError.isVisible().catch(() => false)) { - const errorText = await connectionError.textContent(); - throw new Error( - `Test connection failed with error: ${errorText?.trim() || "Unknown error"}`, - ); - } - - if (await this.wizardModal.isHidden().catch(() => false)) { - return; - } - - await expect(launchStepReady).toBeVisible({ timeout }); - } - async completeProviderConnectionWithoutLaunchingScan( providerUID: string, timeout = 30000, diff --git a/ui/tests/providers/providers.spec.ts b/ui/tests/providers/providers.spec.ts index 64dfaf1499..4dc8f010ed 100644 --- a/ui/tests/providers/providers.spec.ts +++ b/ui/tests/providers/providers.spec.ts @@ -1422,8 +1422,6 @@ test.describe("Add Provider", () => { }); test.describe.serial("Add Okta Provider", () => { - test.setTimeout(90000); - let providersPage: ProvidersPage; // Test data from environment variables @@ -1503,7 +1501,6 @@ test.describe("Add Provider", () => { // Confirm the provider connection without launching a scan await providersPage.completeProviderConnectionWithoutLaunchingScan( orgDomain, - 60000, ); }, );