Skip to content

test: add a manual driver for the space picker - #240

Merged
NickJosevski merged 1 commit into
nj/space-id-dropdownfrom
nj/space-picker-manual-test
Sep 17, 2026
Merged

NickJosevski merged 1 commit into
nj/space-id-dropdownfrom
nj/space-picker-manual-test

Conversation

@NickJosevski

Copy link
Copy Markdown
Contributor

Draft, and stacked on #239 — it drives selectors that only exist on that branch, so the base is nj/space-id-dropdown rather than main. Retarget to main once #239 merges.

What this is

SpacePickerManualTest walks the space picker through the real containerised stack in a browser and screenshots each state. It is a driver, not a test — it asserts almost nothing. It earns its keep two ways:

  • regenerating the screenshots after a change to the picker's markup;
  • making the id-survives-a-rename behaviour something you can watch rather than infer from unit tests.

The walkthrough ends by renaming the Octopus space out from under an already-saved build step. The stored id keeps resolving while the stored name goes stale — which is the entire reason #239 stores an id:

stored octopus_space_id = Spaces-1   space name field = 'Modern Deployments'
renamed space Spaces-1: 'Modern Deployments' -> 'Swordfish'
still stored: octopus_space_id = Spaces-1   space name field = 'Modern Deployments'
              <- the NAME is now stale, the ID is not
dropdown now offers: [-- select a space --, Swordfish (Spaces-1)]

The free tier permits exactly one space (POST /api/spaces → "You cannot create another space. This would exceed the limits of your current license."), so it renames the one space rather than creating several.

Two modes

# Unattended: headless, no pauses, just captures screenshots.
OCTOPUS_PICKER_DEMO=auto ./gradlew :e2e:e2eTest --tests "*SpacePickerManualTest*"

# Interactive: headed, pausing at each checkpoint so you can click around.
OCTOPUS_PICKER_DEMO=1 ./gradlew :e2e:e2eTest --tests "*SpacePickerManualTest*"

Interactive mode prints the TeamCity URL and admin login, holds the stack open, and names the file to create to continue.

Safe to have in the repo

  • Skipped unless asked for, via assumeTrue, matching LocalOctopusReleaseLinkManualTest. Verified: 1 test, 1 skipped, 0 failures, in 1s, no containers started. This matters — without the gate it would block forever on the first checkpoint file.
  • Writes only under build/reports/space-picker (so clean removes it), overridable with SPACE_PICKER_OUTPUT_DIR. Nothing outside the build directory, nothing tied to one developer's machine.
  • Never prints the API key.
  • Documented under "Interactive manual testing" in docs/e2e-tests.md, including the checkpoint mechanism, which nobody would guess.

Why in this repo rather than its own

It depends on the e2e DSL — OctopusTeamCityStack, SharedStack, TeamCityRest, OctopusProvisioning, PlaywrightUi — which is test-scope and partly package-private. Publishing or duplicating that elsewhere would be disproportionate.

More importantly it hardcodes the plugin's own selectors (button.octopusLoadSpaces, input[name='prop:octopus_space_id'], #octopusConnectionId). Those must change in the same commit as the JSP; out of the repo they would rot silently and the tool would be broken exactly when someone next needed it.

Verification

OCTOPUS_PICKER_DEMO=auto run: BUILD SUCCESSFUL in 3m57s, all 10 screenshots produced, no checkpoint files, containers reaped. spotlessCheck clean.

Two traps documented for anyone extending it

  • Do not set a viewport on the headed browser. A viewport override desyncs the rendered page from the real OS window, and native <select> popups are positioned by the window — they open detached from the control, bottom-right of the screen. Size the window with --window-size instead. Headless tests never open a native popup, so this cannot surface there.
  • The picker's fields are addressed as prop:<property>, because that is how TeamCity's props taglib renders a property's name attribute (the id is the bare property name).

🤖 Generated with Claude Code

Walks the space picker through the real stack in a browser and screenshots each
state. It is a driver rather than a test - it asserts almost nothing - and earns
its place by regenerating the screenshots after a change to the picker's markup,
and by making the id-survives-a-rename behaviour something you can watch rather
than infer.

Two modes. OCTOPUS_PICKER_DEMO=auto runs headless straight through, so it needs
no display and works as a screenshot generator. OCTOPUS_PICKER_DEMO=1 runs
headed and holds the stack open at each checkpoint, resumed by creating the file
it names.

Skipped via assumeTrue unless that variable is set, matching
LocalOctopusReleaseLinkManualTest; without the gate it would block forever on the
first checkpoint. Everything it writes stays under build/reports/space-picker,
overridable with SPACE_PICKER_OUTPUT_DIR, and it never prints the API key.

The free tier permits only one space, so the walkthrough renames that space out
from under an already-saved step rather than creating several.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@NickJosevski
NickJosevski force-pushed the nj/space-picker-manual-test branch from 0383141 to 5d02ae5 Compare September 17, 2026 08:11
@NickJosevski

Copy link
Copy Markdown
Contributor Author

gonna merge this just so there's some "prior art" for this in the repo, instead of getting Claude to re-invent it again. It's just test code in the end, and not part of the pipeline, so cost is low to just delete it if we change our mind.

@NickJosevski
NickJosevski marked this pull request as ready for review September 17, 2026 08:20
@NickJosevski
NickJosevski merged commit 3e46b32 into nj/space-id-dropdown Sep 17, 2026
3 checks passed
@NickJosevski
NickJosevski deleted the nj/space-picker-manual-test branch September 17, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant