Repository navigation
✅ Test(gui): wait for schema sync in plugin detail panel tests - #1449
Merged
Merged
Conversation
Mode is hydrated synchronously, but Verbosity / API version only show the saved values after the async refreshConfigSchema call resolves with the advanced-state choices. Both tests waited for Mode and then asserted the dependent fields synchronously, so on a slow CI runner they could still see the placeholder ("verbosity▼"). Move those assertions into waitFor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
背景
plugin-detail-panel.spec.tsx在 CI 上偶发失败,例如 https://github.com/Molunerfinn/PicGo/actions/runs/37287839458/job/111690891506 :同一个 commit 在 master 上是通过的。
原因
use-plugin-config-section.ts先同步执行setValues(hydrated),Mode 立刻显示advanced;Verbosity / API version 的可选项则要等异步的refreshConfigSchema返回 advanced 状态的 schema 后才有debug/v2。在那之前,Select 显示的是占位文本(field.name)。两个用例都只用
waitFor等 Mode,之后对 Verbosity / API version 的断言是同步的。CI 机器慢的时候,断言执行时 schema 还没回来,于是失败。改动
把两个用例里 Verbosity / API version 的断言都挪进
waitFor。只改了测试,业务代码不变。验证
refreshConfigSchema的 mock 加 100ms 延迟:修改前两个用例都稳定失败,报错和 CI 上一致;修改后两个用例都通过