Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(mobile): 按渲染结果验证侧栏显示菜单标识

Dash49e609d16780
diff --git a/apps/mobile/src/__tests__/homeChromeMenusAndroid.test.ts b/apps/mobile/src/__tests__/homeChromeMenusAndroid.test.ts
index 76f1113a3a..a98aa30a52 100644
--- a/apps/mobile/src/__tests__/homeChromeMenusAndroid.test.ts
+++ b/apps/mobile/src/__tests__/homeChromeMenusAndroid.test.ts
@@ -127,7 +127,8 @@ describe("Android home chrome menus follow the iOS pull-down", () => {
expect(androidHeader).toContain("actions={homeDisplayPullDownActions}");
// 自绘范围面板只在包里没有 MenuView 时兜底;显示菜单兜底用同一份菜单模型的自绘下拉。
expect(androidHeader).toContain("onPress={nativeHomeMenus ? () => undefined : openDeviceMenu}");
- expect(androidHeader).toContain("<HomeDisplayMenu actions={homeDisplayPullDownActions} onAction={handleDisplayAction}>");
+ // Display selection is exercised through the rendered platform component in
+ // nativeGlassControls.test.tsx; do not freeze its JSX prop list here.
const iosHeader = home.slice(home.indexOf("<HomeNativeStackHeader"), home.indexOf("/>", home.indexOf("<HomeNativeStackHeader")));
expect(iosHeader).toContain("scopeActions={homeScopePullDownActions}");
// iOS 系统顶栏的菜单项属于顶栏选项:传结构稳定的同一份菜单,后台同步不重建顶栏(会关掉菜单)。
diff --git a/apps/mobile/src/__tests__/homeDesktopFirst.test.ts b/apps/mobile/src/__tests__/homeDesktopFirst.test.ts
index 54e2733ddc..8157a12482 100644
--- a/apps/mobile/src/__tests__/homeDesktopFirst.test.ts
+++ b/apps/mobile/src/__tests__/homeDesktopFirst.test.ts
@@ -313,7 +313,8 @@ describe('mobile home desktop-first surface', () => {
expect(source).toContain('const [groupByProject, setGroupByProject]');
expect(source).toContain('testID="home.deviceMenu"');
expect(source).toContain('testID="home.chromeMenu"');
- expect(source).toContain('testID="home.displaySettingsButton"');
+ // The display-menu e2e anchor belongs to its extracted platform component;
+ // nativeGlassControls.test.tsx checks it on the rendered menu.
expect(source).toContain('<HomeChromeDrawer');
expect(source).toContain('<HomeHeaderGlassButton');
const headerGlass = readSource('src/session/HomeHeaderGlassButton.ios.tsx');
diff --git a/apps/mobile/src/__tests__/nativeGlassControls.test.tsx b/apps/mobile/src/__tests__/nativeGlassControls.test.tsx
index f9d599bef9..1b75223602 100644
--- a/apps/mobile/src/__tests__/nativeGlassControls.test.tsx
+++ b/apps/mobile/src/__tests__/nativeGlassControls.test.tsx
@@ -199,6 +199,9 @@ it.each(["light", "dark"])("applies nested sidebar display choices in %s", (mode
}}><span>More</span></HomeDisplayMenu>;
}
const host = mount(<DisplayMenu />);
+ // Preserve the existing automation identifier across component extraction;
+ // losing it would make the menu trigger undiscoverable by its stable ID.
+ expect(host.querySelector('[data-testid="home.displaySettingsButton"]')).not.toBeNull();
const option = (id: string) => host.querySelector(`[data-testid="home.displayMenu.${id}"]`) as HTMLButtonElement;
expect(option('status.archived')).not.toBeNull();
act(() => option('status.archived').click());