Remove Cupertino variants from runs sheet tests
Keep the runs sheet coverage focused on the Material-only app path and remove obsolete Cupertino hosts and loop variants.
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/api_gateway.dart';
|
import 'package:pipelines_app/core/api_gateway.dart';
|
||||||
@@ -39,11 +38,7 @@ void main() {
|
|||||||
await gateway.framesController.close();
|
await gateway.framesController.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<void> mount(
|
Future<void> mount(WidgetTester tester, {String? createdAt}) async {
|
||||||
WidgetTester tester, {
|
|
||||||
required bool cupertino,
|
|
||||||
String? createdAt,
|
|
||||||
}) async {
|
|
||||||
tester.view.physicalSize = const Size(800, 1400);
|
tester.view.physicalSize = const Size(800, 1400);
|
||||||
tester.view.devicePixelRatio = 1;
|
tester.view.devicePixelRatio = 1;
|
||||||
addTearDown(tester.view.resetPhysicalSize);
|
addTearDown(tester.view.resetPhysicalSize);
|
||||||
@@ -67,54 +62,44 @@ void main() {
|
|||||||
builder: (context, _) =>
|
builder: (context, _) =>
|
||||||
RunsList(controller: controller, onSelected: (_) {}),
|
RunsList(controller: controller, onSelected: (_) {}),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: list)));
|
||||||
cupertino
|
|
||||||
? CupertinoApp(home: CupertinoPageScaffold(child: list))
|
|
||||||
: MaterialApp(home: Scaffold(body: list)),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('filter sheet has a header whose Done closes it', (tester) async {
|
||||||
final host = cupertino ? 'Cupertino' : 'Material';
|
await mount(tester);
|
||||||
|
await tester.tap(find.byKey(const ValueKey('runs.filter')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
testWidgets('$host filter sheet has a header whose Done closes it', (
|
expect(find.byType(AppSheetHeader), findsOneWidget);
|
||||||
tester,
|
expect(
|
||||||
) async {
|
find.descendant(
|
||||||
await mount(tester, cupertino: cupertino);
|
of: find.byType(AppSheetHeader),
|
||||||
await tester.tap(find.byKey(const ValueKey('runs.filter')));
|
matching: find.text(runsFilterTitle),
|
||||||
await tester.pumpAndSettle();
|
),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
expect(find.text('Queued'), findsOneWidget);
|
||||||
|
expect(find.text('queued'), findsNothing);
|
||||||
|
expect(find.byKey(runsFilterClearKey), findsNothing);
|
||||||
|
|
||||||
expect(find.byType(AppSheetHeader), findsOneWidget);
|
await tester.tap(find.text('Last 7 days'));
|
||||||
expect(
|
await tester.pumpAndSettle();
|
||||||
find.descendant(
|
expect(controller.timeRange, 'last_7_days');
|
||||||
of: find.byType(AppSheetHeader),
|
// An active filter offers Clear in the header.
|
||||||
matching: find.text(runsFilterTitle),
|
expect(find.byKey(runsFilterClearKey), findsOneWidget);
|
||||||
),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(find.text('Queued'), findsOneWidget);
|
|
||||||
expect(find.text('queued'), findsNothing);
|
|
||||||
expect(find.byKey(runsFilterClearKey), findsNothing);
|
|
||||||
|
|
||||||
await tester.tap(find.text('Last 7 days'));
|
await tester.tap(find.byKey(runsFilterDoneKey));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(controller.timeRange, 'last_7_days');
|
expect(find.byKey(const ValueKey('runs.filter.sheet')), findsNothing);
|
||||||
// An active filter offers Clear in the header.
|
// The applied chip reads in sentence case too.
|
||||||
expect(find.byKey(runsFilterClearKey), findsOneWidget);
|
expect(find.textContaining('Last 7 days'), findsOneWidget);
|
||||||
|
});
|
||||||
await tester.tap(find.byKey(runsFilterDoneKey));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byKey(const ValueKey('runs.filter.sheet')), findsNothing);
|
|
||||||
// The applied chip reads in sentence case too.
|
|
||||||
expect(find.textContaining('Last 7 days'), findsOneWidget);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
testWidgets('Material single-choice groups are check rows, not checkboxes', (
|
testWidgets('Material single-choice groups are check rows, not checkboxes', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await mount(tester, cupertino: false);
|
await mount(tester);
|
||||||
await tester.tap(find.byKey(const ValueKey('runs.filter')));
|
await tester.tap(find.byKey(const ValueKey('runs.filter')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
@@ -139,7 +124,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Material sort opens an anchored choice menu', (tester) async {
|
testWidgets('Material sort opens an anchored choice menu', (tester) async {
|
||||||
await mount(tester, cupertino: false);
|
await mount(tester);
|
||||||
await tester.tap(find.byKey(const ValueKey('runs.sort')));
|
await tester.tap(find.byKey(const ValueKey('runs.sort')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.byKey(const ValueKey('app-choice-menu')), findsOneWidget);
|
expect(find.byKey(const ValueKey('app-choice-menu')), findsOneWidget);
|
||||||
@@ -153,7 +138,6 @@ void main() {
|
|||||||
) async {
|
) async {
|
||||||
await mount(
|
await mount(
|
||||||
tester,
|
tester,
|
||||||
cupertino: false,
|
|
||||||
createdAt: DateTime(2020, 1, 1).toIso8601String(),
|
createdAt: DateTime(2020, 1, 1).toIso8601String(),
|
||||||
);
|
);
|
||||||
await tester.tap(find.byKey(const ValueKey('runs.stats')));
|
await tester.tap(find.byKey(const ValueKey('runs.stats')));
|
||||||
@@ -171,7 +155,7 @@ void main() {
|
|||||||
testWidgets('the 7-day chart shows bars over an axis when runs started', (
|
testWidgets('the 7-day chart shows bars over an axis when runs started', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await mount(tester, cupertino: true);
|
await mount(tester);
|
||||||
await tester.tap(find.byKey(const ValueKey('runs.stats')));
|
await tester.tap(find.byKey(const ValueKey('runs.stats')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.byKey(const ValueKey('runs.stats.days')), findsOneWidget);
|
expect(find.byKey(const ValueKey('runs.stats.days')), findsOneWidget);
|
||||||
|
|||||||
Reference in New Issue
Block a user