Merge pull request '修复 CreatorPages 回关用例在并发负载下的偶发失败(修 CI flaky)' (#646) from fix/creator-follow-flaky into master
Project CI / AI game creator shell Rust lane 1/2 (push) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (push) Has been cancelled
Project CI / AI game creator shell Rust crates (push) Has been cancelled
Project CI / Backend tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
Project CI / Frontend tests (push) Has been cancelled
Project CI / Repository checks (push) Has been cancelled
Project CI / AI game creator shell web tests (push) Has been cancelled

Reviewed-on: http://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/646
This commit was merged in pull request #646.
This commit is contained in:
2026-10-06 15:23:05 +08:00
+7 -2
View File
@@ -138,10 +138,15 @@ it('自己的粉丝支持回关和取消回关,移除须确认且只移除该
total: 1,
});
render(<CreatorConnectionsPage id="a" tab="followers" {...callbacks} />);
await screen.findByRole('button', { name: '回关' });
// 关系 store 的 seed 晚于行首帧,此时按钮仍是 disabled;React 不会对 disabled
// 元素派发 onClick,必须先等到按钮可用再点,否则这次点击会被直接吞掉。
const back = (await screen.findByRole('button', {
name: '回关',
})) as HTMLButtonElement;
await waitFor(() => expect(back.disabled).toBe(false));
api.write.mockResolvedValue({ relationship: following });
api.list.mockResolvedValue({ items: [row()], nextCursor: null, total: 1 });
fireEvent.click(screen.getByRole('button', { name: '回关' }));
fireEvent.click(back);
await screen.findByRole('button', { name: '取消关注' });
expect(api.write).toHaveBeenLastCalledWith('b', 'follow');
fireEvent.click(screen.getByRole('button', { name: '移除粉丝' }));