Add mobile Test
parent
942c4e9ef7
commit
7c0d2cdf2e
|
@ -64,6 +64,62 @@ void main() {
|
|||
expect(beetrepo.getRow(0).plants[0].id, plant.id,reason: 'Plant drop should be same Plant');
|
||||
});
|
||||
|
||||
testWidgets('Content widget displays all widgets mobile',
|
||||
(WidgetTester tester) async {
|
||||
//Arrange
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body:
|
||||
SizedBox(
|
||||
width: 1080-250, //Sidebar width
|
||||
height: 2400,
|
||||
child:
|
||||
Content(
|
||||
beetRepository: BeetRepositoryGenerator.getBeetRepository(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
//Assert
|
||||
expect(find.byType(Control), findsOneWidget,
|
||||
reason: 'Control widget is missing');
|
||||
expect(find.byType(Dashboard), findsOneWidget,
|
||||
reason: 'Control widget is missing');
|
||||
expect(find.byType(NewBeetRow), findsOneWidget,
|
||||
reason: 'Control widget is missing');
|
||||
expect(find.byType(Footer), findsOneWidget,
|
||||
reason: 'Control widget is missing');
|
||||
});
|
||||
|
||||
testWidgets('Content widget drop Plant delegate work',
|
||||
(WidgetTester tester) async {
|
||||
|
||||
final Plant plant = PlantGenerator.getPlant();
|
||||
final BeetRepository beetrepo = BeetRepositoryGenerator.getBeetRepository();
|
||||
|
||||
//Arrange
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Content(
|
||||
beetRepository: beetrepo,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
//Act
|
||||
final contentState = tester.state<ContentState>(find.byType(Content));
|
||||
contentState.plantDroppedOnRow(0, plant);
|
||||
|
||||
// Assert Plant is Dropped
|
||||
expect(beetrepo.getRow(0).plants.length, 1,reason: 'No Plant saved');
|
||||
expect(beetrepo.getRow(0).plants[0].id, plant.id,reason: 'Plant drop should be same Plant');
|
||||
});
|
||||
|
||||
testWidgets('Content widget new Row', (WidgetTester tester) async {
|
||||
final BeetRepository beetrepo = BeetRepositoryGenerator.getBeetRepository();
|
||||
|
||||
|
|
Loading…
Reference in New Issue