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

storybookのplay functionが並列で2回動く(MkAdのテストが落ちる) #11267

Closed
saschanaz opened this issue Jul 13, 2023 · 5 comments · Fixed by #14101
Closed

storybookのplay functionが並列で2回動く(MkAdのテストが落ちる) #11267

saschanaz opened this issue Jul 13, 2023 · 5 comments · Fixed by #14101
Labels
🐛Bug Unexpected behavior packages/frontend Client side specific issue/PR ❓needs more investigation A bug whose causes are unknown

Comments

@saschanaz
Copy link
Member

理解できない変なエラーはあれが原因です

なぜそうなるのかは不明

@saschanaz saschanaz changed the title storybookのplay functionが並列で2回動く storybookのplay functionが並列で2回動く(MkAdのテストが落ちる) Jul 15, 2023
@saschanaz saschanaz added 🐛Bug Unexpected behavior ❓needs more investigation A bug whose causes are unknown packages/frontend Client side specific issue/PR labels Jul 16, 2023
@saschanaz
Copy link
Member Author

pnpm build-storybook && pnpm --filter frontend storybook exec devでは問題なく最初のplay()の実行が終わるまでまってもう一度実行される

chromaticにアップロードされたビルドではそうではない

ここを1,

const canvas = within(canvasElement);

ここを2としたら、

await waitFor(() => expect(canvasElement).toHaveTextContent(i18n.ts._ad.back));

ローカルでは:1,2,1,2の順
Chromaticでは:1,1,2,2の順

なぜでしょう @acid-chicken

@acid-chicken
Copy link
Member

えー

@acid-chicken
Copy link
Member

Chromatic のバグじゃね……と思いたいんだけどなぁ
とりあえずセマフォを用意すればワークアラウンドになる……?

@zyoshoka
Copy link
Contributor

このバグのせいで不可逆的な操作を伴うテスト(例えば #13830 で言えば MkClickerGame でボタンが押されたらカウンターが1になることのテスト)が書けないのでなんとかしたいです

深くは調べてませんが v8.1 で実験的に追加された Playwright CT で書き直すのも手?
https://storybook.js.org/blog/portable-stories-for-playwright-ct/

@zyoshoka
Copy link
Contributor

これ普通に

channel.emit(FORCE_REMOUNT, { storyId: context.id });

FORCE_REMOUNT してるのが原因な気がしてます(ここをコメントアウトすると直る)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛Bug Unexpected behavior packages/frontend Client side specific issue/PR ❓needs more investigation A bug whose causes are unknown
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants