Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(dify-ui): stabilize breadcrumb story and retain failure artifacts (#43746)

yyh39471347e9a0
diff --git a/.github/workflows/web-tests.yml b/.github/workflows/web-tests.yml
index fb9810a87e1..6aea0606194 100644
--- a/.github/workflows/web-tests.yml
+++ b/.github/workflows/web-tests.yml
@@ -150,7 +150,9 @@ jobs:
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dify-ui-test-failures
- path: packages/dify-ui/.vitest-browser/
+ path: |
+ packages/dify-ui/.vitest/attachments/
+ packages/dify-ui/.vitest-browser/
if-no-files-found: ignore
include-hidden-files: true
retention-days: 7
@@ -193,7 +195,9 @@ jobs:
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dify-ui-storybook-test-failures
- path: packages/dify-ui/.vitest-browser/
+ path: |
+ packages/dify-ui/.vitest/attachments/
+ packages/dify-ui/.vitest-browser/
if-no-files-found: ignore
include-hidden-files: true
retention-days: 7
diff --git a/packages/dify-ui/docs/testing.md b/packages/dify-ui/docs/testing.md
index 9c565385497..76016a9b13a 100644
--- a/packages/dify-ui/docs/testing.md
+++ b/packages/dify-ui/docs/testing.md
@@ -57,6 +57,22 @@ that assert final DOM state. Storybook uses its preview setup and retains real a
A unit test that intentionally asserts animation behavior may set the flag to `false` locally,
but must restore the previous value during cleanup.
+## Failure artifacts
+
+Vitest writes automatic failure screenshots and attachments to its default `.vitest/attachments/`
+directory. Configured browser screenshots and unit Playwright traces use `.vitest-browser/`.
+The failure upload steps in `.github/workflows/web-tests.yml` collect both directories, including
+hidden files, and retain them for seven days.
+
+Read the failing test's log for the screenshot or trace path, then download the matching job's
+artifact: `dify-ui-test-failures` for unit tests or `dify-ui-storybook-test-failures` for Storybook.
+
+```sh
+gh run download <run-id> --repo langgenius/dify --name <artifact-name> --dir <output-dir>
+```
+
+The download preserves `.vitest/attachments/` and `.vitest-browser/` relative to `<output-dir>`.
+
[Browser Mode]: https://vitest.dev/guide/browser
[Storybook Vitest addon]: https://storybook.js.org/docs/writing-tests/integrations/vitest-addon/index
[Vitest projects]: https://vitest.dev/guide/projects.html
diff --git a/packages/dify-ui/src/breadcrumb/index.stories.tsx b/packages/dify-ui/src/breadcrumb/index.stories.tsx
index 13b2483cc98..8178731b4b6 100644
--- a/packages/dify-ui/src/breadcrumb/index.stories.tsx
+++ b/packages/dify-ui/src/breadcrumb/index.stories.tsx
@@ -264,7 +264,8 @@ export const CollapsedAncestors: Story = {
trigger.focus()
await userEvent.keyboard('{Enter}')
const body = within(canvasElement.ownerDocument.body)
- await expect(await body.findByRole('menuitem', { name: 'Projects' })).toBeVisible()
+ const projects = await body.findByRole('menuitem', { name: 'Projects' })
+ await waitFor(() => expect(projects).toBeVisible())
await userEvent.keyboard('{Escape}')
await waitFor(() => expect(trigger).toHaveFocus())
},