Skip to content

Add QAN URL state persistence tests - #1139

Merged
kiranvuyurru merged 6 commits into
mainfrom
PMM-14848-url-parameters
Aug 12, 2026
Merged

Add QAN URL state persistence tests#1139
kiranvuyurru merged 6 commits into
mainfrom
PMM-14848-url-parameters

Conversation

@kiranvuyurru

@kiranvuyurru kiranvuyurru commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Add comprehensive tests for URL state persistence across RTA overview, sessions, and stored metrics pages. Includes new page object methods and locators for filters, pagination, and rows-per-page controls. Adds mock helper for RTA sessions and new storedMetrics URL state test suite (PMM-T2265, PMM-T2266, PMM-T2267, PMM-T2268).
https://github.com/percona/pmm-qa/actions/runs/31022412293/job/92362695351

Add comprehensive tests for URL state persistence across RTA overview, sessions, and stored metrics pages. Includes new page object methods and locators for filters, pagination, and rows-per-page controls. Adds mock helper for RTA sessions and new storedMetrics URL state test suite (PMM-T2265, PMM-T2266, PMM-T2267, PMM-T2268).
@kiranvuyurru
kiranvuyurru marked this pull request as ready for review August 5, 2026 17:06
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9794f3bf-9371-4dbf-a83d-ad78f11aa513

📥 Commits

Reviewing files that changed from the base of the PR and between 0d3c0fb and 1f97c18.

