feat(app): an open pipeline, run or chat fills a phone screen; Back steps up one level; stage tabs end with Session
This commit is contained in:
@@ -13,6 +13,7 @@ AppRouterDelegate delegate(AppRoute initial, {void Function()? onChat}) =>
|
||||
);
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
test('system Back leaves one chat session for the chat list', () async {
|
||||
var left = 0;
|
||||
final router = delegate(AppRoute.chatSession('s1'), onChat: () => left++);
|
||||
@@ -22,6 +23,33 @@ void main() {
|
||||
expect(left, 1);
|
||||
});
|
||||
|
||||
test('system Back steps up one level at a time', () async {
|
||||
var runs = 0;
|
||||
final router = AppRouterDelegate(
|
||||
builder: (context, route) => const SizedBox.shrink(),
|
||||
onPopToRuns: () => runs++,
|
||||
onPopToChat: () {},
|
||||
cupertino: false,
|
||||
initial: AppRoute.run.stage(77, 'plan', visit: 0),
|
||||
);
|
||||
addTearDown(router.dispose);
|
||||
|
||||
// A stage returns to its run, then the run to the Runs list.
|
||||
expect(await router.popRoute(), isTrue);
|
||||
expect(router.route, AppRoute.run(77));
|
||||
expect(await router.popRoute(), isTrue);
|
||||
expect(runs, 1);
|
||||
|
||||
// A pipeline stage returns to its pipeline, then to the list, and the
|
||||
// list leaves Back to the platform.
|
||||
router.goTo(AppRoute.pipelineStage(4, 'plan', version: 2));
|
||||
expect(await router.popRoute(), isTrue);
|
||||
expect(router.route, AppRoute.pipeline(4, version: 2));
|
||||
expect(await router.popRoute(), isTrue);
|
||||
expect(router.route, AppRoute.pipelines);
|
||||
expect(await router.popRoute(), isFalse);
|
||||
});
|
||||
|
||||
test('system Back on a list destination stays with the platform', () async {
|
||||
final router = delegate(AppRoute.chat);
|
||||
addTearDown(router.dispose);
|
||||
|
||||
@@ -268,7 +268,7 @@ void main() {
|
||||
testWidgets(
|
||||
'the Search tab opens focused and the Runs tab keeps the open run',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.physicalSize = const Size(900, 1000);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
@@ -295,7 +295,8 @@ void main() {
|
||||
);
|
||||
await replyRunList(tester, channel);
|
||||
await replyRunDetail(tester, channel, 2);
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
|
||||
// On a phone an open run fills the screen and the tabs step aside, so
|
||||
// switching tabs with a run open is a wide-window move.
|
||||
|
||||
// Search is the fifth tab.
|
||||
await tapTab(tester, 'Search');
|
||||
@@ -337,7 +338,7 @@ void main() {
|
||||
testWidgets('a result opens through the existing run route over one socket', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.physicalSize = const Size(900, 1000);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
@@ -21,12 +21,12 @@ void main() {
|
||||
expect(find.text('Back'), findsNothing);
|
||||
// The page bar's own Back is the only one.
|
||||
expect(find.byKey(const Key('run-visit-back')), findsOneWidget);
|
||||
// Four tabs: Summary, Artifacts, Changes, More.
|
||||
// Four tabs: Summary, Artifacts, Changes, Session.
|
||||
expect(shownVisitSections, [
|
||||
RunVisitSection.summary,
|
||||
RunVisitSection.artifacts,
|
||||
RunVisitSection.changes,
|
||||
RunVisitSection.more,
|
||||
RunVisitSection.session,
|
||||
]);
|
||||
// Summary holds both Input and Output.
|
||||
expect(find.text('Input'), findsOneWidget);
|
||||
@@ -73,9 +73,8 @@ void main() {
|
||||
expect(find.text('sess-1'), findsOneWidget);
|
||||
expect(find.text('Open session.html'), findsOneWidget);
|
||||
|
||||
await openVisitTab(tester, RunVisitSection.definition);
|
||||
expect(find.byType(StageDefinitionView), findsOneWidget);
|
||||
expect(find.text('Draft the plan.'), findsOneWidget);
|
||||
// The stage's definition belongs to the pipeline, not to a visit.
|
||||
expect(find.byType(StageDefinitionView), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} artifacts tab reports the capture state', (
|
||||
@@ -178,21 +177,6 @@ void main() {
|
||||
expect(find.byType(ArtifactGalleryPage), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} missing definition uses exact wording', (
|
||||
tester,
|
||||
) async {
|
||||
await openVisit(
|
||||
tester,
|
||||
platform,
|
||||
run: visitRunFixture(declareStage: false),
|
||||
);
|
||||
await openVisitTab(tester, RunVisitSection.definition);
|
||||
|
||||
expect(find.byType(StageDefinitionView), findsNothing);
|
||||
expect(find.text(unknownStageDefinition), findsOneWidget);
|
||||
expect(find.text('Draft the plan.'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} visit sections at 320 with 2x dark text', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
@@ -115,8 +115,7 @@ Future<void> openVisit(
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
/// Opens the tab showing [section]: Input and Output are on Summary, Session
|
||||
/// and Definition behind More's switch.
|
||||
/// Opens the tab showing [section]: Input and Output are on Summary.
|
||||
Future<void> openVisitTab(WidgetTester tester, RunVisitSection section) async {
|
||||
final shown = visitTabFor(section);
|
||||
final tab = find.byKey(ValueKey('run-visit-tab-${shown.name}'));
|
||||
@@ -124,15 +123,4 @@ Future<void> openVisitTab(WidgetTester tester, RunVisitSection section) async {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(tab);
|
||||
await tester.pumpAndSettle();
|
||||
if (section == RunVisitSection.session ||
|
||||
section == RunVisitSection.definition) {
|
||||
final choice = find.descendant(
|
||||
of: find.byKey(const Key('run-visit-more-switch')),
|
||||
matching: find.text(
|
||||
section == RunVisitSection.session ? 'Session' : 'Definition',
|
||||
),
|
||||
);
|
||||
await tester.tap(choice);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,4 +99,23 @@ void main() {
|
||||
findsNothing,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('an open detail fills a phone screen without the tab bar', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
Widget shell({required bool detail}) => MaterialApp(
|
||||
home: AdaptiveShell(
|
||||
destination: AppDestination.runs,
|
||||
detailOpen: detail,
|
||||
destinationBodies: {AppDestination.runs: (_) => const Text('runs')},
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(shell(detail: false));
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
await tester.pumpWidget(shell(detail: true));
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user