Skip to content

migrate(settings): verifyPMMSettingsPageElements CodeceptJS to Playwright - #1314

Open
kiranvuyurru wants to merge 3 commits into
mainfrom
migrate-configuration-settings-page-elements
Open

migrate(settings): verifyPMMSettingsPageElements CodeceptJS to Playwright#1314
kiranvuyurru wants to merge 3 commits into
mainfrom
migrate-configuration-settings-page-elements

Conversation

@kiranvuyurru

Copy link
Copy Markdown
Contributor

Migrates the PMM Settings page-element tests from CodeceptJS to native Playwright.

Read this first: the CodeceptJS source is deliberately NOT retired

Every other migration in this series retires its source. This one does not, and that is a
deliberate decision, not an oversight.

@grafana-pr has zero consumers in .github/workflows/ (grep -rn 'grafana-pr' .github/
returns nothing). Its only consumer is codeceptjs-e2e/package.json:14:

"e2e:grafana-pr": "npx codeceptjs run -c pr.codecept.js --grep '@grafana-pr'"

which is invoked cross-repository by percona/grafana CI, and which runs CodeceptJS only. A
Playwright job in this repository cannot restore that gate's coverage.

Retiring verifyPMMSettingsPageElements_test.js would drop its 4 @grafana-pr scenarios
(6 generated tests)
from the percona/grafana gate — and it would do so silently, because
7 other CodeceptJS files still carry @grafana-pr (permissions_test.js, sttSettings_test.js,
alertRules_test.js, explorePage_test.js, verifyGrafanaIsGone_test.js,
verifyPMMSettingsPageFunctionality_test.js, ruleTemplates_test.js), so the job stays green
while testing less.

Accepted consequence: these scenarios now run twice in pmm-qa CI — the existing
settings_and_cli CodeceptJS job and the new settings_playwright Playwright job. Verified safe:

settings_and_cli settings_playwright
Reusable workflow runner-e2e-tests-codeceptjs.yml runner-e2e-tests-playwright.yml
Runner / PMM Server its own its own
Launchable --test-suite ui-tests-<tags> pw-ui-tests-<report>

Separate runners, separate PMM Servers, distinct Launchable suite prefixes — no shared state and
no Launchable session collision. The cost is CI minutes only.

Condition for retiring it later: once percona/grafana CI can invoke the Playwright suite. A
header comment on the source records this so the next reader does not have to rediscover it.

Migration

Source codeceptjs-e2e/tests/configuration/verifyPMMSettingsPageElements_test.js (kept, see above)
Target e2e_tests/tests/configuration/settingsPageElements.test.ts (new file)

Scenarios and tags

Every source tag is preserved verbatim. No destination tag was added — all 8 tests already
carry @settings.

Scenario Tags
PMM-T97 - Verify server diagnostics on PMM Settings Page (3 data rows) @settings @grafana-pr
PMM-T84 - Verify Section Tabs and Metrics Section Elements [critical] @settings @grafana-pr
PMM-T85 - Verify SSH Key Section Elements @settings @grafana-pr
Verify Advanced Section Elements @settings @grafana-pr
PMM-T227 - ... DATA_RETENTION value is set to 2 days (skipped, PMM-5791) @settings
PMM-T1866 - Verify public address with a port does not error @settings

Data(dataRetentionTable).Scenario becomes a for loop over dataRetentionRows; Before/After
become beforeEach/afterEach, so the file is self-preconditioning and rerunnable.

Files queried from the existing graphs

