Merge branch 'main' into pager-bar-overlap
This commit is contained in:
@@ -5,7 +5,6 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
||||
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||
|
||||
import '../../artifacts/domain/artifact_fixtures.dart';
|
||||
|
||||
@@ -114,11 +113,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
|
||||
await tester.pumpAndSettle();
|
||||
final sections = find.byType(StickySectionTitle);
|
||||
for (var index = 0; index < sections.evaluate().length; index += 1) {
|
||||
await tester.tap(sections.at(index));
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
// Artifact groups start open: the files show without a tap.
|
||||
|
||||
expect(find.text('Artifacts · 2 recorded'), findsOneWidget);
|
||||
expect(find.text('build.log'), findsOneWidget);
|
||||
|
||||
@@ -7,19 +7,10 @@ import 'package:pipelines_app/features/runs/ui/run_detail_visit_facts.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_session_state.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||
|
||||
import 'run_detail_graph_support.dart';
|
||||
import 'run_detail_visit_support.dart';
|
||||
|
||||
Future<void> _expandArtifactGroups(WidgetTester tester) async {
|
||||
final sections = find.byType(StickySectionTitle);
|
||||
for (var index = 0; index < sections.evaluate().length; index += 1) {
|
||||
await tester.tap(sections.at(index));
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> _showTurnDocuments(WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(const Key('artifact-debug-toggle')));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -204,7 +195,7 @@ void main() {
|
||||
await openVisit(tester, platform, run: run, sequence: 2);
|
||||
expectVisitHeading(tester, 'plan', 2);
|
||||
await openVisitTab(tester, RunVisitSection.artifacts);
|
||||
await _expandArtifactGroups(tester);
|
||||
// Artifact groups start open: the files show without a tap.
|
||||
expect(find.text('plan-2.csv'), findsOneWidget);
|
||||
expect(find.text('public/shared.csv'), findsNothing);
|
||||
expect(find.byType(ArtifactGalleryPage), findsOneWidget);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
||||
import 'package:pipelines_app/ui/layout/section_heading.dart';
|
||||
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||
|
||||
@@ -16,6 +18,7 @@ class _HostState extends State<_Host> {
|
||||
@override
|
||||
Widget build(BuildContext context) => CustomScrollView(
|
||||
slivers: [
|
||||
const SliverTopBarClearance(),
|
||||
StickySection(
|
||||
title: 'Input',
|
||||
open: open,
|
||||
@@ -48,6 +51,39 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
for (final host in ['Material', 'Cupertino']) {
|
||||
testWidgets('pins an opaque section edge below the top bar in $host', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 600);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final child = MediaQuery(
|
||||
data: const MediaQueryData(padding: EdgeInsets.only(top: 64)),
|
||||
child: _Host(),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
host == 'Cupertino'
|
||||
? CupertinoApp(home: child)
|
||||
: MaterialApp(home: Scaffold(body: child)),
|
||||
);
|
||||
|
||||
await tester.drag(find.byType(CustomScrollView), const Offset(0, -800));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final title = tester.widget<StickySectionTitle>(
|
||||
find.byType(StickySectionTitle),
|
||||
);
|
||||
expect(title.pinned, isTrue);
|
||||
expect(
|
||||
find.byWidgetPredicate(
|
||||
(widget) => widget is Positioned && widget.top == -64,
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('a tap anywhere on the title strip toggles the section', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/text/relative_time_label.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('updates at the next relative-time boundary', (tester) async {
|
||||
final instant = DateTime.now().subtract(const Duration(minutes: 4));
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: RelativeTimeLabel(instant: instant)),
|
||||
);
|
||||
expect(find.text('4m'), findsOneWidget);
|
||||
|
||||
await tester.pump(const Duration(minutes: 1, seconds: 1));
|
||||
expect(find.text('5m'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('future labels schedule their next boundary', (tester) async {
|
||||
final instant = DateTime.now().add(const Duration(minutes: 4));
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: RelativeTimeLabel(instant: instant)),
|
||||
);
|
||||
expect(find.text('in 3m'), findsOneWidget);
|
||||
|
||||
await tester.pump(const Duration(minutes: 1, seconds: 1));
|
||||
expect(find.text('in 2m'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('cancels its timer when disposed', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: RelativeTimeLabel(
|
||||
instant: DateTime.now().subtract(const Duration(minutes: 4)),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(const MaterialApp(home: SizedBox()));
|
||||
await tester.pump(const Duration(hours: 1));
|
||||
});
|
||||
|
||||
testWidgets('keeps ticking while inactive, pauses while hidden and '
|
||||
'refreshes on resume', (tester) async {
|
||||
final instant = DateTime.now().subtract(const Duration(minutes: 4));
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: RelativeTimeLabel(instant: instant)),
|
||||
);
|
||||
expect(find.text('4m'), findsOneWidget);
|
||||
|
||||
// A desktop window that lost focus is still on screen: keep ticking.
|
||||
WidgetsBinding.instance.handleAppLifecycleStateChanged(
|
||||
AppLifecycleState.inactive,
|
||||
);
|
||||
await tester.pump(const Duration(minutes: 1, seconds: 1));
|
||||
expect(find.text('5m'), findsOneWidget);
|
||||
|
||||
WidgetsBinding.instance.handleAppLifecycleStateChanged(
|
||||
AppLifecycleState.hidden,
|
||||
);
|
||||
await tester.pump(const Duration(minutes: 1, seconds: 1));
|
||||
expect(find.text('5m'), findsOneWidget);
|
||||
|
||||
WidgetsBinding.instance.handleAppLifecycleStateChanged(
|
||||
AppLifecycleState.inactive,
|
||||
);
|
||||
WidgetsBinding.instance.handleAppLifecycleStateChanged(
|
||||
AppLifecycleState.resumed,
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(minutes: 1, seconds: 1));
|
||||
expect(find.text('5m'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user