Remove Cupertino pipeline branches
Keep the pipeline feature on its existing Material path because the app runs under MaterialApp and never selects Cupertino hosts. Preserve public cupertino parameters and required Cupertino icon values for later cleanup and shared controls.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/pipelines/screen.dart';
|
||||
@@ -52,19 +50,13 @@ FakeGateway archiveGateway(PipelineFixture fixture, {String? refusal}) {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> pump(
|
||||
WidgetTester tester,
|
||||
FakeGateway gateway, {
|
||||
bool cupertino = false,
|
||||
}) async {
|
||||
Future<void> pump(WidgetTester tester, FakeGateway gateway) async {
|
||||
tester.view.physicalSize = const Size(1100, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final screen = PipelinesScreen(gateway: gateway);
|
||||
await tester.pumpWidget(
|
||||
cupertino ? CupertinoApp(home: screen) : MaterialApp(home: screen),
|
||||
);
|
||||
await tester.pumpWidget(MaterialApp(home: screen));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
@@ -161,24 +153,4 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(rowNamed('Alpha review'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('Cupertino archives through the action sheet and alert', (
|
||||
tester,
|
||||
) async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
||||
try {
|
||||
final gateway = archiveGateway(PipelineFixture());
|
||||
await pump(tester, gateway, cupertino: true);
|
||||
await tester.tap(rowNamed('Beta deploy'));
|
||||
await tester.pumpAndSettle();
|
||||
await openMenuItem(tester, 'pipeline-archive');
|
||||
expect(find.byType(CupertinoAlertDialog), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('pipeline-archive-confirm')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(gateway.callsOf('archive_pipeline'), hasLength(1));
|
||||
expect(rowNamed('Beta deploy'), findsNothing);
|
||||
} finally {
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
@@ -21,44 +20,31 @@ class _Gateway implements ApiGateway {
|
||||
Stream<JsonMap> get frames => const Stream.empty();
|
||||
}
|
||||
|
||||
Widget _host(
|
||||
_Gateway gateway, {
|
||||
bool cupertino = false,
|
||||
String source = '# stage build',
|
||||
}) {
|
||||
Widget _host(_Gateway gateway, {String source = '# stage build'}) {
|
||||
final body = Column(
|
||||
children: [
|
||||
const Text('Pipeline source remains available'),
|
||||
PipelineDefinitionValidation(gateway: gateway, source: source),
|
||||
],
|
||||
);
|
||||
return cupertino
|
||||
? CupertinoApp(
|
||||
home: CupertinoPageScaffold(child: SafeArea(child: body)),
|
||||
)
|
||||
: MaterialApp(home: Scaffold(body: body));
|
||||
return MaterialApp(home: Scaffold(body: body));
|
||||
}
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets(
|
||||
'definition warnings stay visible on ${cupertino ? 'Cupertino' : 'Material'}',
|
||||
(tester) async {
|
||||
final gateway = _Gateway()
|
||||
..answer = () async => {
|
||||
'type': 'validated',
|
||||
'warnings': ['Review prompt exceeds 2000 bytes.', '', 42],
|
||||
};
|
||||
await tester.pumpWidget(_host(gateway, cupertino: cupertino));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Definition warnings'), findsOneWidget);
|
||||
expect(find.text('Review prompt exceeds 2000 bytes.'), findsOneWidget);
|
||||
expect(find.text('42'), findsNothing);
|
||||
expect(gateway.calls.single, {'source': '# stage build'});
|
||||
expect(tester.takeException(), isNull);
|
||||
},
|
||||
);
|
||||
}
|
||||
testWidgets('definition warnings stay visible', (tester) async {
|
||||
final gateway = _Gateway()
|
||||
..answer = () async => {
|
||||
'type': 'validated',
|
||||
'warnings': ['Review prompt exceeds 2000 bytes.', '', 42],
|
||||
};
|
||||
await tester.pumpWidget(_host(gateway));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Definition warnings'), findsOneWidget);
|
||||
expect(find.text('Review prompt exceeds 2000 bytes.'), findsOneWidget);
|
||||
expect(find.text('42'), findsNothing);
|
||||
expect(gateway.calls.single, {'source': '# stage build'});
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'loading validation never hides detail and a source is checked once',
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
||||
@@ -211,34 +209,4 @@ void main() {
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('Cupertino keeps the shared row with the same row identity', (
|
||||
tester,
|
||||
) async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
||||
tester.view.physicalSize = const Size(1100, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
try {
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
home: PipelinesScreen(gateway: gatewayFor(PipelineFixture())),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
tester
|
||||
.widget<AppListRow>(find.byKey(const Key('pipeline-row-1')))
|
||||
.cupertino,
|
||||
isTrue,
|
||||
);
|
||||
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
|
||||
expect(find.textContaining('v2 · #'), findsNothing);
|
||||
expect(find.byKey(const Key('pipeline-avatar-1')), findsOneWidget);
|
||||
expect(find.byKey(const Key('pipeline-status-1')), findsOneWidget);
|
||||
} finally {
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,45 +1,35 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/pipelines/widgets/pipeline_scope_control.dart';
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
for (final width in [120.0, 500.0]) {
|
||||
testWidgets(
|
||||
'native scope remains usable at $width, Cupertino=$cupertino',
|
||||
(tester) async {
|
||||
var scope = PipelineScope.all;
|
||||
final control = StatefulBuilder(
|
||||
builder: (context, setState) => Center(
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
child: PipelineScopeControl(
|
||||
scope: scope,
|
||||
onSelected: (value) => setState(() => scope = value),
|
||||
),
|
||||
),
|
||||
for (final width in [120.0, 500.0]) {
|
||||
testWidgets('native scope remains usable at $width', (tester) async {
|
||||
var scope = PipelineScope.all;
|
||||
final control = StatefulBuilder(
|
||||
builder: (context, setState) => Center(
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
child: PipelineScopeControl(
|
||||
scope: scope,
|
||||
onSelected: (value) => setState(() => scope = value),
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(home: CupertinoPageScaffold(child: control))
|
||||
: MaterialApp(home: Scaffold(body: control)),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
if (width == 120) {
|
||||
await tester.tap(find.byKey(const Key('pipeline-scope')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Scheduled').last);
|
||||
} else {
|
||||
await tester.tap(find.text('Scheduled'));
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
expect(scope, PipelineScope.scheduled);
|
||||
expect(tester.takeException(), isNull);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
await tester.pumpWidget(MaterialApp(home: Scaffold(body: control)));
|
||||
await tester.pumpAndSettle();
|
||||
if (width == 120) {
|
||||
await tester.tap(find.byKey(const Key('pipeline-scope')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Scheduled').last);
|
||||
} else {
|
||||
await tester.tap(find.text('Scheduled'));
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
expect(scope, PipelineScope.scheduled);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('wide scope control hugs its labels', (tester) async {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/pipelines/screen.dart';
|
||||
@@ -8,68 +7,62 @@ import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
||||
|
||||
import 'fixtures.dart';
|
||||
|
||||
/// The pipeline Summary is flat on both hosts: facts in the shared grid,
|
||||
/// Schedules with Add as its heading's only action (no body Refresh), and
|
||||
/// versions as the shared list row.
|
||||
/// The pipeline Summary is flat: facts in the shared grid, Schedules with Add
|
||||
/// as its heading's only action (no body Refresh), and versions as the shared
|
||||
/// list row.
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('pipeline Summary is a facts grid with flat sections '
|
||||
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
|
||||
final gateway = FakeGateway((type, fields) {
|
||||
return switch (type) {
|
||||
'list_pipelines' => pipelineListReply([
|
||||
pipelineSummary(id: 1, name: 'Alpha review', version: 3),
|
||||
]),
|
||||
'list_runs' => runListReply([]),
|
||||
'get_pipeline' => pipelineDetailReply(
|
||||
pipelineDetail(
|
||||
id: 1,
|
||||
name: 'Alpha review',
|
||||
version: 3,
|
||||
latestVersion: 3,
|
||||
versions: [versionSummary(2), versionSummary(3)],
|
||||
),
|
||||
testWidgets('pipeline Summary is a facts grid with flat sections', (
|
||||
tester,
|
||||
) async {
|
||||
final gateway = FakeGateway((type, fields) {
|
||||
return switch (type) {
|
||||
'list_pipelines' => pipelineListReply([
|
||||
pipelineSummary(id: 1, name: 'Alpha review', version: 3),
|
||||
]),
|
||||
'list_runs' => runListReply([]),
|
||||
'get_pipeline' => pipelineDetailReply(
|
||||
pipelineDetail(
|
||||
id: 1,
|
||||
name: 'Alpha review',
|
||||
version: 3,
|
||||
latestVersion: 3,
|
||||
versions: [versionSummary(2), versionSummary(3)],
|
||||
),
|
||||
'list_schedules' => {'type': 'schedules', 'schedules': <dynamic>[]},
|
||||
_ => errorReply('unexpected $type'),
|
||||
};
|
||||
});
|
||||
tester.view.physicalSize = const Size(1100, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final screen = PipelinesScreen(gateway: gateway);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(home: CupertinoPageScaffold(child: screen))
|
||||
: MaterialApp(home: screen),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('pipeline-row-1')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(pipelineSummaryFactsKey), findsOneWidget);
|
||||
// Short facts share a line instead of one label/value row each.
|
||||
final latest = tester.getRect(
|
||||
find.byKey(const ValueKey('pipeline-summary-latest-version')),
|
||||
);
|
||||
final versionCreated = tester.getRect(
|
||||
find.byKey(const ValueKey('pipeline-summary-version-created')),
|
||||
);
|
||||
expect(versionCreated.top, moreOrLessEquals(latest.top));
|
||||
expect(versionCreated.left, greaterThan(latest.right));
|
||||
|
||||
expect(find.text('Refresh'), findsNothing);
|
||||
expect(find.text(scheduleAddLabel), findsNothing);
|
||||
expect(find.byKey(scheduleAddKey), findsOneWidget);
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
expect(find.byType(ListTile), findsNothing);
|
||||
final row = tester.widget<AppListRow>(
|
||||
find.byKey(const Key('pipeline-version-3')),
|
||||
);
|
||||
expect(row.selected, isTrue);
|
||||
expect(row.cupertino, cupertino);
|
||||
expect(tester.takeException(), isNull);
|
||||
),
|
||||
'list_schedules' => {'type': 'schedules', 'schedules': <dynamic>[]},
|
||||
_ => errorReply('unexpected $type'),
|
||||
};
|
||||
});
|
||||
}
|
||||
tester.view.physicalSize = const Size(1100, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final screen = PipelinesScreen(gateway: gateway);
|
||||
await tester.pumpWidget(MaterialApp(home: screen));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('pipeline-row-1')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(pipelineSummaryFactsKey), findsOneWidget);
|
||||
// Short facts share a line instead of one label/value row each.
|
||||
final latest = tester.getRect(
|
||||
find.byKey(const ValueKey('pipeline-summary-latest-version')),
|
||||
);
|
||||
final versionCreated = tester.getRect(
|
||||
find.byKey(const ValueKey('pipeline-summary-version-created')),
|
||||
);
|
||||
expect(versionCreated.top, moreOrLessEquals(latest.top));
|
||||
expect(versionCreated.left, greaterThan(latest.right));
|
||||
|
||||
expect(find.text('Refresh'), findsNothing);
|
||||
expect(find.text(scheduleAddLabel), findsNothing);
|
||||
expect(find.byKey(scheduleAddKey), findsOneWidget);
|
||||
expect(find.byType(ListTile), findsNothing);
|
||||
final row = tester.widget<AppListRow>(
|
||||
find.byKey(const Key('pipeline-version-3')),
|
||||
);
|
||||
expect(row.selected, isTrue);
|
||||
expect(row.cupertino, isFalse);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/pipelines/widgets/pipeline_tabs.dart';
|
||||
@@ -26,64 +25,52 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
for (final cupertino in [false, true]) {
|
||||
for (final width in [320.0, 390.0, 720.0, 1200.0]) {
|
||||
testWidgets('floating tabs at $width, 2x, Cupertino=$cupertino', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = Size(width, 640);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
PipelineDetailTab? selected;
|
||||
final body = Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: PipelineDetailTabs(
|
||||
selected: PipelineDetailTab.summary,
|
||||
onSelected: (value) => selected = value,
|
||||
),
|
||||
for (final width in [320.0, 390.0, 720.0, 1200.0]) {
|
||||
testWidgets('floating tabs at $width, 2x', (tester) async {
|
||||
tester.view.physicalSize = Size(width, 640);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
PipelineDetailTab? selected;
|
||||
final body = Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: PipelineDetailTabs(
|
||||
selected: PipelineDetailTab.summary,
|
||||
onSelected: (value) => selected = value,
|
||||
),
|
||||
);
|
||||
Widget scaled(BuildContext context, Widget? child) => MediaQuery(
|
||||
data: MediaQuery.of(
|
||||
context,
|
||||
).copyWith(textScaler: TextScaler.linear(2)),
|
||||
child: child!,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(builder: scaled, home: Scaffold(body: body)),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
// One floating bar of separate round tab buttons.
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
final pill = tester.getRect(find.byKey(FloatingDestinationBar.rowKey));
|
||||
// Sized to its three tabs at the right edge, on a phone as when wide.
|
||||
expect(pill.right, width - 16);
|
||||
expect(
|
||||
pill.width,
|
||||
FloatingDestinationBar.rowWidth(
|
||||
cupertino: false,
|
||||
tabs: PipelineDetailTab.values.length,
|
||||
),
|
||||
);
|
||||
for (final tab in PipelineDetailTab.values) {
|
||||
final rect = tester.getRect(
|
||||
find.byKey(ValueKey('pipeline-detail-tab-${tab.name}')),
|
||||
);
|
||||
Widget scaled(BuildContext context, Widget? child) => MediaQuery(
|
||||
data: MediaQuery.of(
|
||||
context,
|
||||
).copyWith(textScaler: TextScaler.linear(2)),
|
||||
child: child!,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(
|
||||
builder: scaled,
|
||||
home: CupertinoPageScaffold(child: body),
|
||||
)
|
||||
: MaterialApp(
|
||||
builder: scaled,
|
||||
home: Scaffold(body: body),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
// One floating bar of separate round tab buttons.
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
final pill = tester.getRect(find.byKey(FloatingDestinationBar.rowKey));
|
||||
// Sized to its three tabs at the right edge, on a phone as when wide.
|
||||
expect(pill.right, width - 16);
|
||||
expect(
|
||||
pill.width,
|
||||
FloatingDestinationBar.rowWidth(
|
||||
cupertino: cupertino,
|
||||
tabs: PipelineDetailTab.values.length,
|
||||
),
|
||||
);
|
||||
for (final tab in PipelineDetailTab.values) {
|
||||
final rect = tester.getRect(
|
||||
find.byKey(ValueKey('pipeline-detail-tab-${tab.name}')),
|
||||
);
|
||||
expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name);
|
||||
expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name);
|
||||
}
|
||||
await tester.tap(find.byKey(const Key('pipeline-detail-tab-source')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(selected, PipelineDetailTab.source);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name);
|
||||
expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name);
|
||||
}
|
||||
await tester.tap(find.byKey(const Key('pipeline-detail-tab-source')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(selected, PipelineDetailTab.source);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
||||
import '../../native_back.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/definition_graph_view.dart';
|
||||
import 'package:pipelines_app/features/pipelines/pipeline_repository.dart';
|
||||
import 'package:pipelines_app/features/pipelines/pipelines_controller.dart';
|
||||
import 'package:pipelines_app/features/pipelines/screen.dart';
|
||||
import 'package:pipelines_app/features/pipelines/widgets/pipeline_detail_panel.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
|
||||
import 'fixtures.dart';
|
||||
import 'test_helpers.dart';
|
||||
@@ -110,66 +106,6 @@ void main() {
|
||||
expect(find.byKey(const Key('pipeline-detail')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('iOS uses Cupertino scaffolds, list tiles and segmented tabs', (
|
||||
tester,
|
||||
) async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
||||
tester.view.physicalSize = const Size(1100, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final fixture = PipelineFixture();
|
||||
try {
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(home: PipelinesScreen(gateway: gatewayFor(fixture))),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(CupertinoPageScaffold), findsOneWidget);
|
||||
// The shared list row, in its Cupertino form.
|
||||
expect(
|
||||
tester
|
||||
.widget<AppListRow>(find.byKey(const Key('pipeline-row-1')))
|
||||
.cupertino,
|
||||
isTrue,
|
||||
);
|
||||
expect(find.byType(CupertinoActionSheet), findsNothing);
|
||||
await tester.tap(find.byKey(const Key('pipeline-row-1')));
|
||||
await tester.pumpAndSettle();
|
||||
// The tabs are the floating glass Cupertino tab bar.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('pipeline-detail-tabs')),
|
||||
matching: find.byType(FloatingDestinationBar),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
// Versions are the shared row in its Cupertino form, flat on the page.
|
||||
expect(
|
||||
tester
|
||||
.widget<AppListRow>(find.byKey(const Key('pipeline-version-1')))
|
||||
.cupertino,
|
||||
isTrue,
|
||||
);
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
|
||||
await tester.tap(find.byKey(const Key('pipeline-version-1')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Viewing v1 (latest v2).'), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('pipeline-detail-tab-source')));
|
||||
await tester.pump();
|
||||
expect(
|
||||
selectableText(
|
||||
'name: Alpha review\nstages:\n review:\n type: model\n'
|
||||
'# selected version 1',
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
} finally {
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('3x text in a very short panel keeps the tabs reachable', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/pipelines/screen.dart';
|
||||
@@ -136,21 +135,15 @@ void main() {
|
||||
expect(find.text('Beta deploy'), findsOneWidget);
|
||||
});
|
||||
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('Schedules opens from the bar (cupertino: $cupertino)', (
|
||||
tester,
|
||||
) async {
|
||||
var opened = 0;
|
||||
final screen = PipelinesScreen(
|
||||
gateway: gatewayFor(PipelineFixture()),
|
||||
onOpenSchedules: () => opened++,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino ? CupertinoApp(home: screen) : MaterialApp(home: screen),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('pipelines-open-schedules')));
|
||||
expect(opened, 1);
|
||||
});
|
||||
}
|
||||
testWidgets('Schedules opens from the bar', (tester) async {
|
||||
var opened = 0;
|
||||
final screen = PipelinesScreen(
|
||||
gateway: gatewayFor(PipelineFixture()),
|
||||
onOpenSchedules: () => opened++,
|
||||
);
|
||||
await tester.pumpWidget(MaterialApp(home: screen));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('pipelines-open-schedules')));
|
||||
expect(opened, 1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -53,17 +52,14 @@ JsonMap noRun() => {'type': 'run', 'run_detail': null};
|
||||
Future<void> pumpScreen(
|
||||
WidgetTester tester,
|
||||
FakeGateway gateway,
|
||||
List<int> navigated, {
|
||||
bool cupertino = false,
|
||||
}) async {
|
||||
List<int> navigated,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(1100, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final screen = PipelinesScreen(gateway: gateway, onRunStarted: navigated.add);
|
||||
await tester.pumpWidget(
|
||||
cupertino ? CupertinoApp(home: screen) : MaterialApp(home: screen),
|
||||
);
|
||||
await tester.pumpWidget(MaterialApp(home: screen));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
@@ -582,74 +578,6 @@ void main() {
|
||||
expect(navigated, [86]);
|
||||
});
|
||||
|
||||
testWidgets('the Cupertino host shows the same native prompt and words', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
final navigated = <int>[];
|
||||
final gateway = launchGateway(
|
||||
fixture,
|
||||
onLaunch: (fields) => acceptedRun(84),
|
||||
);
|
||||
await pumpScreen(tester, gateway, navigated, cupertino: true);
|
||||
await openDetail(tester);
|
||||
await tester.tap(find.byKey(runPipelineActionKey));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(CupertinoAlertDialog), findsOneWidget);
|
||||
expect(find.byType(AlertDialog), findsNothing);
|
||||
expect(find.text('Run Alpha review'), findsOneWidget);
|
||||
expect(find.text(runPipelinePromptLabel), findsOneWidget);
|
||||
expect(find.text(runPipelineWorkspaceLabel), findsOneWidget);
|
||||
expect(find.text(runPipelineNotifyLabel), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(CupertinoAlertDialog),
|
||||
matching: find.text(runPipelineConfirmLabel),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text(runPipelineCancelLabel), findsOneWidget);
|
||||
expect(gateway.callsOf('run_pipeline'), isEmpty);
|
||||
|
||||
await tester.tap(find.byKey(runPipelineCancelKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(CupertinoAlertDialog), findsNothing);
|
||||
expect(gateway.callsOf('run_pipeline'), isEmpty);
|
||||
});
|
||||
|
||||
testWidgets('Cupertino field labels and helper use theme label roles', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = launchGateway(
|
||||
fixture,
|
||||
onLaunch: (fields) => acceptedRun(87),
|
||||
);
|
||||
await pumpScreen(tester, gateway, <int>[], cupertino: true);
|
||||
await openDetail(tester);
|
||||
await tester.tap(find.byKey(runPipelineActionKey));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final context = tester.element(find.byType(CupertinoAlertDialog));
|
||||
final theme = CupertinoTheme.of(context);
|
||||
final labelStyle = theme.textTheme.textStyle;
|
||||
for (final label in [
|
||||
runPipelinePromptLabel,
|
||||
runPipelineWorkspaceLabel,
|
||||
runPipelineNotifyLabel,
|
||||
]) {
|
||||
final style = tester.widget<Text>(find.text(label)).style;
|
||||
expect(style?.color, labelStyle.color, reason: label);
|
||||
expect(style?.fontSize, labelStyle.fontSize, reason: label);
|
||||
}
|
||||
final helper = tester
|
||||
.widget<Text>(find.text(runPipelineWorkspaceHelper))
|
||||
.style;
|
||||
expect(helper?.color, CupertinoColors.secondaryLabel.resolveFrom(context));
|
||||
expect(helper?.fontSize, theme.textTheme.tabLabelTextStyle.fontSize);
|
||||
});
|
||||
|
||||
testWidgets('Schedule… leaves the run dialog for the schedule editor', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user