GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Stage 6: 旧 Tauri 版 e2e 22 spec を Electron renderer-only モードへ移植 by ymnao · Pull Request #18 · ymnao/scripta

Conversation

@ymnao

@ymnao ymnao commented May 7, 2026

Copy link
Copy Markdown
Owner

概要

旧 Tauri 版 e2e(/Users/nakiym/development/tools/scripta/e2e/)の残 22 spec を Electron renderer-only モードへ全移植。前回 Stage 6-2 (#17) で smoke / sidebar-toggle の 2 spec を含めて基盤と PoC を整えていたので、今回でカバレッジ 24 → 24(旧 → 新)に到達した。

関連 Issue

なし

移行 Stage

  • Stage 0: 雛形 + フロント表示確認
  • Stage 1: ファイル I/O
  • Stage 2: ワークスペース・ファイルツリー・ファイル監視
  • Stage 3: 全文検索(ripgrep sidecar)
  • Stage 4: Git Sync
  • Stage 5: OGP / PDF / アップデート
  • Stage 6: 仕上げ・配布・切り替え

変更内容

移植 spec(22 ファイル / 約 3000 行)

機能群 ファイル ケース数
設定 settings-persistence.spec.ts / settings-dialog.spec.ts 4 / 12
ファイル編集 file-editing.spec.ts 4
タブ管理 tab-management.spec.ts 9
検索 search.spec.ts / command-palette.spec.ts 8 / 5
Wikilink wikilink.spec.ts / unresolved-wikilinks.spec.ts 4 / 11
Live Preview formatting.spec.ts / heading-live-preview.spec.ts 2 / 8
Widget mermaid-widget.spec.ts / math-preview.spec.ts / link-cards.spec.ts 7 / 2 / 3
エクスポート export.spec.ts / slide-view.spec.ts 7 / 6
File Watcher file-watcher.spec.ts 6
UI / その他 code-block-copy / context-menu / help-dialog / scratchpad / status-bar / workspace 1 / 7 / 4 / 4 / 4 / 7

Helper 拡張

  • e2e/helpers/assertions.ts 新設 — waitForUnsaved / waitForSaved
  • e2e/helpers/electron-api-mock.ts に simulateFileCreate / simulateFileModify / simulateFileDelete を追加(fs 状態の更新と fs-change イベント発火を 1 メソッドに集約)

移植時の主な置換ルール

  • TauriMock → ElectronApiMock(既存)
  • getCalls("write_file") → getCalls("writeFile") 等(snake_case → camelCase)
  • 引数アクセスを c.path / c.content から positional 配列 c[0] / c[1] へ
  • __TAURI_EVENT__.emit("menu-export") → mock.emitMenuEvent("export")
  • __TAURI_WINDOW__.closeCalled 待機 → expect.poll(getCalls("closeWindow").length)
  • addFetchOgpMock の override は廃止(mock の null OgpData でも .cm-link-card は loading 状態で即時レンダリングされるため不要)

simplify レビュー反映

  • waitForTimeout(100) × 3(clipboard)→ expect.poll(...).toBe(...) で flakiness 排除
  • waitForTimeout(500) (export no-op) → not.toBeVisible({ timeout: 500 }) に統合
  • 移植ナレーションコメント("Tauri menu-export → Electron event" 等)を 6 ファイルから削除(commit 履歴に同情報あり、spec 内では rot するのみ)

弱い assertion の修正

対象 強化内容
settings-persistence sidebar=false NewTabContent の "ワークスペース検索" ボタン (hasWorkspace=true 専用) を assert して「workspace 復元成功 + sidebar 隠し」を検出
unresolved-wikilinks 参照件数バッジ .search-panel-file-count の値を直接検証(missing-page="2" / another-missing="1")
unresolved-wikilinks ソートトグル toHaveText(配列) で名前順 → 件数順 → 名前順の往復を順序付き検証
unresolved-wikilinks ファイル作成 createFile 0 回 / writeNewFile 1 回のみ + パス exact match
file-editing autosave lastCall[0] / [1] で processContent 後のペイロード # Hello World updated\n を直接検証
file-editing Cmd+S expect.poll の timeout: 1000 で autosave debounce (2000ms) より明確に短い時間で writeFile が走ることを検証
tab-management Cmd+クリック modifiers: ["Meta"] 直書きを [modKey] に修正(Linux/Windows CI 互換)
command-palette 候補 getByRole("listbox").getByRole("option") でパレット内にスコープ + Enter 前に selected: true の先頭候補を assert

動作確認

  • pnpm typecheck:e2e (手元で tsc --noEmit -p tsconfig.e2e.json) — green
  • pnpm lint (手元で biome check e2e/) — green
  • pnpm test:e2e — ローカル sandbox では Vite の port bind (EPERM) で実行不可、CI で実行検証
  • CI(GitHub Actions の e2e job)の green を確認

スクリーンショット

なし(テストコードのみの追加)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ymnao added 7 commits May 7, 2026 21:17
@ymnao
feat: e2e テストを 4 spec 追加(settings / file-editing / tab-management)
f70495a
旧 Tauri 版 e2e の優先度高 4 ファイル(合計 29 ケース)を Electron renderer-only
モードに移植。

- e2e/helpers/assertions.ts: waitForUnsaved / waitForSaved を新設
- e2e/settings-persistence.spec.ts (4 ケース): __STORE_INIT__ →
  ElectronApiMock の settings 引数に置換。newWindow / 無効パス fallback を含む
- e2e/settings-dialog.spec.ts (12 ケース): Cmd+, でダイアログを開いてセクション
  ナビ / トグル / フォント変更が反映されること等を検証。Ko-fi ボタンは
  shell:open → openExternal にマッピングし positional 引数形式 [[url]] で照合
- e2e/file-editing.spec.ts (4 ケース): エディタ表示 / 未保存ステータス /
  autosave / Cmd+S。writeFile の引数チェックを Electron の positional 配列形式に
  変更
- e2e/tab-management.spec.ts (9 ケース): タブ開閉 / 切り替え / Cmd+W /
  Cmd+Shift+W。__TAURI_WINDOW__.closeCalled 待機を
  expect.poll(getCalls("closeWindow").length) に置換

ローカル sandbox では Vite の port bind (EPERM) で test:e2e は実行不可。
typecheck:e2e と biome check は green、CI で実行検証する想定。
@ymnao
feat: 検索 / wikilink / Live Preview / widget 系 e2e を 9 spec 移植
2e3a15f
旧 Tauri 版 e2e の機能系から 9 ファイル(合計 36 ケース)を移植。

- search.spec.ts (8 ケース): in-file 検索(Cmd+F / Cmd+H / マッチ件数 / 移動 /
  expand-collapse)と workspace 全文検索(Cmd+Shift+F / 結果 navigation /
  サロゲートペア行のハイライト位置)。mock の searchFiles は本番 parity 済み
  (buildLowerToOrigUtf16Map)なので emoji ハイライトもそのまま動作する想定
- command-palette.spec.ts (5 ケース): Cmd+P / 絞り込み / Enter で開く / バック
  ドロップで閉じる
- wikilink.spec.ts (4 ケース): [[page]] のレンダリング / missing クリック →
  ディレクトリピッカー / ナビゲーション
- unresolved-wikilinks.spec.ts (11 ケース): パネル表示 / Cmd+Shift+U /
  ファイル作成 / ホバーポップアップ / workspace スコープ。createFile /
  writeNewFile への getCalls 名を Electron 側にリネーム
- formatting.spec.ts (2 ケース): Cmd+B / Cmd+Shift+X
- heading-live-preview.spec.ts (8 ケース): heading-2/3 デコレーション /
  アトミックマーク削除 / 先頭行隠しプレフィクスのカーソル挙動 / blockquote
- mermaid-widget.spec.ts (7 ケース): SVG レンダリング / コンテキストメニュー
  (編集 / 挿入 / 削除)/ ドラッグ選択
- math-preview.spec.ts (2 ケース): KaTeX レンダリング / カーソル接近で解除
- link-cards.spec.ts (3 ケース): 単独 URL のカード化 / インライン除外 /
  カーソル接近で解除。Tauri 版は addFetchOgpMock で title/description を返して
  いたが、Electron mock の null OgpData でも widget は loading 状態で
  cm-link-card 要素を即時レンダリングするので可視性 / カウントは parity 維持

writeFile / exportPdf 等の getCalls は positional 配列形式([path, content]
等)に書き換え。Setup Wizard が editor 操作を遮らないよう、Live Preview /
mermaid 系では .scripta/initialized.json を fs に追加(fileExists で
isWorkspaceInitialized = true → ウィザード非表示)。
@ymnao
feat: file-watcher / export / slide e2e を移植 + simulateFile* helper を追加
49d2a8a
- e2e/helpers/electron-api-mock.ts: simulateFileCreate / simulateFileModify /
  simulateFileDelete を追加。fs 状態(files / directories)の更新と fs-change
  イベント発火を 1 メソッドにまとめ、外部 fs 変更の再現を簡潔に書ける
- file-watcher.spec.ts (6 ケース): 作成 / 更新 / 削除 / dirty タブの conflict
  ダイアログ / workspace 切替時の startWatcher 起動。getCalls("startWatcher")
  の引数チェックは positional 配列形式 c[0] === "/workspace1" に変更
- export.spec.ts (7 ケース): メニューイベント / Cmd+Shift+E / セクション
  切替(HTML/PDF/プロンプト)/ コンテキストメニュー。Tauri の
  __TAURI_EVENT__.emit("menu-export") は mock.emitMenuEvent("export") に置換、
  saveDialogResult はオプション 4 番目から名前付きオプションに変更、
  writeFile / exportPdf の引数チェックは positional 配列形式に変更
- slide-view.spec.ts (6 ケース): Cmd+Shift+S トグル / プレビュー追従 /
  ヘルプダイアログ表示
@ymnao
feat: UI / workspace 系 e2e を 6 spec 移植
d4f3411
旧 Tauri 版 e2e の UI 系を移植して残 22 spec を完了。

- code-block-copy.spec.ts (1 ケース): コードブロックホバー → コピーボタン
  フォーカス → Enter でクリップボード書き込み
- context-menu.spec.ts (7 ケース): エディタ右クリックメニュー(選択あり/なし
  でメニュー項目が切り替わる / 太字 / 水平線 / コピー / 切り取り)。clipboard
  操作は context.grantPermissions が必要
- help-dialog.spec.ts (4 ケース): F1 / Escape / バックドロップクリック /
  狭ビューポートでスクロール
- scratchpad.spec.ts (4 ケース): Cmd+J 開閉 / 閉じるボタン / ステータスバー /
  設定ダイアログから volatile トグル
- status-bar.spec.ts (4 ケース): カーソル位置 / ファイルパス / 選択範囲表示
- workspace.spec.ts (7 ケース): ファイルツリー / フォルダ展開 / showInFolder
  コマンド / createDirectory / empty state / 削除 / アイコン設定ダイアログ。
  show_in_folder / create_directory / create_file → Electron の showInFolder /
  createDirectory / createFile に getCalls 名を変更し引数も positional 配列形式
  ([path]) に書き換え

全 22 spec の移植が完了(前回 sidebar-toggle / smoke を含めれば 24 → 24)。
ローカル sandbox では Vite の port bind (EPERM) で test:e2e は実行不可、
typecheck:e2e と biome check は green、CI で実行検証する想定。
@ymnao
refactor: e2e の固定 sleep を expect.poll に置換 + 移植ナレーションコメントを除去
02174f8
simplify レビュー指摘の対応:

- code-block-copy / context-menu の clipboard 検証 3 箇所で
  page.waitForTimeout(100) + page.evaluate(...) を expect.poll(...).toBe(...)
  に置換。固定 sleep の flaky 要素を排除し失敗時のリトライを利かせる
- export.spec.ts の menu-export no-op 検証で page.waitForTimeout(500) を
  expect(dialog).not.toBeVisible({ timeout: 500 }) に統合。同じ防御性で
  記述が短くなる
- 移植時の状況を解説するだけのコメント("Tauri menu-export → Electron
  menu event"、"Electron mock は positional 配列 [path, content]"、
  "Electron 移植: createFile / writeNewFile (旧 ... から rename)" 等)を
  6 ファイルから削除。コミット履歴に同じ情報があり、spec 内では rot するだけ
@ymnao
fix: e2e の弱い assertion を修正して回帰検知力を上げる
deb8bfc
レビュー指摘 3 件への対応:

- settings-persistence.spec.ts: sidebarVisible=false のテストで
  「workspace 復元失敗 + 空状態」と「workspace 復元成功 + sidebar 非表示」を
  区別できていなかった。NewTabContent の "ワークスペース検索" ボタンは
  hasWorkspace=true でのみ描画されるので、これと Open folder 非表示を併せて
  assert することで本来の意図(復元成功 + sidebar 隠し)を正しく検出する
- unresolved-wikilinks.spec.ts:
  - 各リンクの参照件数バッジテストはバッジを 1 つも assert していなかった。
    .search-panel-file-header から .search-panel-file-count を引いて
    missing-page="2" / another-missing="1" を直接検証
  - ソートトグルテストは順序を見ていなかった。.search-panel-file-name の
    toHaveText(配列) で名前順 / 件数順 / 名前順の往復を順序付き検証
  - 「ファイル作成できる」テストは >= 1 回呼び出ししか見ておらず、誤った
    パスへの作成や二重作成が通っていた。createFile 0 回 / writeNewFile 1 回
    のみ + パスは "/workspace/another-missing.md" を assert
- file-editing.spec.ts:
  - autosave テストで保存内容を assert していなかった。lastCall[0] / [1] で
    パス + processContent 後のペイロード("# Hello World updated\n")を直接
    検証
  - Cmd+S テストが autosave debounce で代替されても通っていた。
    expect.poll の timeout を 1000ms に絞り、autosave のデフォルト 2000ms
    debounce より明確に短い時間で writeFile が走ることを検証することで
    Cmd+S ハンドラの回帰を捕捉
@ymnao
fix: e2e のクロスプラットフォーム / palette スコープを修正
a52db8f
レビュー指摘 2 件への対応:

- tab-management.spec.ts: Cmd+クリック 5 箇所で modifiers: ["Meta"] を直書き
  していたため Linux/Windows CI では Ctrl+クリック を再現できず失敗する
  可能性があった。modKey を modifiers 配列に渡す形に統一し、キーボード
  ショートカットと挙動を揃える(実装側は e.metaKey || e.ctrlKey で判定、
  src/components/filetree/FileTreeItem.tsx:150)
- command-palette.spec.ts: パレットの assertion が page.getByText(...).first()
  ベースで、背後のファイルツリーにある同名テキストでも通る false positive
  だった。page.getByRole("listbox", { name: "File results" })
  .getByRole("option") でパレット内にスコープ
  - 全ファイル表示テスト: option 数 3 + 順序 (basename byte sort)
  - 絞り込みテスト: hello.md / notes.md が消えて readme.md だけ残る
    (option 数 1)
  - Enter テスト: 押下前に getByRole("option", { selected: true }) で
    先頭の hello.md が選択中であることを保証してから Enter。selectedIndex
    の初期化バグ(例: index=-1 で 0 番目以外が開く)の回帰を捕捉
Copilot AI review requested due to automatic review settings May 7, 2026 15:14
Copilot started reviewing on behalf of ymnao May 7, 2026 15:15
View session
Copilot AI reviewed May 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ymnao
ymnao merged commit edea589 into main May 7, 2026
8 of 9 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ymnao
ymnao deleted the feature/stage-6-e2e-port-batch-1 branch May 7, 2026 15:48
ymnao added a commit that referenced this pull request Jun 19, 2026
@ymnao
chore: undici security advisory 9 件を parent>child override で対応 (#201)
095af69
@electron/get / jsdom 経由の undici 7.25.0 と node-gyp 経由の 6.25.0 を
それぞれ patched 版 (^7.28.0 / ^6.27.0) に固定して open alert を解消する。

対象 alert (9 件):
- #10 GHSA-pr7r-676h-xcf6 (medium) — cross-user info disclosure via shared cache whitespace bypass (7.x)
- #11 GHSA-vmh5-mc38-953g (high)   — TLS certificate validation bypass via dropped requestTls in SOCKS5 ProxyAgent (7.x)
- #12 GHSA-35p6-xmwp-9g52 (low)    — HTTP response queue poisoning via keep-alive socket reuse (6.x)
- #13 GHSA-35p6-xmwp-9g52 (low)    — 同上 (7.x)
- #14 GHSA-hm92-r4w5-c3mj (high)   — cross-origin request routing via SOCKS5 proxy pool reuse (7.x)
- #17 GHSA-p88m-4jfj-68fv (medium) — HTTP header injection via Set-Cookie percent-decoding (6.x)
- #18 GHSA-p88m-4jfj-68fv (medium) — 同上 (7.x)
- #19 GHSA-g8m3-5g58-fq7m (low)    — Set-Cookie SameSite downgrade via permissive substring matching (6.x)
- #20 GHSA-g8m3-5g58-fq7m (low)    — 同上 (7.x)

parent 特定:
- `@electron/[email protected]` (electron の devDep transitive) が optionalDep として undici 7.25.0
- `[email protected]` (Vitest の DOM 環境用 devDep) が undici 7.25.0
- `[email protected]` (@electron/rebuild → electron-builder 経由) が undici 6.25.0

実害評価: いずれも build/test time の transitive で本リポ runtime は触らない。
SOCKS5 ProxyAgent / shared cache / 攻撃者制御 Set-Cookie 等の前提を満たさないが、
alert closed 化が目的で patch を適用。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ymnao
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.