Skip to content

Fix/stablize Robot test infrastructure with data-testid selectors#154

Merged
tanner37 merged 2 commits into
Protospace:masterfrom
khorovatin:fix/sign-data-testid-selectors
Jul 24, 2026
Merged

Fix/stablize Robot test infrastructure with data-testid selectors#154
tanner37 merged 2 commits into
Protospace:masterfrom
khorovatin:fix/sign-data-testid-selectors

Conversation

@khorovatin

Copy link
Copy Markdown
Contributor

Problems

  1. Fragile DOM selectorsPublicMessagingPage.resource used positional
    selectors (nth=7, nth=8, text=Submit >> nth=0/1) that break on any DOM change.
  2. Text-coupled page-ready guardWait Until Spaceport Page Ready waited for
    text=Protospace Stats, tying test startup to a string that could change.
  3. Page Should Contain Text did a full body dump — the keyword grabbed all body
    text and used Should Contain, which never waits; assertions could pass before
    content finished rendering.
  4. Charts link selector ambiguitytext=[charts] passes [charts] as a CSS
    attribute selector to Playwright, not a text match.
  5. HEADLESS defaulted to False — CI environments have no display server;
    tests would fail or require an Xvfb wrapper.
  6. VALID_PASSWORD committed in source — credentials should come from environment
    variables.
  7. Debug screenshots overwrote each otherTest Teardown Capture Debug Artifact smoke fired unconditionally on every test and always wrote the same filename,
    leaving only the last screenshot.
  8. No one-step setup script — developers had to remember to run pip install
    and rfbrowser init separately.

Solution

Add data-testid attributes to stable DOM landmarks in the React source, then update
all Robot selectors and infrastructure keywords to use them.

Changes

webclient/src/Sign.js

  • SignForm — added data-testid='sign-and-vestaboard-input' / data-testid='sign-and-vestaboard-submit'
  • VestaboardForm — added data-testid='vestaboard-only-input' / data-testid='vestaboard-only-submit'

webclient/src/Home.js

  • Wrapped the entire stats block in <div data-testid="home-stats-section"> for a
    stable page-ready anchor

tests/robot/pages/PublicMessagingPage.resource

  • Replaced all positional nth= and text=Submit >> nth= selectors with
    [data-testid="..."] CSS attribute selectors

tests/robot/pages/LandingPage.resource

  • Fixed Charts Link Should Navigate to use a:has-text("[charts]") (Playwright CSS)
    instead of text=[charts] (ambiguous CSS attribute selector)

tests/robot/resources/Common.resource

  • Wait Until Spaceport Page Ready — now waits on [data-testid="home-stats-section"]
    instead of a text string
  • Page Should Contain Text — replaced body dump + Should Contain with
    Wait For Elements State ... visible so assertions properly wait for the element

tests/robot/resources/Variables.resource

  • HEADLESS${True} (CI-safe default; developers override with -v HEADLESS:False)
  • VALID_PASSWORD%{TEST_PASSWORD=TestPass123!} (env-var with fallback)

tests/robot/tests/smoke.robot

  • Test TeardownRun Keyword If Test Failed Capture Debug Artifact ${TEST NAME}
    — screenshots now fire only on failure and use the test name for unique filenames

tests/robot/setup.sh (new)

  • Single script that chains pip install -r requirements.txt + rfbrowser init

khorovatin and others added 2 commits July 23, 2026 14:48
Replace brittle positional selectors (input >> nth=7, input >> nth=8)
with stable data-testid attributes on the Sign and Vestaboard form
inputs and submit buttons.

- SignForm: data-testid='sign-and-vestaboard-input' / 'sign-and-vestaboard-submit'
- VestaboardForm: data-testid='vestaboard-only-input' / 'vestaboard-only-submit'
- Update PublicMessagingPage.resource selectors accordingly

Co-Authored-By: GAIA Code <noreply@gaiacode.pro>
- Add data-testid='home-stats-section' to Home.js stats div for stable
  page-ready detection instead of text-coupled selectors
- Fix Wait Until Spaceport Page Ready to use data-testid selector
- Replace Page Should Contain Text body-dump with Wait For Elements State
  scoped assertions throughout Common.resource and LandingPage.resource
- Fix Charts Link Should Navigate to use has-text() instead of bare
  text=[charts] which has CSS metacharacter ambiguity
- Default HEADLESS to True so CI works without a display server;
  developers override with -v HEADLESS:False
- Move VALID_PASSWORD to env-var pattern (%{TEST_PASSWORD=...}) so
  credentials are never committed to source
- Fix Test Teardown in smoke.robot to fire only on failure and use
  ${TEST NAME} for unique per-test screenshot filenames
- Add setup.sh to chain pip install + rfbrowser init in one step

Co-Authored-By: GAIA Code <noreply@gaiacode.pro>
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