Repository navigation
test(e2e): add a Playwright smoke test for the Registers page - #7
Merged
Merged
Conversation
Collaborator
|
Pending re-running tests after #6 is merged in. |
Collaborator
|
@adamsrnmsu #6 has been merged in, can you pull into this branch and verify tests/deconflict if necessary? I'm good to merge it after that. |
Drive the real web UI in Chromium: seed Malcolm-shaped Modbus documents (two IP pairs, three registers, two alternating states) into a unique Elasticsearch index, load it on /registers/, open an IP pair, tick two registers and check the chart draws, then check the State tab. - tests/e2e/ uses pytest-playwright with pytest-django's live_server; the fixture deletes its index afterwards. - e2e tests carry an `e2e` marker and are deselected by default (addopts = -m 'not e2e'), so the existing pytest job needs no browser. Run them with `pytest -m e2e tests/e2e`. - New `e2e` CI job (python:3.13 container + Elasticsearch service) installs Chromium and uploads failure screenshots as an artifact. - test_state_tab checks that the State tab loads and draws its chart, which works since sandialabs#6 gave hdbscan a writable array. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adamsrnmsu
force-pushed
the
test-e2e-playwright
branch
from
November 19, 2026 20:49
93f0684 to
a9987da
Compare
Collaborator
Author
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.
Description
Adds the first Playwright end-to-end test, driving the real Registers page in Chromium. It seeds a small deterministic set of Malcolm-shaped
modbus_detaileddocuments (two IP pairs, three registers, two alternating states) into a unique Elasticsearch index, loads it with "Load Data", opens an IP pair, ticks two registers and asserts the chart draws with no failed requests or error toasts. A second test opens the State tab and asserts/registers/state/state/succeeds and "Register State Over Time" renders.tests/e2e/usespytest-playwright(added to thedevextra) with pytest-django'slive_server.constraints.txtonly pins runtime dependencies (no pytest or other dev packages), so it is unchanged.e2eand deselected by default (addopts = -m 'not e2e'), so the existingpytestjob andmake test-pythonneed no browser. Run them withpytest -m e2e tests/e2e(needs Elasticsearch,make setup, andpython -m playwright install chromium).e2ejob inci.yml(python:3.13 container, Elasticsearch service,make setup, Chromium); failure screenshots are uploaded as an artifact.The State check depends on #6: on
mainthe State request returns 400 ("Cannot create writable memory view from read-only memoryview").test_state_tabis markedxfail(strict=True)so this PR does not land with a red CI. When #6 merges, the test XPASSes, strict turns that into a failure, and the marker (and its comment) is deleted. The chart test is unaffected.Related Issues/PRs
#6 (fixes the State tab 400), #3
Type of Change
fix)feat)docs)refactor)chore)test): end-to-end browser test plus a CI job to run itChecklist
Testing
Local, Elasticsearch 8.19.5 in Docker, Chromium via Playwright,
pytest -m e2e tests/e2e:main:test_registers_chartpasses;test_state_tabxfails. With--runxfailit fails with400 Cannot create writable memory view from read-only memoryview.main+ fix(registers): give hdbscan a writable array so the State tab works #6 (commit 63984f8 cherry-picked, not part of this PR): both tests pass (test_state_tabreports XPASS(strict), the expected prompt to drop the marker).pytestrun deselects the e2e tests.pip install -e .[all,dev]lines also trigger) and zizmor. The new job's actions are pinned by SHA. The CI job itself has not run yet; this PR's checks are its first run.Additional Notes
The test sets
SESSION_COOKIE_SECURE/CSRF_COOKIE_SECUREto False for the plain-http live server (otherwise the session holding the loaded register data is dropped) andDJANGO_ALLOW_ASYNC_UNSAFEbecause Playwright's sync API runs an event loop in the test thread.🤖 Generated with Claude Code