Source graph (codeceptjs-e2e/graphify-out/), plus a direct check of the scenarios' injected
fixture names against codeceptjs-e2e/tests/**/pages/*.js (CodeceptJS DI is not a static import,
so graphify has no edge for it):

  • codeceptjs-e2e/tests/configuration/pages/pmmSettingsPage.js
  • settingsAPI (restoreSettingsDefaults, changeSettings), serverApi, I.Authorize

Target graph (e2e_tests/graphify-out/):

  • e2e_tests/pages/ha/settings.page.ts — reused, extended
  • e2e_tests/api/settings.api.ts, e2e_tests/api/server.api.ts — reused, extended
  • e2e_tests/helpers/apiEndpoints.ts, e2e_tests/helpers/timeouts.ts, e2e_tests/fixtures/pmmTest.ts — reused as-is

Supporting changes

  • SettingsApi.restoreSettingsDefaults() — ports the CodeceptJS helper, including its
    PMM_ENABLE_TELEMETRY 400-retry path.
  • SettingsApi.setPublicAddress() — replaces the source's changeSettings({ publicAddress: '' }).
  • ServerApi.getDistributionMethod() and the /v1/server/version endpoint. /v1/version, already
    in apiEndpoints, does not carry distribution_method; /v1/server/version is the only one
    that does. PMM-T85 short-circuits unless the distribution is AMI, faithfully to the source.
  • Settings POM: new elements (section labels, error alert, tab content), inputs.dataRetention,
    and three wait/read helpers (waitForPageLoaded, settleAfterApplyingChanges,
    getDataRetentionValidationMessage). urls and buttons.toggles are unchanged.
  • Five existing POM inputs entries (high, low, medium, publicAddress, sshKey) had
    zero consumers and disagreed with the green CodeceptJS source, so they were corrected in
    place to the ids the PMM UI actually renders rather than shadowed by new entries.

Setup

node provisioning/setup.ts — PMM Server only, setup_client=false. Every @settings test needs
PMM Server alone, which is why the new job passes setup_services: '-h' and no database.

Validation

Check Result
npx tsc --noEmit pass
npx eslint . pass
python support_scripts/generate_readme.py --check pass — "README generated sections are up to date"
check-migration-conventions.sh pass — "Migration convention checks passed."

MCP locator verification

16 locators verified live against the provisioned PMM Server through Playwright MCP, 0 edits
required
. ssh-key and ssh-key-label could not be verified — they render only on an AMI
distribution, and the environment is Docker. That is the same reason PMM-T85 short-circuits.

Execution

Both runs against the provisioned server, --workers=1 (these tests mutate shared server
settings and cannot run in parallel):

cd e2e_tests
PMM_MIGRATION=1 PMM_UI_URL='https://127.0.0.1/' ADMIN_PASSWORD='admin' \
  npx playwright test tests/configuration/settingsPageElements.test.ts --workers=1
# 7 passed, 1 skipped (40.7s)

The new job's grep also newly selects 4 pre-existing tests in portalRemoval.test.ts that no
Playwright job selected before, so the full selection was run too:

PMM_MIGRATION=1 PMM_UI_URL='https://127.0.0.1/' ADMIN_PASSWORD='admin' \
  npx playwright test --grep '@settings' --workers=1
# 11 passed, 1 skipped (35.2s)

The single skip is PMM-T227, intentionally skipped pending PMM-5791.

Workflow coverage

One new job in .github/workflows/e2e-tests-matrix.yml:

settings_playwright:
  name: Settings UI tests
  uses: ./.github/workflows/runner-e2e-tests-playwright.yml
  ...
  setup_services: '-h'
  pmm_test_flag: '@settings'

A new job rather than a tag append to an existing test_execution_playwright entry, because
e2e-tests-matrix.yml has no such matrix entry — its Playwright jobs are individual job blocks.
It mirrors the CodeceptJS settings_and_cli job's surface, minus the database that job needs for
@cli.

No existing job, grep expression, or expected_test_jobs counter was changed.
expected_test_jobs lives in nightly-e2e-tests-matrix.yml, which this PR does not touch; this
job is in e2e-tests-matrix.yml and is not fed by the nightly setup shards.

Grep verification

@settings consumers across .github/workflows/, after the edit:

Job File Key Kind setup_services Sufficient
settings_and_cli e2e-tests-matrix.yml:71 tags_for_tests: '@settings|@cli' CodeceptJS --database pgsql yes (unchanged)
settings_playwright e2e-tests-matrix.yml:210 pmm_test_flag: '@settings' Playwright -h yes — server-only is all these tests need

Forward direction — every migrated scenario is selected:

npx playwright test --list --grep '@settings'    -> 12 tests in 2 files (8 migrated + 4 portalRemoval)
npx playwright test --list --grep '@grafana-pr'  -> 6 tests in 1 file

Reverse direction — no existing selection changed. This PR adds a job and edits no existing
expression, and the @settings|@cli CodeceptJS grep is untouched, so its selection is unchanged
by construction; the source file is still on the _test.js discovery glob, so no CodeceptJS job
loses scenarios.

FB suite: none of the migrated scenarios carry an @fb-* tag, so fb-e2e-suite.yml is unaffected.

Reviews

Initial gate: attempt 1 REVIEW_FAILED (one blocker, B1), attempt 2 READY_TO_RUN.
Final gate: attempt 1 FINAL_REVIEW_PASS, subject stable (startRef == endRef).

Two advisories a reviewer should know about

Both were raised, judged acceptable, and carried rather than fixed:

  1. The PMM-T97 title suffix is hand-built, not JSON.stringify'd. The title ends with
    | {"value":"...","message":"..."} assembled by template literal. It is byte-exact for the
    three current rows, but a future row containing a quote or a backslash would produce a title
    that diverges from real JSON, silently. A JSON.stringify-based form is not viable here:
    perfectionist/sort-objects reorders the object literal's keys, so the emitted key order
    would no longer match the intended value-then-message order.
  2. The twin-file pointer is one-directional. The CodeceptJS source's header names the
    Playwright file, but the Playwright file does not name the source, because a migrated
    *.test.ts may carry zero comments.

kiranvuyurru and others added 2 commits September 3, 2026 16:13
…laywright

Port PMM-T97 (3 data-driven rows), PMM-T84, PMM-T85, "Verify Advanced
Section Elements", PMM-T227 (skipped) and PMM-T1866 from
codeceptjs-e2e/tests/configuration/verifyPMMSettingsPageElements_test.js
to native Playwright. Every source tag is preserved verbatim; no
destination tag was added, since all 8 tests already carry @settings.

Adds SettingsApi.restoreSettingsDefaults/setPublicAddress,
ServerApi.getDistributionMethod, the /v1/server/version endpoint (the
only one carrying distribution_method), and settings-page labels,
inputs and three wait/read helpers on the settings POM.

Five POM input entries had zero consumers and disagreed with the green
CodeceptJS source, so they were corrected in place to the source-proven
'<field>-<type>-input' ids the PMM UI actually renders.

The CodeceptJS source is deliberately KEPT rather than retired: its
@grafana-pr tag has no consumer in .github/workflows/, only
codeceptjs-e2e/package.json's e2e:grafana-pr script, which percona/grafana
CI invokes cross-repository and which runs CodeceptJS only. Retiring the
file would silently drop 4 scenarios from that gate with nothing able to
restore them. A header comment on the source records this and the
condition that would allow retirement.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds a settings_playwright job to e2e-tests-matrix.yml greping '@settings',
the Playwright sibling of the existing settings_and_cli CodeceptJS job.
Without it the 8 scenarios migrated out of
codeceptjs-e2e/tests/configuration/verifyPMMSettingsPageElements_test.js
run in no Playwright job at all.

A new job rather than a tag append: e2e-tests-matrix.yml has no
test_execution_playwright matrix entry to append to, and no existing
Playwright job in the file selects these tests. settings_and_cli is left
as-is because the CLI tests still need '@cli'.

setup_services '-h' is the server-only idiom already used by the alerting
Playwright job in fb-e2e-suite.yml; nothing under '@settings' needs a
database. 'workers' is omitted so runner-e2e-tests-playwright.yml's
`inputs.workers || 1` keeps it at 1 -- the migrated file's beforeEach
restores server-wide settings defaults and PMM-T1866 mutates them, so
these tests cannot run in parallel.

'@settings' selects 12 tests in 2 files: the 8 migrated ones plus 4
pre-existing tests in e2e_tests/tests/portalRemoval.test.ts that no
Playwright job selected before. Those need PMM Server only, and all 12
were run together at workers=1 against a server-only environment before
this commit: 11 passed, 1 skipped by policy (PMM-T227, PMM-5791).

expected_test_jobs is untouched and correct: it lives in
nightly-e2e-tests-matrix.yml and counts jobs matching the
"test execution / " name prefix, which only that workflow's two matrices
produce. Nightly consumers before 3, after 3.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kiranvuyurru

Copy link
Copy Markdown
Contributor Author

Comment thread e2e_tests/tests/configuration/settingsPageElements.test.ts Outdated
Comment thread e2e_tests/tests/configuration/settingsPageElements.test.ts Outdated
Comment thread e2e_tests/tests/configuration/settingsPageElements.test.ts Outdated
});
});

// TODO: Remove the skip after https://jira.percona.com/browse/PMM-5791

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 This comment restates the eslint-disable reason on the very next line — both say the skip stays until PMM-5791. One of the two is enough, and the one that has to be there is the suppression reason.

Suggested change
// TODO: Remove the skip after https://jira.percona.com/browse/PMM-5791

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not applied. check-migration-conventions.sh requires both a TODO and the eslint-disable on every pmmTest.skip; removing the TODO fails that check, so the duplication is enforced rather than accidental. I hit this directly — the check failed until I restored it.

🤖 Addressed by Claude Code

Comment thread e2e_tests/tests/configuration/settingsPageElements.test.ts Outdated
Comment thread e2e_tests/tests/configuration/settingsPageElements.test.ts Outdated

for (const row of dataRetentionRows) {
pmmTest(
`PMM-T97 - Verify server diagnostics on PMM Settings Page @settings @grafana-pr | {"value":"${row.value}","message":"${row.message}"}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 The | {"value":"…","message":"…"} suffix is a hand-built imitation of CodeceptJS's Data() title, and the PR body already records that it will diverge from real JSON the moment a row contains a quote or a backslash. Nothing consumes it as JSON, so the format buys nothing and the risk is free.

The title's job here is to say which row failed. A plain description does that and stays inside the PMM-Txxxx - description convention:

Suggested change
`PMM-T97 - Verify server diagnostics on PMM Settings Page @settings @grafana-pr | {"value":"${row.value}","message":"${row.message}"}`,
`PMM-T97 - Verify server diagnostics on PMM Settings Page: data retention "${row.value}" @settings @grafana-pr`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not applied. The repo migration rules require generated data-driven titles to stay byte-identical to the CodeceptJS source, and this suffix reproduces what DataTable emits through replaceTitle in column order. An earlier review round blocked this PR precisely for getting those bytes wrong, so changing the format now would reintroduce that. The escaping risk is real and is recorded in the PR body; it needs an invariant change, not a one-PR edit.

🤖 Addressed by Claude Code

Comment thread e2e_tests/pages/ha/settings.page.ts Outdated
Comment thread e2e_tests/pages/ha/settings.page.ts Outdated
Comment thread e2e_tests/api/settings.api.ts
Comment thread .github/workflows/e2e-tests-matrix.yml Outdated
Comment thread codeceptjs-e2e/tests/configuration/verifyPMMSettingsPageElements_test.js Outdated
@claude

claude Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

No check run has concluded on 4adbb74Lint and every e2e job are still in progress — so nothing here is backed by a gate result, and the body's local eslint/tsc claims are unverified by CI at review time.

Findings are in the line threads.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 692e451d-f846-432f-b2c2-8c97de6daaec

📥 Commits

Reviewing files that changed from the base of the PR and between 4adbb74 and 8936c0f.

📒 Files selected for processing (5)
  • .github/workflows/e2e-tests-matrix.yml
  • codeceptjs-e2e/tests/configuration/verifyPMMSettingsPageElements_test.js
  • e2e_tests/api/settings.api.ts
  • e2e_tests/pages/ha/settings.page.ts
  • e2e_tests/tests/configuration/settingsPageElements.test.ts

Walkthrough

Adds a Playwright suite for the PMM Settings page. The suite covers validation messages, metrics resolutions, AMI SSH-key elements, advanced settings, and public-address updates. New API methods restore settings, update the public address, and read the server distribution method. The settings page object adds updated selectors and synchronization helpers. CI runs the @settings tag with one worker. Documentation lists @grafana-pr, while the migrated CodeceptJS file remains for its existing CI consumer.

Sequence Diagram(s)

sequenceDiagram
  participant SettingsTests
  participant SettingsPage
  participant SettingsApi
  participant PMMServer
  SettingsTests->>SettingsApi: Restore default settings
  SettingsTests->>SettingsPage: Load settings page
  SettingsTests->>SettingsPage: Validate settings elements and input messages
  SettingsTests->>SettingsApi: Set public address
  SettingsPage->>PMMServer: Apply settings changes
  SettingsTests->>SettingsPage: Verify saved values and error state
  SettingsTests->>SettingsApi: Clear public address
Loading

Merge Risk: 🟡 Moderate · up to 4adbb

The migrated suite can pass despite failed settings saves or contaminate later tests, and the new CI path unnecessarily exposes a credential to test code. These issues should be addressed before merge.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the CodeceptJS-to-Playwright migration, retained source file, supporting changes, CI coverage, and validation results.
Title check ✅ Passed The title clearly identifies the main change: migrating the settings page-element tests from CodeceptJS to Playwright.
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.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 6f70fdcd-f73b-4242-9620-caae07432916

📥 Commits

Reviewing files that changed from the base of the PR and between b6073c2 and 4adbb74.

📒 Files selected for processing (8)
  • .github/workflows/e2e-tests-matrix.yml
  • codeceptjs-e2e/tests/configuration/verifyPMMSettingsPageElements_test.js
  • e2e_tests/README.md
  • e2e_tests/api/server.api.ts
  • e2e_tests/api/settings.api.ts
  • e2e_tests/helpers/apiEndpoints.ts
  • e2e_tests/pages/ha/settings.page.ts
  • e2e_tests/tests/configuration/settingsPageElements.test.ts
🔗 Linked repositories identified

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

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

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread .github/workflows/e2e-tests-matrix.yml
Comment thread e2e_tests/api/settings.api.ts
Comment thread e2e_tests/tests/configuration/settingsPageElements.test.ts Outdated
Replace the non-retrying validation-message read with a web-first
toHaveJSProperty, and drop the no-op waitFor that preceded it.

Report PMM-T85 as skipped rather than passed when the distribution is
not AMI; an early return made it green while asserting nothing.

Replace the ported fixed 5s pause with a real save-completion signal:
SettingsPage.applyAdvancedChanges awaits the settings PUT, and the test
waits for the Apply button's label to return from "Applying...". The
button is disabled after a successful save because the form is pristine,
so button state is not a usable signal; the label is.

Move each errorAlert check after the value assertion, where the save has
demonstrably completed - before it, toBeHidden could never fail. Collapse
the duplicated data-retention toHaveValue pair into one web-first
assertion.

Assert 200 on the settings PUTs, matching every sibling in the class, so
a failed precondition in beforeEach/afterEach surfaces where it happens.

Trim the workflow job rationale comment and the retained-source header to
the facts a reader cannot infer from the code.

Co-Authored-By: Claude Opus 5 <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.

1 participant