Files
buzz/mobile/test/features/agents/agent_card_grid_test.dart
klopez4212 0cde1fe2f4 Make mobile Agents a full-page owned-agent directory (#8693)
Replace the mobile Agents sheet with a full-page directory of verified
owned agents. Add dedicated creation and avatar pages with
catalog-backed model selection, reuse the profile emoji/photo/camera
controls, and expose Builderbot model settings while labeling desktop
agents “Manage on desktop.” Share one account-scoped model catalog
across editable cards and retries. Choose Bestie from the agent profile
using the shared encrypted main-agent record (text-only action, filled
star once selected), and move confirmed deletion to a top-left trash
control with native iOS glass. Include uploaded avatars in owner
registrations so desktop can display them.

Validation: mobile analysis and all 3,958 hosted-enabled app tests
passed; default-build tests run by the push hook. Earlier iPhone build
installed and iterated with the user; the current iOS build succeeds,
but final changes still need a device pass. Independent review found no
new blockers. Actual camera capture and live Bestie sync remain
unconfirmed; the existing shared `main-agent` wire format and Bestie
terminology are retained.

### Snapshots

Widget-harness captures with test data (not native iOS chrome).

| Agents directory | Image avatar editor |
| --- | --- |
| ![Agents
directory](https://github.com/user-attachments/assets/c68a0505-90a5-41db-980f-e3197cac63ac)
| ![Image avatar
editor](https://github.com/user-attachments/assets/9b126186-1e7c-4169-9a74-8f7f252cfa93)
|

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-10-29 18:30:17 +00:00

118 lines
3.6 KiB
Dart

import 'dart:ui' show SemanticsAction;
import 'package:buzz/features/agents/agent_card.dart';
import 'package:buzz/features/agents/agent_card_grid.dart';
import 'package:buzz/shared/theme/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
void main() {
testWidgets('whole card opens profile without stealing footer taps', (
tester,
) async {
var opens = 0;
var selections = 0;
await tester.pumpWidget(
ProviderScope(
child: MaterialApp(
theme: AppTheme.light(),
home: Scaffold(
body: Center(
child: SizedBox(
width: 180,
height: 240,
child: AgentCard(
name: 'Cloud assistant',
onOpen: () => opens++,
footer: TextButton(
onPressed: () => selections++,
child: const Text('Model'),
),
),
),
),
),
),
),
);
final bounds = tester.getRect(find.byType(AgentCard));
await tester.tapAt(Offset(bounds.left + 2, bounds.center.dy));
await tester.tapAt(Offset(bounds.center.dx, bounds.bottom - 2));
expect(opens, 2);
await tester.tap(find.text('Model'));
expect(selections, 1);
expect(opens, 2);
expect(tester.takeException(), isNull);
});
testWidgets('agent grid keeps cards readable and actionable at large text', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final semantics = tester.ensureSemantics();
try {
String? opened;
Future<void> render(double scale) async {
await tester.pumpWidget(
ProviderScope(
child: MaterialApp(
theme: AppTheme.light(),
home: MediaQuery(
data: MediaQueryData(
size: const Size(390, 844),
textScaler: TextScaler.linear(scale),
disableAnimations: true,
),
child: Scaffold(
body: CustomScrollView(
slivers: [
AgentCardGrid(
itemCount: 6,
itemBuilder: (_, index) => AgentCard(
name: 'Research assistant $index',
location: 'Remote',
onOpen: () => opened = '$index',
),
),
],
),
),
),
),
),
);
await tester.pumpAndSettle();
}
await render(1);
expect(
tester.getTopLeft(find.byType(AgentCard).at(0)).dy,
tester.getTopLeft(find.byType(AgentCard).at(1)).dy,
);
await render(2);
expect(
tester.getTopLeft(find.byType(AgentCard).at(1)).dy,
greaterThan(tester.getTopLeft(find.byType(AgentCard).at(0)).dy),
);
final first = find.bySemanticsLabel(RegExp('Open Research assistant 0'));
expect(
tester
.getSemantics(first)
.getSemanticsData()
.hasAction(SemanticsAction.tap),
isTrue,
);
await tester.tap(first);
expect(opened, '0');
expect(tester.takeException(), isNull);
} finally {
semantics.dispose();
}
});
}