From f3f57e66f5e1c78c0e8cb400b618c30f02fe46a3 Mon Sep 17 00:00:00 2001 From: Sanaei Date: Wed, 12 Aug 2026 16:43:57 +0200 Subject: [PATCH] fix(frontend): wait out Collapse fade before a11y scan in ConfigBlock story Collapse animates opacity in over motionDurationMid; the Collapsed story's play function only waited for visibility, so the addon-a11y color-contrast check could sample a mid-fade, lower-contrast frame and fail flakily in CI. Wait for the panel's opacity to settle to 1 first. --- frontend/src/components/clients/ConfigBlock.stories.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/clients/ConfigBlock.stories.tsx b/frontend/src/components/clients/ConfigBlock.stories.tsx index 637ff8974..6eb7bfb51 100644 --- a/frontend/src/components/clients/ConfigBlock.stories.tsx +++ b/frontend/src/components/clients/ConfigBlock.stories.tsx @@ -36,11 +36,17 @@ const sampleLink = 'vless://11112222-3333-4444-5555-666677778888@panel.example.c export const Collapsed: Story = { args: { label: 'vless', text: sampleLink, fileName: 'client-config.txt' }, - play: async ({ canvas, userEvent }) => { + play: async ({ canvas, canvasElement, userEvent }) => { await expect(canvas.queryByText(/vless:\/\/11112222/)).not.toBeInTheDocument(); await userEvent.click(canvas.getByText('vless')); const configText = await canvas.findByText(/vless:\/\/11112222/); await waitFor(() => expect(configText).toBeVisible()); + // Collapse fades content in over motionDurationMid; wait it out so the a11y + // scan doesn't sample a mid-transition, lower-contrast opacity. + await waitFor(() => { + const panel = canvasElement.querySelector('.ant-collapse-panel'); + expect(panel && getComputedStyle(panel).opacity).toBe('1'); + }); await expect(canvas.getByRole('button', { name: 'Copy' })).toBeVisible(); await expect(canvas.getByRole('button', { name: 'Download' })).toBeVisible(); await expect(canvas.getByRole('button', { name: 'QR Code' })).toBeVisible();