Skip to content

test: tighten lint gate + add unhide-options helper#691

Merged
bjagg merged 1 commit into
uPortal-Project:masterfrom
bjagg:chore/playwright-fixes-bs5-dropdown
May 7, 2026
Merged

test: tighten lint gate + add unhide-options helper#691
bjagg merged 1 commit into
uPortal-Project:masterfrom
bjagg:chore/playwright-fixes-bs5-dropdown

Conversation

@bjagg

@bjagg bjagg commented Apr 28, 2026

Copy link
Copy Markdown
Member

Summary

Trims this PR down to the parts that aren't already in master after #692 merged.

The original branch had three categories of changes:

  1. Already in master via chore: bump uPortal 5.17.4 + resource-server 1.5.3 + 2026-05 fleet release wave + post-wave patches #692openPortletOptions (now exposed as openDropdown), #up-notification.modern-notification, maximized-view scoping with .up-portlet-wrapper:has(.portlet-options-menu). Dropped from this PR.
  2. Genuinely net-new — the lint/type-coverage gate, browser globals in eslint, and the unhidePortletOptionsMenus helper. Kept and rebased.
  3. Surfaced by enabling the gate — pre-existing waitForLoadState("networkidle"), (window as any) casts, e/err shorthand. Fixed alongside.

What's in the PR now

Config

  • tsconfig.json: add DOM.Iterable to lib.
  • eslint.config.js: declare browser globals (window, document, navigator, URL, Element, HTMLElement, etc.) so no-undef stops flagging uses inside page.evaluate() callbacks.
  • tests/uportal-pw.config.ts: trace: \"retain-on-failure\", screenshot: \"only-on-failure\" for CI debug.

unhidePortletOptionsMenus(page) helper

The XSL renders .portlet-options-menu with class=\"hidden\" and a jQuery document.ready handler removes the class on portlets that have menu items. In headless Playwright runs the timing is variable enough that the click target can still be hidden when a test interacts with it. The helper force-removes the class as a deterministic prep step.

Pairs with the existing openDropdown helper — that one drives the Bootstrap side of opening the menu, this one drives the upstream jQuery side that gates whether the toggle is rendered.

The helper is exported but not yet called from any spec. That's intentional — pull it into specs only when an openDropdown call reveals a hidden-class race in CI.

