Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: VRTを追加 #1688

Merged
merged 42 commits into from
Jan 17, 2024
Merged

Add: VRTを追加 #1688

merged 42 commits into from
Jan 17, 2024

Conversation

sevenc-nanashi
Copy link
Member

内容

Visual Regression Testingを追加します。

関連 Issue

スクリーンショット・動画など

(なし)

その他

(なし)

@sevenc-nanashi sevenc-nanashi requested a review from a team as a code owner January 5, 2024 04:41
@sevenc-nanashi sevenc-nanashi requested review from Hiroshiba and removed request for a team January 5, 2024 04:41
README.md Outdated
Comment on lines 116 to 130
#### スクリーンショットの更新

ブラウザ End to End テストでは Visual Regression Testing を行っています。
以下の手順でスクリーンショットを更新できます:

1. GitHub Actions をフォークしたリポジトリで有効にします。
2. リポジトリの設定の Actions > General > Workflow permissions で Read and write permissions を選択します。
3. `[update snapshots]` という文字列をコミットメッセージに含めてコミットします。

```bash
git commit -m "UIを変更 [update snapshots]"
```

4. 6 分ほどで更新されたスクリーンショットがコミットされます。

Copy link
Member Author

Choose a reason for hiding this comment

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

こんな感じで更新できるようにしてみました。
もしかしたらPR作る感じにした方が良いかも?

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

良いですね!!!ぜひマージしたいです。
ちょっとまずモック用のリソースに関してだけコメントさせて頂きました!!

@Hiroshiba
Copy link
Member

スクロールバーが現れたり現れなかったりするの、謎ですね・・・・・・。

なんとなくなんですが、もしかしてもしかしたらgithub actions上で使っているxvfb-run辺りが原因なのかもとか思いました。
そもそもたぶんこれなくてもCIは動くはず・・・?(headed、つまり画面が明示的に現れての実行はできないけどそもそもいらないはず)

@Hiroshiba
Copy link
Member

うーーーーーーーーーーん。。。。。。。

@Hiroshiba
Copy link
Member

VRTやりたいけど難しいですね。。。。。。
こちら、とりあえずVRTはwinだけにするとかどうでしょう・・・・・・?

@sevenc-nanashi
Copy link
Member Author

Windows限定にしてみました。

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

めちゃくちゃいいですね!!!

ちょっと色々コメントさせていただきましたが、大枠は完璧だと思います!
コメントも適宜書いてくださってすごいわかりやすかったです。

Comment on lines +128 to +129
// eslint-disable-next-line no-constant-condition
while (true) {
Copy link
Member

Choose a reason for hiding this comment

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

これ一生テストが終わらないとかありそうなので、20回ぐらいトライしたらエラーにするみたいな処理書いてもいいかも?
そういうリトライ用の便利関数をutilityに実装しちゃうとかどうでしょう。

Copy link
Member Author

Choose a reason for hiding this comment

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

一生テストが終わらない

Playwright側でタイムアウトしてくれるので大丈夫だと思います。

Copy link
Member

Choose a reason for hiding this comment

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

なるほどです。
タイムアウトが30秒くらいだったとして、本来数秒でわかる問題を発見するのに数十秒かかるのは、まあ避けといたほうが良い気もしました。

ESLintの警告を無視しているのも気になったのですが、調べた感じこれはデフォルトの挙動を変えないかという議論中でした。
eslint/eslint#17807

Copy link
Member

Choose a reason for hiding this comment

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

基本的に多分画面ごとにテストがあって、その中で1つのテストとしてスクリーンショットテストがあるのかなと想像してます。
なのでスクリーンショット.spec.tsは将来的に解体されるかも?

Copy link
Member Author

@sevenc-nanashi sevenc-nanashi left a comment

Choose a reason for hiding this comment

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

レビューを反映しました。

Comment on lines +128 to +129
// eslint-disable-next-line no-constant-condition
while (true) {
Copy link
Member Author

Choose a reason for hiding this comment

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

一生テストが終わらない

Playwright側でタイムアウトしてくれるので大丈夫だと思います。

[update-snapshots]
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

LGTM!!!!!!!!!!!

試しに使ってみるのが非常に楽しみです!!!!!

@Hiroshiba Hiroshiba merged commit 49e2c7c into VOICEVOX:main Jan 17, 2024
Comment on lines +141 to +148
commit-snapshots:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- e2e-test
steps:
- uses: actions/checkout@v3
Copy link
Member

Choose a reason for hiding this comment

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

今気づいたのですが、このjobを実行するかどうかをshouldUpdateSnapshotsの出力から判定できるかもですね。
if: steps.check-whether-to-update-snapshots.outputs.shouldUpdateSnapshots == 'true'をここに書くとかで。

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.

2 participants