diff --git a/packages/frontend/src/components/global/MkAd.stories.impl.ts b/packages/frontend/src/components/global/MkAd.stories.impl.ts index 3e4420fad..bd6202721 100644 --- a/packages/frontend/src/components/global/MkAd.stories.impl.ts +++ b/packages/frontend/src/components/global/MkAd.stories.impl.ts @@ -36,7 +36,8 @@ const common = { const i = buttons[0]; await expect(i).toBeInTheDocument(); await userEvent.click(i); - await waitFor(() => expect(a).not.toBeInTheDocument()); + await waitFor(() => expect(canvas).toHaveTextContent(i18n.ts._ad.back)); + await expect(a).not.toBeInTheDocument(); await expect(i).not.toBeInTheDocument(); buttons = canvas.getAllByRole('button'); await expect(buttons).toHaveLength(args.__hasReduce ? 2 : 1); @@ -49,10 +50,11 @@ const common = { await expect(back).toBeInTheDocument(); await expect(back).toHaveTextContent(i18n.ts._ad.back); await userEvent.click(back); - await waitFor(() => expect(back).not.toBeInTheDocument()); + await waitFor(() => expect(canvas.queryByRole('img')).toBeTruthy()); if (reduce) { await expect(reduce).not.toBeInTheDocument(); } + await expect(back).not.toBeInTheDocument() const aAgain = canvas.getByRole('link'); await expect(aAgain).toBeInTheDocument(); const imgAgain = within(aAgain).getByRole('img');