Lint/type-coverage cleanup driven by the new gate

  • ux-general-utils.ts: window.bootstrap declared as a typed global; openDropdown no longer needs the triple-cast inside evaluate.
  • announcements.spec.ts: window.tinymce / window.tinyMCE declared as typed globals; replace (window as any).tinymce.activeEditor.setContent(...) with window.tinymce?.activeEditor?.setContent(...); drop one waitForLoadState(\"networkidle\"); numeric separators on the 10_000 timeouts.
  • simple-content.spec.ts: window.CKEDITOR declared as a typed global with proper instance interfaces; replace waitForLoadState(\"networkidle\") with waitForURL(/render\\.uP/); flatten the nested setData(...).then chain in the cancel test (the test only needs something staged before clicking cancel).
  • calendar.spec.ts, jasig-widgets.spec.ts, web-proxy.spec.ts: replace waitForLoadState(\"networkidle\") with concrete visibility / text assertions on each portlet's distinguishing element; rename eerror in pageerror handlers.
  • bookmarks.spec.ts: regex case normalization (the i flag handles case).
  • feedback.spec.ts: submitBtnsubmitButton.
  • favorites.spec.ts: numeric separator on 10_000.
  • api/utils/api-portlet-list-utils.ts: .length).not.toEqual(0).toHaveLength(0).

Verification

  • ./gradlew playwrightLint — 0 errors. (19 warnings remain on pre-existing pattern usages — locator-method preferences, expect-expect on tests that delegate assertions to a helper. Those are tagged for follow-up; not blocking.)
  • npx playwright test117 / 117 passing across three consecutive full-suite runs against the released uPortal 5.17.5 / CalendarPortlet 2.7.3 / NotificationPortlet 4.8.4.

Test plan

  • ./gradlew playwrightLint passes (0 errors)
  • ./gradlew playwrightRun passes 3× in a row
  • CI green

bjagg added a commit that referenced this pull request May 5, 2026
…→ 1.5.3

Problem: uPortal 5.17.3 and resource-server 1.5.3 were both released
yesterday. uPortal-start master still pins the prior versions:
- uPortalVersion=5.17.2 (released 2026-04-02)
- resourceServerWebjarVersion=1.5.0 (released last cycle)

The 1.5.0 pin in particular has been actively bad: that release was
published without webjar JARs in WEB-INF/lib, so /resource-server/
webjars/jquery/dist/jquery.min.js etc. all 404'd in deployments,
which broke the in-browser jQuery 4 / Bootstrap 5 loading. 1.5.3 is
the fix.

Goal: pull both releases into the fleet's reference Tomcat overlay
so adopters consuming uPortal-start get the just-released versions
and the webjar serving regression is resolved on master.

Changes:
- gradle.properties: uPortalVersion 5.17.2 → 5.17.3
- gradle.properties: resourceServerWebjarVersion 1.5.0 → 1.5.3
- resourceServerVersion (the legacy 1.0.48 ResourceServingWebapp pin)
  intentionally stays as-is — per docs/developer/other/RELEASE.md in
  the uPortal repo, that one "should generally stay at 1.0.48 in
  uPortal-start" because the older overlay carries some front-end
  dependencies the rest of the deploy still needs.

Notes: this also unblocks PR #691 (Playwright BS5 dropdown fixes) —
those tests target post-#2915 frontend behavior that only exists in
5.17.3+ and depend on the webjars actually serving (1.5.2+). With
this PR landed, #691 should rebase to a green CI matrix.
Problem: the lint pipeline (`./gradlew playwrightLint`) was not enforcing
much. tsconfig was missing `DOM.Iterable`, ESLint had no globals
declared for the browser context inside `page.evaluate()` callbacks, and
type-coverage was permissive enough that several `(window as any)` casts
were riding along without complaint. The deferred chrome flake fix
that landed in master via uPortal-Project#692 did not address these gates because the
previous PR predated them. Bringing the suite under a strict gate
surfaces real type/style issues that we want to catch in CI.

Goal: enable the strict lint+type-coverage gate, fix the issues it
surfaces, and add the only tests/code change that wasn't already in
master from the original uPortal-Project#691 — the `unhidePortletOptionsMenus`
helper.

Changes — config:
- tsconfig.json: add `DOM.Iterable` to `lib` so spread/iteration over
  NodeList works without casts
- eslint.config.js: declare browser globals (window, document,
  navigator, URL, Element, HTMLElement, NodeListOf, etc.) so
  no-undef stops flagging legitimate uses inside page.evaluate
  callbacks; the file is otherwise unchanged
- tests/uportal-pw.config.ts: add `trace: "retain-on-failure"` and
  `screenshot: "only-on-failure"` for CI debug

Changes — `unhidePortletOptionsMenus` helper added in `ux-general-utils.ts`:
- The XSL renders `.portlet-options-menu` with `class="hidden"` and a
  jQuery document.ready handler removes the class on portlets that
  have menu items. In headless Playwright runs the timing is variable
  enough that the click target may still be hidden when a test
  interacts with it. The helper force-removes the class as a
  deterministic prep step. Pairs with the existing `openDropdown`
  helper — that one drives the Bootstrap-side, this one the
  upstream jQuery-side that gates whether the toggle is rendered.

Changes — under-the-hood typing improvements driven by the new gate:
- ux-general-utils.ts: declare `window.bootstrap` global so
  `openDropdown` doesn't need a triple-cast inside `evaluate`
- announcements.spec.ts: declare `window.tinymce` / `window.tinyMCE`
  globals; use `window.tinymce?.activeEditor?.setContent(...)`
  instead of `(window as any).tinymce.activeEditor.setContent(...)`;
  drop one `waitForLoadState("networkidle")` flagged by the
  playwright plugin; numeric separators on the 10_000 timeouts
- simple-content.spec.ts: declare `window.CKEDITOR` global with
  proper interfaces; use `window.CKEDITOR` directly in evaluate
  callbacks; replace one `waitForLoadState("networkidle")` with an
  explicit `waitForURL(/render\.uP/)`; replace nested
  setData-as-Promise with a fire-and-forget setData (the cancel
  test only needs *something* staged)
- calendar.spec.ts, jasig-widgets.spec.ts, web-proxy.spec.ts:
  replace `waitForLoadState("networkidle")` with concrete
  visibility / text assertions on each portlet's distinguishing
  element; rename `e` → `error` in pageerror handlers
- bookmarks.spec.ts: regex case normalization (the `i` flag handles
  case so the literal can be lowercase)
- feedback.spec.ts: `submitBtn` → `submitButton`
- favorites.spec.ts: numeric separator on `10_000`
- api/utils/api-portlet-list-utils.ts: `.length).not.toEqual(0)`
  → `.toHaveLength(0)` per the playwright/prefer-to-have-length
  rule

Notes: ran `./gradlew playwrightLint` clean (0 errors, 19 warnings on
pre-existing pattern usages that the rules flag as suggestions). Ran
the full Playwright suite three times in a row at 117/117 against the
released versions to confirm none of the lint-driven refactors changed
test behavior. The unhide helper is exported but not yet called from
any spec — that's intentional, this PR adds the tool; tests that need
it can pull it in as their `openDropdown` calls reveal a hidden-class
race in CI.
@bjagg bjagg force-pushed the chore/playwright-fixes-bs5-dropdown branch from 7108c31 to 8db43a4 Compare May 5, 2026 09:01
@bjagg bjagg changed the title test: make Playwright dropdown tests work post-Bootstrap-5 test: tighten lint gate + add unhide-options helper May 5, 2026
@bjagg bjagg merged commit 8ad76cd into uPortal-Project:master May 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants