test(e2e): adapt to 3.23.0 approval and UI changes; never adopt a foreign server by zchpeter · Pull Request #21533 · bytebase/bytebase · GitHub
Skip to content

test(e2e): adapt to 3.23.0 approval and UI changes; never adopt a foreign server - #21533

Closed
zchpeter wants to merge 2 commits into
mainfrom
cc/bytebase-e2e-test-triage-1beb4d
Closed

zchpeter wants to merge 2 commits into
mainfrom
cc/bytebase-e2e-test-triage-1beb4d

Conversation

@zchpeter

Copy link
Copy Markdown
Collaborator

Summary

The e2e suite is not in any CI workflow and had not run since 2026-08-31. On 3.23.0 (c8188c6354) it went 191 passed, 12 failed, 6 not run. Every failure traces to a product change the specs had not caught up with. This PR adapts them, repairs a known-bug lock that had stopped testing its bug, and fixes a harness bug that let one run configure another session's server.

Failing tests Product change Test change
lifecycle R4, review CUJ B and CUJ I, rollout ×2, plus the 6 tests their serial blocks skipped #21298: approval by the last plan editor is a separate project permission, denied in new projects and cumulative with self-approval authorMayApprove() in plan-helpers.ts sets both; the specs snapshot and restore both; the API client learns allowLastPlanEditorApproval
issue-detail-targets (BYT-9558) #21300 renamed the row's rounded-lg class Count rows by the database names the test owns; find the scroll container by computed style
sql-editor-connection (BYT-9616) #21438: the database page entry is now the "Open SQL Editor" link Role and name locator
sql-editor-export C1 #21489: the format radios became a Select Open the Select and assert each option
workspace-general-settings W1, W2 #21489: the checkbox became a switch Role switch
workspace-mcp-policy M1 #21517: the description became {{bound}} {{audit}} with new audit copy Interpolate the template; the pinned audit disclosure follows #21517's copy and must appear once

Also:

  • Saved-query R26 lock (test.fail(), "Duplicate drops the SQL body"): it waited for the pre-refactor: rename worksheet to saved query across API, backend, and frontend #21159 /sheets/ URL, so it failed on a timeout instead of on the bug. It now fails on the bug, which is still present: Expected "SELECT 42;", Received "".
  • Harness: checkPort probed 127.0.0.1, which macOS lets bind beside another process's wildcard listener. A run started on 18234 while another session's server held *:18234; its own server died with EADDRINUSE, and globalSetup signed up, installed the license, and created users on the foreign server. checkPort now also requires that nothing answers a loopback connect, and binds 0.0.0.0 like the server. Every startup poll aborts once the spawned server exits.
  • Review CUJ M narrow viewport (second commit): the thread walker is a Monaco overlay widget that Monaco repositions a frame or more after a resize. The test measured once and failed whenever that layout lagged (walker right edge 982 against an editor edge of 446, with the failure screenshot showing the walker correctly placed). It now polls the three geometry checks until they hold.
  • frontend/tests/e2e/AGENTS.md: why utility classes are unsafe locators, and the two approval permissions.

Test plan

  • pnpm test in frontend/ on the rebased branch: every gate stage, 5,790 unit tests
  • e2e specs type-check (a throwaway tsconfig; no gate includes tests/e2e)
  • Full licensed e2e suite on a binary built from this branch rebased on 80341df862: 207 passed, 2 failed. The two failures are sql-editor-schema.spec.ts:311 (the product bug below) and the CUJ M narrow-viewport race, fixed in the second commit. After that fix, CUJ M passed 3 of 3 with --repeat-each=3.
  • Harness fix, old vs new module code: with a decoy on [::]:PORT, the old findAvailablePort picked the port and the new one skipped it, with 0 HTTP requests to the decoy; with a server that exits at once, the old code waited out the timeout and the new one aborted in about 0.5 s

Known red after this PR: sql-editor-schema.spec.ts:311 ("View detail" on a table). It is a product bug, not drift: while the pointer rests on a table row, the SQL Editor schema tree remounts its rows every frame, so the right-click never settles and the table hover card never appears. The fix will be a separate PR.

🤖 Generated with Claude Code

zchpeter and others added 2 commits September 24, 2026 10:20
…eign server

The suite had not run since 2026-08-31. On c8188c6 (3.23.0) it went
191 passed, 12 failed, 6 not run, and every failure traces to a product
change the specs had not caught up with:

- #21298 added approval by the last plan editor as a project permission
  that new projects deny, cumulative with self-approval. The admin that
  creates and approves its own plans needs both, so authorMayApprove()
  sets them together and the specs snapshot and restore both fields. This
  fixes 5 failures and the 6 tests their serial blocks skipped.
- #21300 renamed the targets-sheet row class. Count rows by the database
  names the test owns, and find the scroll container by computed style.
- #21438 moved the database page's entry to an "Open SQL Editor" link.
- #21489 turned the export format radios into a Select and the
  data-export checkbox into a switch.
- #21517 made the MCP policy description a {{bound}} {{audit}} template
  with new audit copy; the pinned audit disclosure follows that copy.
- The saved-query Duplicate lock waited for the pre-#21159 /sheets/ URL,
  so it failed on a timeout instead of on the dropped SQL body it holds.

The framework's port probe bound 127.0.0.1, which macOS allows beside
another process's wildcard listener. A run started on a port another
session's server held, its own server died with EADDRINUSE, and
globalSetup configured the foreign server instead. checkPort now also
requires that nothing answers a loopback connect and binds 0.0.0.0 like
the server, and every startup poll aborts once the spawned server exits.

AGENTS.md records the utility-class locator rule and the two approval
permissions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The walker is a Monaco overlay widget, which Monaco positions in its own
layout pass a frame or more after the viewport changes. The narrow-view
test measured once right after toBeVisible, which already holds at the
stale wide-viewport position, so it failed whenever that layout lagged
(right edge 982 against an editor edge of 446 at a 480 px viewport,
while the failure screenshot showed the walker in the corner). Poll the
three geometry checks together until they hold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zchpeter

Copy link
Copy Markdown
Collaborator Author

@zchpeter zchpeter closed this Oct 22, 2026
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