fix(devices): 本机也显示 ⋯ 菜单(只「重命名」)—— 修单设备无法改名(1.0.14)
ci-pangolin / Lint — shellcheck (push) Successful in 8s
ci-pangolin / OpenAPI Sync Check (push) Successful in 16s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 6s
ci-pangolin / Flutter — analyze + test (push) Failing after 14s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 4s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 9s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 15s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m10s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 14s

之前 ⋯ 菜单对本机隐藏,而用户唯一设备就是本机 → 根本点不到、改不了名。
改:本机显示 ⋯ 菜单但只含「重命名」(自我强制退出/清除无意义,仍只对他设备)。
测试:本机菜单只有重命名断言;全量 flutter 绿。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-29 09:49:09 +08:00
parent 315c343ed5
commit 880fa32793
4 changed files with 30 additions and 18 deletions
+15 -6
View File
@@ -92,12 +92,21 @@ void main() {
expect(find.text('iPhone 15'), findsOneWidget);
});
testWidgets('本机 ⋯ 菜单只有「重命名」,无强制退出/清除', (tester) async {
await pump(tester);
// 第一个菜单 = 本机(MacBook Pro)。
await tester.tap(find.byType(PopupMenuButton<String>).first);
await tester.pumpAndSettle();
expect(find.text(t.devRename), findsOneWidget);
expect(find.text(t.devForceLogout), findsNothing);
expect(find.text(t.devClearLogin), findsNothing);
});
testWidgets('非本机行 ⋯ 菜单 → 强制退出 → 确认 → 调 logout 接口', (tester) async {
await pump(tester);
// 仅非本机(iPhone)有 ⋯ 菜单
final menu = find.byType(PopupMenuButton<String>);
expect(menu, findsOneWidget);
await tester.tap(menu);
// 本机+手机各一个菜单;手机(最后一个)才有强制退出/清除
expect(find.byType(PopupMenuButton<String>), findsNWidgets(2));
await tester.tap(find.byType(PopupMenuButton<String>).last);
await tester.pumpAndSettle();
expect(find.text(t.devForceLogout), findsOneWidget);
expect(find.text(t.devClearLogin), findsOneWidget);
@@ -115,7 +124,7 @@ void main() {
testWidgets('清除登录信息 → 确认 → 调 DELETE 接口', (tester) async {
await pump(tester);
await tester.tap(find.byType(PopupMenuButton<String>));
await tester.tap(find.byType(PopupMenuButton<String>).last);
await tester.pumpAndSettle();
await tester.tap(find.text(t.devClearLogin));
await tester.pumpAndSettle();
@@ -127,7 +136,7 @@ void main() {
testWidgets('重命名 → 输入新名 → 保存 → 调 rename 接口', (tester) async {
await pump(tester);
await tester.tap(find.byType(PopupMenuButton<String>));
await tester.tap(find.byType(PopupMenuButton<String>).last);
await tester.pumpAndSettle();
await tester.tap(find.text(t.devRename));
await tester.pumpAndSettle();