mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Split CI testing based on flutter channels (#651)
This commit is contained in:
@@ -23,7 +23,8 @@ class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
|
||||
static Route<void> _routeBuilder(BuildContext context, Object argument) {
|
||||
return CupertinoPageRoute(
|
||||
builder: (context) => VeggieCategorySettingsScreen(restorationId: 'category'),
|
||||
builder: (context) =>
|
||||
VeggieCategorySettingsScreen(restorationId: 'category'),
|
||||
title: 'Preferred Categories',
|
||||
);
|
||||
}
|
||||
@@ -136,9 +137,10 @@ class CalorieSettingsScreen extends StatelessWidget {
|
||||
label: cals.toString(),
|
||||
icon: SettingsIcon(
|
||||
icon: Styles.checkIcon,
|
||||
foregroundColor: snapshot.hasData && snapshot.data == cals
|
||||
? CupertinoColors.activeBlue
|
||||
: Styles.transparentColor,
|
||||
foregroundColor:
|
||||
snapshot.hasData && snapshot.data == cals
|
||||
? CupertinoColors.activeBlue
|
||||
: Styles.transparentColor,
|
||||
backgroundColor: Styles.transparentColor,
|
||||
),
|
||||
onPress: snapshot.hasData
|
||||
@@ -219,7 +221,8 @@ class SettingsScreen extends StatelessWidget {
|
||||
restorationId: restorationId,
|
||||
child: CupertinoPageScaffold(
|
||||
child: Container(
|
||||
color: Styles.scaffoldBackground(CupertinoTheme.brightnessOf(context)),
|
||||
color:
|
||||
Styles.scaffoldBackground(CupertinoTheme.brightnessOf(context)),
|
||||
child: CustomScrollView(
|
||||
restorationId: 'list',
|
||||
slivers: <Widget>[
|
||||
|
||||
@@ -43,27 +43,32 @@ void main() {
|
||||
expect(find.text('Grapes'), findsNothing);
|
||||
expect(find.text('Figs'), findsOneWidget);
|
||||
expect(find.text('Serving info'), findsOneWidget);
|
||||
expect(tester.widget<CupertinoSwitch>(find.byType(CupertinoSwitch)).value, isFalse);
|
||||
expect(tester.widget<CupertinoSwitch>(find.byType(CupertinoSwitch)).value,
|
||||
isFalse);
|
||||
await tester.tap(find.byType(CupertinoSwitch));
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.widget<CupertinoSwitch>(find.byType(CupertinoSwitch)).value, isTrue);
|
||||
expect(tester.widget<CupertinoSwitch>(find.byType(CupertinoSwitch)).value,
|
||||
isTrue);
|
||||
|
||||
// Current details page is restored.
|
||||
await tester.restartAndRestore();
|
||||
expect(find.text('Grapes'), findsNothing);
|
||||
expect(find.text('Figs'), findsOneWidget);
|
||||
expect(find.text('Serving info'), findsOneWidget);
|
||||
expect(tester.widget<CupertinoSwitch>(find.byType(CupertinoSwitch)).value, isTrue);
|
||||
expect(tester.widget<CupertinoSwitch>(find.byType(CupertinoSwitch)).value,
|
||||
isTrue);
|
||||
|
||||
await tester.tap(find.text('Trivia'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Serving info'), findsNothing);
|
||||
expect(find.text("Which of these isn't a variety of figs?"), findsOneWidget);
|
||||
expect(
|
||||
find.text("Which of these isn't a variety of figs?"), findsOneWidget);
|
||||
|
||||
// Restores to trivia page.
|
||||
await tester.restartAndRestore();
|
||||
expect(find.text('Serving info'), findsNothing);
|
||||
expect(find.text("Which of these isn't a variety of figs?"), findsOneWidget);
|
||||
expect(
|
||||
find.text("Which of these isn't a variety of figs?"), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Brown Turkey'));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -92,13 +97,15 @@ void main() {
|
||||
await tester.tap(find.text('My Garden'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('My Garden'), findsNWidgets(2)); // Name of the tap & title of page.
|
||||
expect(find.text('My Garden'),
|
||||
findsNWidgets(2)); // Name of the tap & title of page.
|
||||
expect(find.text('Grapes'), findsNothing);
|
||||
expect(find.text('Figs'), findsOneWidget);
|
||||
|
||||
// Restores the current selected tab.
|
||||
await tester.restartAndRestore();
|
||||
expect(find.text('My Garden'), findsNWidgets(2)); // Name of the tap & title of page.
|
||||
expect(find.text('My Garden'),
|
||||
findsNWidgets(2)); // Name of the tap & title of page.
|
||||
expect(find.text('Grapes'), findsNothing);
|
||||
expect(find.text('Figs'), findsOneWidget);
|
||||
expect(find.text('Apples'), findsNothing);
|
||||
@@ -109,7 +116,8 @@ void main() {
|
||||
|
||||
expect(find.text('Apples'), findsOneWidget);
|
||||
expect(find.text('Tangelo'), findsNothing);
|
||||
await tester.enterText(find.byType(CupertinoTextField).hitTestable(), 'Tan');
|
||||
await tester.enterText(
|
||||
find.byType(CupertinoTextField).hitTestable(), 'Tan');
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Apples'), findsNothing);
|
||||
expect(find.text('Tangelo'), findsOneWidget);
|
||||
@@ -129,7 +137,7 @@ void main() {
|
||||
|
||||
expect(find.text('Tangelo'), findsOneWidget);
|
||||
expect(find.text('Serving info'), findsOneWidget);
|
||||
|
||||
|
||||
// Restores details page
|
||||
await tester.restartAndRestore();
|
||||
expect(find.text('Tangelo'), findsOneWidget);
|
||||
|
||||
Reference in New Issue
Block a user