📒 Files selected for processing (2)
  • e2e_tests/pages/qan/rta/realTimeAnalytics.page.ts
  • e2e_tests/tests/qan/storedMetrics/urlState.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • percona/pmm-qa (manual)
  • percona/pmm (manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • e2e_tests/pages/qan/rta/realTimeAnalytics.page.ts
  • e2e_tests/tests/qan/storedMetrics/urlState.test.ts

Walkthrough

Changes

URL State Coverage

Layer / File(s) Summary
RTA overview state
e2e_tests/pages/qan/rta/realTimeAnalytics.page.ts, e2e_tests/tests/qan/rta/overview.test.ts
RTA coverage verifies URL persistence and reload restoration for query filters, page size, elapsed-time sorting, service IDs, and decimal duration filters.
RTA sessions pagination
e2e_tests/helpers/apiEndpoints.ts, e2e_tests/helpers/mocks.helper.ts, e2e_tests/pages/qan/rta/realTimeAnalytics.page.ts, e2e_tests/tests/qan/rta/session.test.ts
The sessions endpoint uses deterministic mock data. The test verifies session page-size persistence and row-count restoration after reload.
Stored Metrics URL state
e2e_tests/pages/qan/storedMetrics/storedMetrics.page.ts, e2e_tests/tests/qan/storedMetrics/urlState.test.ts
Stored Metrics coverage verifies service-type filters, pagination, debounced search, shared URL navigation, restored state, and browser console errors.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding QAN URL state persistence tests.
Description check ✅ Passed The description directly explains the URL persistence tests, page object updates, mock helper, and covered test cases.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
e2e_tests/tests/qan/storedMetrics/urlState.test.ts (1)

17-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Split the scenario into test.step() phases.

Separate filter changes, pagination changes, URL assertions, and shared-URL restoration into named steps. This makes a failed URL-state assertion identifiable in CI output.

As per coding guidelines, “Use Playwright's test.step() for readable test structure.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e_tests/tests/qan/storedMetrics/urlState.test.ts` around lines 17 - 68,
Split the scenario in the test callback into named Playwright test.step phases
covering filter changes, pagination changes, URL assertions, and shared-URL
restoration. Move the corresponding existing actions and assertions into these
steps without changing their order or behavior, and keep console-error
collection and cleanup correctly scoped across the full scenario.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e_tests/tests/qan/rta/overview.test.ts`:
- Around line 262-274: Select a known service in the test before capturing
serviceIds, using the existing service-selection control or helper. Assert that
the pre-reload URL contains the selected service ID, then preserve the existing
reload flow and verify the post-reload serviceIds matches the captured value.
- Around line 245-275: Add readable pmmTest.step() blocks to structure the
URL-state tests: in e2e_tests/tests/qan/rta/overview.test.ts lines 245-275,
separate state setup, URL verification, reload, and restored-state checks; in
lines 278-331, separate duration setup, filtered-results verification, URL
verification, and restoration checks; in e2e_tests/tests/qan/rta/session.test.ts
lines 55-72, separate mock setup, page-size selection, URL verification, and
reload checks.

In `@e2e_tests/tests/qan/storedMetrics/urlState.test.ts`:
- Line 16: Add the `@qan` tag to the test title for “PMM-T2268 Verify QAN shared
URL restores filters and pagination,” while retaining the existing `@rta` tag.
- Line 26: Wrap the test body after the page setup and console listener
registration in a try/finally block. Keep the existing assertions and test flow
in try, and move page.off('console', collectErrors) plus sharedPage.close() into
finally so both cleanup operations run on success and failure.

---

Nitpick comments:
In `@e2e_tests/tests/qan/storedMetrics/urlState.test.ts`:
- Around line 17-68: Split the scenario in the test callback into named
Playwright test.step phases covering filter changes, pagination changes, URL
assertions, and shared-URL restoration. Move the corresponding existing actions
and assertions into these steps without changing their order or behavior, and
keep console-error collection and cleanup correctly scoped across the full
scenario.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 31dd7321-b48b-4220-a07f-0ac1c7967a38

📥 Commits

Reviewing files that changed from the base of the PR and between 9cc19fb and b5934e1.

📒 Files selected for processing (7)
  • e2e_tests/helpers/apiEndpoints.ts
  • e2e_tests/helpers/mocks.helper.ts
  • e2e_tests/pages/qan/rta/realTimeAnalytics.page.ts
  • e2e_tests/pages/qan/storedMetrics/storedMetrics.page.ts
  • e2e_tests/tests/qan/rta/overview.test.ts
  • e2e_tests/tests/qan/rta/session.test.ts
  • e2e_tests/tests/qan/storedMetrics/urlState.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • percona/pmm-qa (manual)
  • percona/pmm (manual)

Comment thread e2e_tests/tests/qan/rta/overview.test.ts
Comment thread e2e_tests/tests/qan/rta/overview.test.ts Outdated
Comment thread e2e_tests/tests/qan/storedMetrics/urlState.test.ts
Comment thread e2e_tests/tests/qan/storedMetrics/urlState.test.ts Outdated
Comment thread e2e_tests/pages/qan/rta/realTimeAnalytics.page.ts Outdated
Comment thread e2e_tests/tests/qan/storedMetrics/urlState.test.ts Outdated
@kiranvuyurru
kiranvuyurru merged commit 0a6fda9 into main Aug 12, 2026
33 checks passed
@kiranvuyurru
kiranvuyurru deleted the PMM-14848-url-parameters branch August 12, 2026 16:06
travagliad pushed a commit that referenced this pull request Aug 17, 2026
PMM-T2268 (added in #1139) exercises the useTableUrlState /
debounced-search feature from PMM-14848 (percona/pmm#5537), merged to
main on 2026-08-11 and shipping in 3.10.0. Like its sibling specs
T2265-T2267 it fails against pre-3.10.0 RC images, so add it to the
central version registry.

Signed-off-by: Claude <noreply@anthropic.com>
travagliad added a commit that referenced this pull request Aug 17, 2026
…1184)

* Resolve RC client version from server_version, not v3 VERSION

The Generic CLI suite resolved the expected pmm-admin version for a
`pmm3-rc` client by curl-ing Percona-Lab/pmm-submodules v3 VERSION. The
moment an RC branches, that file is bumped to the next dev version, so
during RC testing the client reports 3.9.0 while the test expects 3.9.1
-> every Generic leg failed on `pmm-admin --version` / `summary --version`.

Resolve the expected version from `pmm-admin status --json`
(server_version) for `pmm3-rc` too, reusing the existing feature-build
path, so the reference tracks the artifact under test rather than the
moving v3 line.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Gate MongoDB Unused Indexes dashboard test to PMM 3.10.0+

The Unused Indexes dashboard ships from PMM Server 3.10.0, but the
rc-testing-suite runs pmm-qa main against older RC images (e.g. 3.9.0-rc),
where the dashboard/nav item does not exist, so PMM-T2262 fails with
"element(s) not found". Add a small server-version gate (read from
DOCKER_VERSION) and skip the spec when the server predates 3.10.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Gate 3.10.0-only e2e specs against older RC images

These specs cover features that ship from PMM Server 3.10.0 and are absent
in 3.9.x (incl. the 3.9.1 patch RC), so they fail when the rc-testing-suite
runs pmm-qa main against a 3.9.x image:
- RTA table/session URL-state persistence (PMM-T2265/T2266/T2267) — useTableUrlState, percona/pmm#5537
- Update-notification snooze (PMM-T2263) — percona/pmm#5694
- Left-menu traversal expecting the 3.10 mongo-unused-indexes nav item (PMM-T2202)

Skip each via the shared serverVersionBelow('3.10.0') gate; they keep
running on 3.10.0+ dev/RC builds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Fix PMM-T2227 tarball-upgrade version assertion

#1175 made the post-upgrade check assert PMM_VERSION, which for the
compatibility legs is the pinned matrix.version (e.g. 3.7.0) — but the
test always upgrades to pmm-client-latest.tar.gz (dev HEAD, e.g. 3.9.1-v3),
so every compat Generic leg failed asserting the old pinned version.

Assert against the version the upgrade tarball actually installs instead:
verify the reported version changed (upgrade happened) and, for the default
dev-latest tarball, that it matches the build under test (v3 VERSION). This
keeps the exact-version coverage without tying it to the leg's source version.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Inline version gate helper and trim comments

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Fail closed when the upgrade version lookup fails

If the curl to v3 VERSION failed or returned empty, upgradedVersion was ''
and the exact-version assertion was silently skipped, letting the test pass
on any changed version. Require a successful, non-empty lookup instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Detect PMM version from the server API, not DOCKER_VERSION

DOCKER_VERSION is not always set, so the version gate could not tell which
build was under test. Add ServerApi.getPmmVersion() (GET /v1/version) as in
#1094 and reduce the helper to a pure semver comparison; the
3.10.0 gates now read the running server's version.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Gate version-specific specs with a min-pmm-version annotation

Move the 3.10.0 skip logic out of each test body into a single
pmmTest.beforeEach that reads a `min-pmm-version` annotation and skips when
the running server (GET /v1/version) is below it. Tests now only declare the
version they need; no per-test skip code or fixture plumbing, and nothing to
edit when a version ships.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Move version gates to a central registry, off the tests

Keep the runtime server-version gate but drive it from a single
versionGates map (PMM-T id -> min version) resolved in pmmTest.beforeEach.
The specs themselves carry nothing: gate or retire one by editing one line
in the registry. Being a runtime gate, the same spec skips on an older
server and runs on 3.10.0+, so it stays correct across concurrent
patch/minor branches with no per-branch edits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DpJQhfD6qKwZWwsiP671T
Signed-off-by: Claude <noreply@anthropic.com>

* Gate PMM-T2268 QAN URL-state test to PMM 3.10.0+

PMM-T2268 (added in #1139) exercises the useTableUrlState /
debounced-search feature from PMM-14848 (percona/pmm#5537), merged to
main on 2026-08-11 and shipping in 3.10.0. Like its sibling specs
T2265-T2267 it fails against pre-3.10.0 RC images, so add it to the
central version registry.

Signed-off-by: Claude <noreply@anthropic.com>

---------

Signed-off-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
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