GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Stage 6: 旧 Tauri 版 e2e 22 spec を Electron renderer-only モードへ移植 by ymnao · Pull Request #18 · ymnao/scripta Conversation
Owner
概要旧 Tauri 版 e2e( 関連 Issueなし 移行 Stage
変更内容移植 spec(22 ファイル / 約 3000 行)
Helper 拡張
移植時の主な置換ルール
simplify レビュー反映
弱い assertion の修正
動作確認
スクリーンショットなし(テストコードのみの追加)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions旧 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 で実行検証する想定。
旧 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 → ウィザード非表示)。 - 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 トグル / プレビュー追従 /
ヘルプダイアログ表示
旧 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 で実行検証する想定。 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 するだけ
レビュー指摘 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 ハンドラの回帰を捕捉
レビュー指摘 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 番目以外が開く)の回帰を捕捉
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 reactionsUh oh!
There was an error while loading. Please reload this page.
ymnao
added a commit
that referenced
this pull request
@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.
Uh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. |