test: tighten lint gate + add unhide-options helper#691
Merged
bjagg merged 1 commit intoMay 7, 2026
Conversation
5 tasks
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.
7108c31 to
8db43a4
Compare
ChristianMurphy
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
openPortletOptions(now exposed asopenDropdown),#up-notification→.modern-notification, maximized-view scoping with.up-portlet-wrapper:has(.portlet-options-menu). Dropped from this PR.unhidePortletOptionsMenushelper. Kept and rebased.waitForLoadState("networkidle"),(window as any)casts,e/errshorthand. Fixed alongside.What's in the PR now
Config
tsconfig.json: addDOM.Iterabletolib.eslint.config.js: declare browser globals (window,document,navigator,URL,Element,HTMLElement, etc.) sono-undefstops flagging uses insidepage.evaluate()callbacks.tests/uportal-pw.config.ts:trace: \"retain-on-failure\",screenshot: \"only-on-failure\"for CI debug.unhidePortletOptionsMenus(page)helperThe XSL renders
.portlet-options-menuwithclass=\"hidden\"and a jQuerydocument.readyhandler 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
openDropdownhelper — 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
openDropdowncall reveals a hidden-class race in CI.Lint/type-coverage cleanup driven by the new gate
ux-general-utils.ts:window.bootstrapdeclared as a typed global;openDropdownno longer needs the triple-cast insideevaluate.announcements.spec.ts:window.tinymce/window.tinyMCEdeclared as typed globals; replace(window as any).tinymce.activeEditor.setContent(...)withwindow.tinymce?.activeEditor?.setContent(...); drop onewaitForLoadState(\"networkidle\"); numeric separators on the 10_000 timeouts.simple-content.spec.ts:window.CKEDITORdeclared as a typed global with proper instance interfaces; replacewaitForLoadState(\"networkidle\")withwaitForURL(/render\\.uP/); flatten the nestedsetData(...).thenchain in the cancel test (the test only needs something staged before clicking cancel).calendar.spec.ts,jasig-widgets.spec.ts,web-proxy.spec.ts: replacewaitForLoadState(\"networkidle\")with concrete visibility / text assertions on each portlet's distinguishing element; renamee→errorinpageerrorhandlers.bookmarks.spec.ts: regex case normalization (theiflag handles case).feedback.spec.ts:submitBtn→submitButton.favorites.spec.ts: numeric separator on10_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-expecton tests that delegate assertions to a helper. Those are tagged for follow-up; not blocking.)npx playwright test— 117 / 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 playwrightLintpasses (0 errors)./gradlew playwrightRunpasses 3× in a row