8476cfd740
Register the landed PipelinesScreen at /pipelines through AppSession, with an honest first-connection gate, a native reconnect banner that retains the open list and detail, and an in-place refresh on reconnect. Move the shared connection chrome out of RunsDestination so both destinations use one implementation and one wording. Add destination, registration and reconnect coverage plus an isolated loopback Chrome probe that drives the real runPipelinesApp() composition.
95 lines
3.2 KiB
Dart
95 lines
3.2 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/application/pipelines_app.dart';
|
|
import 'package:pipelines_app/core/transport/pipelines_client.dart';
|
|
|
|
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
|
|
import '../features/pipelines/fixtures.dart';
|
|
import '../features/pipelines/test_helpers.dart' show selectableText;
|
|
import 'pipelines_app_test.dart' show webServer;
|
|
import 'pipelines_replies.dart';
|
|
|
|
void main() {
|
|
for (final cupertino in [false, true]) {
|
|
testWidgets(
|
|
'the /pipelines route renders real rows, detail and source ($cupertino)',
|
|
(tester) async {
|
|
tester.view.physicalSize = const Size(1100, 900);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
if (cupertino) {
|
|
tester.platformDispatcher.platformBrightnessTestValue =
|
|
Brightness.dark;
|
|
addTearDown(
|
|
tester.platformDispatcher.clearPlatformBrightnessTestValue,
|
|
);
|
|
}
|
|
|
|
final fixture = PipelineFixture();
|
|
final channel = FakeChannel()..readyCompleter.complete();
|
|
var sockets = 0;
|
|
final client = PipelinesClient(
|
|
channelFactory: (_) {
|
|
sockets++;
|
|
return channel;
|
|
},
|
|
);
|
|
final provider = PlatformRouteInformationProvider(
|
|
initialRouteInformation: RouteInformation(
|
|
uri: Uri.parse('/pipelines'),
|
|
),
|
|
);
|
|
addTearDown(provider.dispose);
|
|
|
|
await tester.pumpWidget(
|
|
PipelinesApp(
|
|
server: webServer(),
|
|
client: client,
|
|
cupertino: cupertino,
|
|
routeInformationProvider: provider,
|
|
),
|
|
);
|
|
await tester.pump();
|
|
await replyPipelines(tester, channel, fixture);
|
|
await tester.pump();
|
|
|
|
expect(find.text('Alpha review'), findsOneWidget);
|
|
expect(find.text('id 1 · v2 · 2 stages'), findsOneWidget);
|
|
expect(find.text('Pipelines — Not implemented'), findsNothing);
|
|
expect(sockets, 1);
|
|
|
|
// The shell owns the only navigation bar; the embedded screen adds no
|
|
// second AppBar or CupertinoNavigationBar.
|
|
if (cupertino) {
|
|
expect(find.byType(CupertinoNavigationBar), findsOneWidget);
|
|
expect(find.byType(CupertinoPageScaffold), findsOneWidget);
|
|
expect(find.byType(Material), findsNothing);
|
|
} else {
|
|
expect(find.byType(AppBar), findsOneWidget);
|
|
expect(find.byType(Scaffold), findsOneWidget);
|
|
}
|
|
|
|
await tester.tap(find.byKey(const Key('pipeline-row-1')));
|
|
await tester.pump();
|
|
await replyPipelineDetail(tester, channel, fixture);
|
|
await tester.pump();
|
|
expect(find.text('hash-alpha'), findsOneWidget);
|
|
|
|
await tester.tap(find.text('Source'));
|
|
await tester.pump();
|
|
expect(
|
|
selectableText(
|
|
'name: Alpha review\nstages:\n review:\n type: model',
|
|
),
|
|
findsOneWidget,
|
|
);
|
|
|
|
await tester.pumpWidget(const SizedBox.shrink());
|
|
await tester.pump();
|
|
},
|
|
);
|
|
}
|
|
}
|