Fix screenshot tests

This commit is contained in:
Roland Geider
2023-02-06 22:32:22 +01:00
parent 90501ad35c
commit b1b60b691c
2 changed files with 21 additions and 23 deletions

View File

@@ -99,7 +99,7 @@ Widget createNutritionalPlanScreen({locale = 'en'}) {
create: (context) => NutritionPlansProvider(testAuthProvider, [], client),
),
ChangeNotifierProvider<BodyWeightProvider>(
create: (context) => BodyWeightProvider(testAuthProvider, [], client),
create: (context) => BodyWeightProvider(mockBaseProvider),
),
],
child: MaterialApp(

View File

@@ -7,32 +7,30 @@ import 'package:wger/screens/form_screen.dart';
import 'package:wger/screens/weight_screen.dart';
import 'package:wger/theme/theme.dart';
import '../test/other/base_provider_test.mocks.dart';
import '../test/utils.dart';
Widget createWeightScreen({locale = 'en'}) {
final provider = BodyWeightProvider(mockBaseProvider);
provider.items = [
WeightEntry(id: 1, weight: 86, date: DateTime(2021, 01, 01)),
WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10)),
WeightEntry(id: 3, weight: 82, date: DateTime(2021, 01, 20)),
WeightEntry(id: 4, weight: 83, date: DateTime(2021, 01, 30)),
WeightEntry(id: 5, weight: 86, date: DateTime(2021, 02, 20)),
WeightEntry(id: 6, weight: 90, date: DateTime(2021, 02, 28)),
WeightEntry(id: 7, weight: 91, date: DateTime(2021, 03, 20)),
WeightEntry(id: 8, weight: 91.1, date: DateTime(2021, 03, 30)),
WeightEntry(id: 9, weight: 90, date: DateTime(2021, 05, 1)),
WeightEntry(id: 10, weight: 91, date: DateTime(2021, 6, 5)),
WeightEntry(id: 11, weight: 89, date: DateTime(2021, 6, 20)),
WeightEntry(id: 12, weight: 88, date: DateTime(2021, 7, 15)),
WeightEntry(id: 13, weight: 86, date: DateTime(2021, 7, 20)),
WeightEntry(id: 14, weight: 83, date: DateTime(2021, 7, 30)),
WeightEntry(id: 15, weight: 80, date: DateTime(2021, 8, 10))
];
return ChangeNotifierProvider<BodyWeightProvider>(
create: (context) => BodyWeightProvider(
testAuthProvider,
[
WeightEntry(id: 1, weight: 86, date: DateTime(2021, 01, 01)),
WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10)),
WeightEntry(id: 3, weight: 82, date: DateTime(2021, 01, 20)),
WeightEntry(id: 4, weight: 83, date: DateTime(2021, 01, 30)),
WeightEntry(id: 5, weight: 86, date: DateTime(2021, 02, 20)),
WeightEntry(id: 6, weight: 90, date: DateTime(2021, 02, 28)),
WeightEntry(id: 7, weight: 91, date: DateTime(2021, 03, 20)),
WeightEntry(id: 8, weight: 91.1, date: DateTime(2021, 03, 30)),
WeightEntry(id: 9, weight: 90, date: DateTime(2021, 05, 1)),
WeightEntry(id: 10, weight: 91, date: DateTime(2021, 6, 5)),
WeightEntry(id: 11, weight: 89, date: DateTime(2021, 6, 20)),
WeightEntry(id: 12, weight: 88, date: DateTime(2021, 7, 15)),
WeightEntry(id: 13, weight: 86, date: DateTime(2021, 7, 20)),
WeightEntry(id: 14, weight: 83, date: DateTime(2021, 7, 30)),
WeightEntry(id: 15, weight: 80, date: DateTime(2021, 8, 10))
],
MockClient(),
),
create: (context) => provider,
child: MaterialApp(
locale: Locale(locale),
debugShowCheckedModeBanner: false,