Skip to content

Commit 98e0fde

Browse files
committed
test(app-shell): the zh flow caption waits for the studio catalogue it reads
`designer.field.apiName` comes from the lazily fetched studio namespace, which answers from en until the zh catalogue lands and re-renders the pillar. The assertion read the title before that landing and only passed on load order. Claude-Session: https://claude.ai/code/session_01FEkQ5nhhuhjVQJ8R3qK9UB Co-authored-by: Claude <noreply@anthropic.com>
1 parent 26703ac commit 98e0fde

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.flowCanvasChip-11665.test.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import '@testing-library/jest-dom/vitest';
2222
import * as React from 'react';
2323
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
24-
import { render, screen, cleanup } from '@testing-library/react';
24+
import { render, screen, cleanup, waitFor } from '@testing-library/react';
2525
import { MemoryRouter } from 'react-router-dom';
2626
import { I18nProvider } from '@object-ui/i18n';
2727

@@ -145,7 +145,10 @@ describe('the automation canvas header names the open flow by its label (objectu
145145
const { chip, header } = await caption();
146146

147147
expect(chip).toHaveTextContent(/^每日摘要$/);
148-
expect(chip).toHaveAttribute('title', `API 名称: ${API_NAME}`);
148+
// `designer.field.apiName` lives in the lazily fetched `studio` namespace,
149+
// which answers from `en` until its zh catalogue lands and then re-renders
150+
// the pillar (`useStudioCatalogue`): the zh title is the answer after that.
151+
await waitFor(() => expect(chip).toHaveAttribute('title', `API 名称: ${API_NAME}`));
149152
// The neighbouring chip is the real zh `canvasHint`, so the header read is the whole strip.
150153
expect(header).toHaveTextContent('点选画布上的节点即可配置');
151154
expect(header.textContent ?? '').not.toMatch(TYPE_WORD);

0 commit comments

Comments
 (0)