Repository navigation
Commit 9edd6e7
test(showcase): the smoke's global setup declines the console's workspace prompt before any spec runs (#29889)
<!-- claude-projects-attribution: {"github_login":"marchtian"} -->
_Requested by **田騏** · [project
thread](https://claude.ai/code/project/chan_01VmuUhXU9SSUzqJYyXSmYSi?thread=cmsg_01VmuUhXU9SSUzqJYyXSmYSi9paTx1Lu8ENYwwssthfK3h)_
Fixes #29811
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:showcase 浏览器冒烟的 `e2e/global-setup.ts`
在所有用例开跑前,用控制台工作区提示框自己的「Not now」按钮把它关掉一次,只把提示框「已问过」的本机记录带进各用例共用的
storageState;没有改任何用例、断言、超时或产品代码。
- **为什么改**:#28953(`2ac698baf1`)让控制台在组织未设默认货币时弹出一个模态框询问管理员。showcase
的开发种子在主机未设区域/区域无国家时不写货币,于是夜间每个用例都撞上这个模态框:背后页面被标成
`aria-hidden`,按角色查找的三个用例(批量操作勾选框、Money 分组按钮、相关列表表格)找不到元素,夜间 live 层因此变红。
- **风险与回滚**:低。只动测试夹具;「Not now」不向工作区写任何东西,showcase
数据与金额显示保持原样;storageState 只多一条提示记录,不带入侧栏展开等其它状态。回滚即回退本 PR。
-
**先看**:`examples/app-showcase/e2e/global-setup.ts`(`declineWorkspacePrompt`
及其返回的记录过滤)。
- **两分钟验证**:`cd examples/app-showcase && CI=1
SMOKE_API_URL=http://localhost:39111 npx playwright test
e2e/bulk-capability-gate.spec.ts e2e/detail-shapes.spec.ts`,预期 4 passed。
- **需要你做的**:无,席位落地。
## What changes
`examples/app-showcase/e2e/global-setup.ts` now answers the console's
one-time workspace prompt once, before any spec runs:
- It reads `GET /api/settings/localization` with the signed-in admin's
token and decides whether the console would ask, by the console's own
condition per key (a timezone still the default and unlocked, or a
currency resolving from the default with no value and unlocked). Nothing
to ask ⇒ nothing is opened.
- Otherwise it opens the showcase app in a browser launched with the
specs' own launch options (so `OS_TEST_CHROMIUM_EXECUTABLE_PATH` holds),
waits for `workspace-timezone-prompt`, and presses
`workspace-timezone-prompt-decline` ("Not now" / "Keep the default").
Declining writes nothing to the workspace.
- It takes ONLY the prompt's per-device record
(`os:workspace-timezone-prompt:ORG:USER`) from that context's
localStorage and adds it to the storageState it already wrote. The rest
of what the console stored while open (the sidebar's wide-open flag,
recent items, the active organization) is left out, so every spec still
starts from the fresh-context layout it measures from; detail-shapes
derives its 780 px window from a context with no stored sidebar state.
- A declined prompt that left no record throws, naming the cause,
because every spec would meet the prompt again. A prompt the backend
says would ask but the console never showed is a warning, as in
`ui/e2e/live/global-setup.ts`, which already answers the same prompt for
the console's own live suite.
No spec, assertion, timeout or product file changes.
### Root cause, per failing test
All three reds have one cause: `2ac698baf1` (#28953, card #28872, "the
workspace prompt also asks an administrator for a still-unset default
currency"), which landed between the last green nightly (`494c7435f8`,
run 41394734666) and the red one (`339f63da30`, run 41584589032). `git
merge-base --is-ancestor 2ac698b`: not an ancestor of `494c7435f8`
(exit 1; control leg on the same shallow checkout: `65a8d4ffb1` =
`494c7435f8~3`, deeper than the tested commit, exit 0), an ancestor of
`339f63da30` (exit 0). The same commit taught
`ui/e2e/live/global-setup.ts` to answer the prompt; the showcase smoke's
global setup was not taught.
The page snapshot of each failure (local reproduction at `4b71a82b76`)
shows `dialog: heading "Set the default currency"` with the console
behind it `aria-hidden`:
1. `bulk-capability-gate.spec.ts:38`: `getByRole('checkbox').first()`
resolves, then the click waits behind the modal overlay until the 45 s
test timeout.
2. `detail-shapes.spec.ts:95`: `getByRole('button', { name: 'Money' })`
excludes the `aria-hidden` subtree, so "Money header icon svg" is not
found. The icon itself renders.
3. `detail-shapes.spec.ts:161`: `getByRole('table')` inside the details
column is excluded for the same reason, so `INV-1002` is not found.
The product change is intended, so the specs stay as they are and the
harness answers the prompt the way a person would.
## Tests
- Reproduced red at base `4b71a82b76`: the two spec files,
`--retries=0`, gave 3 failed and 1 passed, with the same three tests and
the same errors as the nightly.
- Green on head, three consecutive runs of the same two files
(`--retries=0`, `CI=1`, a free port each run): 4 passed, 4 passed, 4
passed. After each run the storageState held exactly
`auth-session-token` and the prompt record.
- `pnpm --filter @objectstack/example-showcase typecheck`: exit 0 (its
tsconfig includes `e2e/**/*`).
- eslint `--no-inline-config` on the changed file: exit 0.
## Acceptance notes
- The other 51 tests in `showcase-smoke.spec.ts` stayed green on the red
night with the same modal over every surface they opened. A "renders
cleanly" check that a modal over the whole page does not disturb is
weaker than its name. Noted here only; no card.
- Answering with "Not now" keeps the showcase as seeded. The prompt's
confirm arm (writing the browser region's currency) is not exercised by
this smoke, as before.
- No changeset: `@objectstack/example-showcase` is private and the diff
is an e2e fixture. Labelled `skip-changeset`.
## Verification
<details><summary>Derived gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 32 commands for the 1 changed path. Each
one was run with its exit code captured before any pipe: 31 exit 0, and
`pnpm check:dual-build-cjs-loads` exit 3 (PREREQUISITE NOT MET: some
packages had no `dist/` in this worktree, so nothing was measured; CI's
Lint & Repo Gates runs it). `--ran` reconciliation: 32 derived families
accounted for, 31 run, 1 NOT-MEASURED, 0 UNRUN.
</details>
<details><summary>Full showcase live test</summary>
`OS_TEST_TIERS=nightly pnpm --filter @objectstack/example-showcase test`
under the verify lock, twice on head `835ac408b2` (main `4b71a82b76`),
Console and the showcase's dependency closure built at that tree:
- `test/showcase-smoke.live.test.ts` (this card's file): passed both
times, Playwright `54 passed`.
- `test/console-live-specs.live.test.ts`: failed both times on ONE spec
of `ui/e2e/live/`, `record-history-display.spec.ts:56` ("the timeline
stream's Changes chip shows display values"). The Owner and Customer
Since change lines render as field names with no values, so `Live E2E
showcase_manager` is not found. That file passed on the red nightly at
`339f63da30`, and it boots its own backend and its own global setup
(`ui/e2e/live/global-setup.ts`), which this diff does not touch. So the
package command exited 1 (lock VERDICT `command-exit 1`, twice). The
cause is not attributed here; it is reported to the seat as a finding
outside this card.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent aad5ee0 commit 9edd6e7
1 file changed
Lines changed: 101 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
40 | 139 | | |
0 commit comments