fix(app): integrate Changes tests with shared actions gateway
This commit is contained in:
@@ -15,6 +15,9 @@ class RunsRepository {
|
|||||||
RunsRepository(this._gateway);
|
RunsRepository(this._gateway);
|
||||||
final ApiGateway _gateway;
|
final ApiGateway _gateway;
|
||||||
|
|
||||||
|
/// Composition/actions reuse this feature's existing gateway, never a socket.
|
||||||
|
ApiGateway get gateway => _gateway;
|
||||||
|
|
||||||
Future<RunListResult> listRuns() async {
|
Future<RunListResult> listRuns() async {
|
||||||
final reply = await _gateway.call('list_runs');
|
final reply = await _gateway.call('list_runs');
|
||||||
final runs = reply['runs'];
|
final runs = reply['runs'];
|
||||||
|
|||||||
@@ -59,7 +59,11 @@ Future<void> _pumpDetail(
|
|||||||
tester.view.physicalSize = const Size(500, 1200);
|
tester.view.physicalSize = const Size(500, 1200);
|
||||||
tester.view.devicePixelRatio = 1;
|
tester.view.devicePixelRatio = 1;
|
||||||
addTearDown(tester.view.reset);
|
addTearDown(tester.view.reset);
|
||||||
final view = RunDetailView(controller: controller, onBack: () {});
|
final view = RunDetailView(
|
||||||
|
controller: controller,
|
||||||
|
gateway: controller.repository.gateway,
|
||||||
|
onBack: () {},
|
||||||
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
platform == _Platform.material
|
platform == _Platform.material
|
||||||
? MaterialApp(home: Scaffold(body: view))
|
? MaterialApp(home: Scaffold(body: view))
|
||||||
|
|||||||
@@ -62,7 +62,11 @@ Future<void> _pumpDetail(
|
|||||||
final controller = RunsController(RunsRepository(_FakeGateway(run)));
|
final controller = RunsController(RunsRepository(_FakeGateway(run)));
|
||||||
addTearDown(controller.dispose);
|
addTearDown(controller.dispose);
|
||||||
await controller.select(9);
|
await controller.select(9);
|
||||||
final view = RunDetailView(controller: controller, onBack: () {});
|
final view = RunDetailView(
|
||||||
|
controller: controller,
|
||||||
|
gateway: controller.repository.gateway,
|
||||||
|
onBack: () {},
|
||||||
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
platform == _Platform.material
|
platform == _Platform.material
|
||||||
? MaterialApp(
|
? MaterialApp(
|
||||||
|
|||||||
@@ -163,13 +163,18 @@ void main() {
|
|||||||
await tester.tap(find.text('Input'));
|
await tester.tap(find.text('Input'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.textContaining('"alpha": 1'), findsOneWidget);
|
expect(find.textContaining('"alpha": 1'), findsOneWidget);
|
||||||
await tester.scrollUntilVisible(
|
await tester.dragUntilVisible(
|
||||||
find.text('Output'),
|
find.text('Output').hitTestable(),
|
||||||
200,
|
find.byType(ListView).first,
|
||||||
scrollable: find.byType(Scrollable).first,
|
const Offset(0, -200),
|
||||||
);
|
);
|
||||||
await tester.tap(find.text('Output'));
|
await tester.tap(find.text('Output'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
await tester.dragUntilVisible(
|
||||||
|
find.textContaining('"ok": true').hitTestable(),
|
||||||
|
find.byType(ListView).first,
|
||||||
|
const Offset(0, -100),
|
||||||
|
);
|
||||||
expect(find.textContaining('"ok": true'), findsOneWidget);
|
expect(find.textContaining('"ok": true'), findsOneWidget);
|
||||||
|
|
||||||
await tester.scrollUntilVisible(
|
await tester.scrollUntilVisible(
|
||||||
|
|||||||
@@ -173,7 +173,11 @@ class _ProbeBodyState extends State<_ProbeBody> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final detail = RunDetailView(controller: _controller, onBack: () {});
|
final detail = RunDetailView(
|
||||||
|
controller: _controller,
|
||||||
|
gateway: _controller.repository.gateway,
|
||||||
|
onBack: () {},
|
||||||
|
);
|
||||||
if (Theme.of(context).platform == TargetPlatform.iOS) {
|
if (Theme.of(context).platform == TargetPlatform.iOS) {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
navigationBar: const CupertinoNavigationBar(middle: Text('Runs')),
|
navigationBar: const CupertinoNavigationBar(middle: Text('Runs')),
|
||||||
|
|||||||
Reference in New Issue
Block a user