playwright install が GitHub Actions で2024年12月以降急に動かなくなったら Playwright をアップデートしよう
#メモ
結論
@storybook/test-runner の dependencies に引っ張られて古いPlaywrightがインストールされていた
https://github.com/storybookjs/test-runner/blob/301bdaed749926be9abc0dc77cdde542988a242e/package.json#L72
Playwright を明示的にインストール(package.jsonのdependenciesに追加)してあげればよい
本来なら、@storybook/test-runnerは Playwright をpeerDependenciesに追加するべきなのかもしれない
過去に peerDependencies から devDependencies に移されていた 🤔
https://github.com/storybookjs/test-runner/commit/ce8395bee3cfb57669cdbb314be6858bd9efc5a9
経緯
Storybook Test Runner を GitHub Actions 上で動かしていたらいきなりなにもしていないのに落ちるようになった/villagepump/何もしてないのに壊れた.icon
ちなみに、この方法で動かしていた: Test runner | Storybook docs
原因調査
エラーを見ると、npx playwright install --with-deps が失敗してそうだった
エラーメッセージ(一部抜粋)
code:txt
Package libicu70 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libasound2' has no installation candidate
E: Package 'libicu70' has no installation candidate
E: Unable to locate package libffi7
E: Unable to locate package libx264-163
Failed to install browsers
Error: Installation process exited with code: 100
エラーメッセージの一部 + Playwright でググると、Ubuntu 24.04 でどうのこうのみたいな issueが出てくる
https://github.com/microsoft/playwright/issues/30368
Github Actionsでubuntu-latestラベルがUbuntu24系になるらしい。 という話があった
先述のPlaywrightのissueを見ると、Playwright 1.45 以上で 24.04 をサポートしているらしい
Playwrightをアップデートをすればよさそう
が、package.jsonの"dependencies"や"devDependencies"には"playwright"はなかった
あなたの Playwright はどこから?
code:txt
❯ npm explain playwright
playwright@1.44.0 dev
node_modules/playwright
playwright@"^1.14.0" from @storybook/test-runner@0.21.0
node_modules/@storybook/test-runner
dev @storybook/test-runner@"^0.21.0" from the root project
@storybook/test-runner@0.21.0 によって、Playwright が自動的に 1.44.0 になっていた
@storybook/test-runner@0.21.0的には、playwright@"^1.14.0" を満たせばよい
最初の^ はマイナーバージョンアップは許容するものなので、最新版の 1.50.1 でもおk
npm semantic version calculator を使うとわかりやすい
解決方法
npm i -D playwright を実行し、最新版としてインストールしてあげるとよい
すると、ちゃんと Ubuntu 24.04 に対応している最新版が入る
code:txt
❯ npm explain playwright
playwright@1.50.1 dev
node_modules/playwright
dev playwright@"^1.50.1" from the root project
playwright@"^1.14.0" from @storybook/test-runner@0.21.0
node_modules/@storybook/test-runner
dev @storybook/test-runner@"^0.21.0" from the root project