From a4cc77f9d143c7b15d4323992d50eb57eda57212 Mon Sep 17 00:00:00 2001 From: Stan Lewis Date: Fri, 3 Apr 2026 09:22:44 -0400 Subject: [PATCH] feat(UIHelper): Add function to dismiss quickstart This change adds a dismissQuickstartIfVisible function to UIHelper, used in at least one e2e test and could be helpful for other tests. This change also updates the vitepress config to reflect the newer package version this change introduces. Assisted-By: Cursor Desktop rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED --- docs/.vitepress/config.ts | 2 +- docs/api/helpers/ui-helper.md | 8 ++++++++ docs/changelog.md | 8 +++++++- docs/guide/helpers/ui-helper.md | 11 +++++++++++ docs/overlay/reference/patterns.md | 10 ++++++++++ docs/overlay/test-structure/spec-files.md | 1 + package.json | 2 +- src/playwright/helpers/ui-helper.ts | 16 ++++++++++++++++ 8 files changed, 55 insertions(+), 3 deletions(-) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 76bef3e..f2cc9d0 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -33,7 +33,7 @@ export default defineConfig({ { text: "Examples", link: "/examples/" }, { text: "Overlay Testing", link: "/overlay/" }, { - text: "v1.1.22", + text: "v1.1.25", items: [{ text: "Changelog", link: "/changelog" }], }, ], diff --git a/docs/api/helpers/ui-helper.md b/docs/api/helpers/ui-helper.md index 5452029..53d8efb 100644 --- a/docs/api/helpers/ui-helper.md +++ b/docs/api/helpers/ui-helper.md @@ -24,6 +24,14 @@ async waitForLoad(timeout?: number): Promise ``` Wait for page to fully load. +#### `dismissQuickstartIfVisible()` +```typescript +async dismissQuickstartIfVisible(options?: { + waitHiddenMs?: number; +}): Promise +``` +If the RHDH quickstart drawer is open, clicks its **Hide** button and waits for the control to disappear. Does nothing when the button is not visible. Use before catalog search or other UI that the drawer can cover. Default `waitHiddenMs` is `5000`. + ### Verification Methods #### `verifyHeading()` diff --git a/docs/changelog.md b/docs/changelog.md index a62bbd3..0803531 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,7 +2,13 @@ All notable changes to this project will be documented in this file. -## [1.1.24] - Current +## [1.1.25] - Current + +### Added + +- **`UIhelper.dismissQuickstartIfVisible()`**: Optionally closes the RHDH quickstart drawer when its **Hide** control is visible, so e2e tests are not blocked by the overlay. Optional `waitHiddenMs` (default `5000`) controls how long to wait for the button to become hidden after click. + +## [1.1.24] ### Added diff --git a/docs/guide/helpers/ui-helper.md b/docs/guide/helpers/ui-helper.md index 807df35..12417ff 100644 --- a/docs/guide/helpers/ui-helper.md +++ b/docs/guide/helpers/ui-helper.md @@ -29,6 +29,17 @@ await uiHelper.waitForLoad(); await uiHelper.waitForLoad(10000); // Custom timeout ``` +### `dismissQuickstartIfVisible(options?)` + +When the [quickstart](https://github.com/redhat-developer/rhdh-plugins/tree/main/workspaces/quickstart) plugin opens its drawer (for example after login), it can sit over the catalog, search field, or other controls. This method clicks **Hide** only if that button is visible, then waits for it to go away; otherwise it returns immediately. + +```typescript +await uiHelper.dismissQuickstartIfVisible(); +await uiHelper.dismissQuickstartIfVisible({ waitHiddenMs: 10_000 }); +``` + +Typical use is right after navigation or login, before assertions or interactions that need an unobstructed main view. + ## Verification Methods ### `verifyHeading(heading, timeout?)` diff --git a/docs/overlay/reference/patterns.md b/docs/overlay/reference/patterns.md index 9435035..37d5672 100644 --- a/docs/overlay/reference/patterns.md +++ b/docs/overlay/reference/patterns.md @@ -205,6 +205,16 @@ await uiHelper.searchInputPlaceholder("Search...", "query"); await uiHelper.selectMuiBox("Category", "Option 1"); ``` +### Dismiss quickstart drawer + +When the RHDH quickstart plugin shows its drawer, it can cover catalog search and other controls. Call this after login or navigation if needed (it is a no-op when **Hide** is not visible): + +```typescript +await uiHelper.dismissQuickstartIfVisible(); +``` + +See [UIhelper](/guide/helpers/ui-helper) and [UIhelper API](/api/helpers/ui-helper). + ## Table Patterns ### Verify Table Rows diff --git a/docs/overlay/test-structure/spec-files.md b/docs/overlay/test-structure/spec-files.md index b53301e..51e4aad 100644 --- a/docs/overlay/test-structure/spec-files.md +++ b/docs/overlay/test-structure/spec-files.md @@ -312,6 +312,7 @@ Common methods from `UIhelper`: | `clickButton(name)` | Click button by name | | `clickLink(text)` | Click link by text | | `waitForLoad()` | Wait for page load | +| `dismissQuickstartIfVisible()` | Close quickstart drawer if **Hide** is visible | See [UIhelper API](/api/helpers/ui-helper) for full reference. diff --git a/package.json b/package.json index d3c97c7..94b19c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@red-hat-developer-hub/e2e-test-utils", - "version": "1.1.24", + "version": "1.1.25", "description": "Test utilities for RHDH E2E tests", "license": "Apache-2.0", "repository": { diff --git a/src/playwright/helpers/ui-helper.ts b/src/playwright/helpers/ui-helper.ts index 382ad38..bfa91bc 100644 --- a/src/playwright/helpers/ui-helper.ts +++ b/src/playwright/helpers/ui-helper.ts @@ -23,6 +23,22 @@ export class UIhelper { } } + /** + * Closes the quickstart drawer when the "Hide" button is visible (RHDH quickstart plugin), + * so it does not cover catalog or other UI under test. + */ + async dismissQuickstartIfVisible(options?: { waitHiddenMs?: number }) { + const waitHiddenMs = options?.waitHiddenMs ?? 5000; + const quickstartHide = this.page.getByRole("button", { name: "Hide" }); + if (await quickstartHide.isVisible()) { + await quickstartHide.click(); + await quickstartHide.waitFor({ + state: "hidden", + timeout: waitHiddenMs, + }); + } + } + async verifyComponentInCatalog(kind: string, expectedRows: string[]) { await this.openSidebar("Catalog"); await this.selectMuiBox("Kind", kind);