-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
457 additions
and
1,486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
ignore: | ||
- "lib/screens/settings/about/about.dart" | ||
- "lib/**/*.g.dart" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:pi_hole_client/screens/logs/clients_filters_modal.dart'; | ||
|
||
import '../helpers.dart'; | ||
|
||
void main() async { | ||
await initializeApp(); | ||
|
||
group( | ||
'Client filter modal tests', | ||
() { | ||
late TestSetupHelper testSetup; | ||
|
||
setUp(() async { | ||
testSetup = TestSetupHelper(); | ||
testSetup.initializeMock(useApiGatewayVersion: 'v6'); | ||
}); | ||
|
||
testWidgets( | ||
'should uncheck all filter', | ||
(WidgetTester tester) async { | ||
tester.view.physicalSize = const Size(1080, 2400); | ||
tester.view.devicePixelRatio = 2.0; | ||
|
||
addTearDown(() { | ||
tester.view.resetPhysicalSize(); | ||
tester.view.resetDevicePixelRatio(); | ||
}); | ||
|
||
await tester.pumpWidget( | ||
testSetup.buildTestWidget( | ||
const ClientsFiltersModal( | ||
statusBarHeight: 24, | ||
bottomNavBarHeight: 48, | ||
selectedClients: ['192.168.100.2', 'localhost'], | ||
window: false, | ||
), | ||
), | ||
); | ||
|
||
expect(find.byType(ClientsFiltersModal), findsOneWidget); | ||
expect(find.text('Clients'), findsOneWidget); | ||
expect(find.text('Uncheck all'), findsOneWidget); | ||
expect(find.text('Close'), findsOneWidget); | ||
expect(find.text('Apply'), findsOneWidget); | ||
await tester.tap(find.text('Uncheck all')); | ||
await tester.pumpAndSettle(); | ||
|
||
await tester.tap(find.text('Apply')); | ||
await tester.pumpAndSettle(); | ||
}, | ||
); | ||
|
||
testWidgets( | ||
'should check all clients', | ||
(WidgetTester tester) async { | ||
tester.view.physicalSize = const Size(1080, 2400); | ||
tester.view.devicePixelRatio = 2.0; | ||
|
||
addTearDown(() { | ||
tester.view.resetPhysicalSize(); | ||
tester.view.resetDevicePixelRatio(); | ||
}); | ||
|
||
await tester.pumpWidget( | ||
testSetup.buildTestWidget( | ||
const ClientsFiltersModal( | ||
statusBarHeight: 24, | ||
bottomNavBarHeight: 48, | ||
selectedClients: [], | ||
window: false, | ||
), | ||
), | ||
); | ||
|
||
expect(find.byType(ClientsFiltersModal), findsOneWidget); | ||
expect(find.text('Clients'), findsOneWidget); | ||
expect(find.text('Check all'), findsOneWidget); | ||
expect(find.text('Close'), findsOneWidget); | ||
expect(find.text('Apply'), findsOneWidget); | ||
await tester.tap(find.text('Check all')); | ||
await tester.pumpAndSettle(); | ||
|
||
await tester.tap(find.text('Apply')); | ||
await tester.pumpAndSettle(); | ||
}, | ||
); | ||
}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:pi_hole_client/screens/logs/logs_filters_modal.dart'; | ||
|
||
import '../helpers.dart'; | ||
|
||
// TODO: Fix this test | ||
// ═╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ | ||
// The following assertion was thrown during layout: | ||
|
||
void main() async { | ||
await initializeApp(); | ||
|
||
group( | ||
'Query logs screen tests', | ||
() { | ||
late TestSetupHelper testSetup; | ||
|
||
setUp(() async { | ||
testSetup = TestSetupHelper(); | ||
testSetup.initializeMock(useApiGatewayVersion: 'v6'); | ||
}); | ||
|
||
testWidgets( | ||
'should show logs screen on mobile layout', | ||
(WidgetTester tester) async { | ||
tester.view.physicalSize = const Size(1080, 2400); | ||
tester.view.devicePixelRatio = 2.0; | ||
|
||
addTearDown(() { | ||
tester.view.resetPhysicalSize(); | ||
tester.view.resetDevicePixelRatio(); | ||
}); | ||
|
||
await tester.pumpWidget( | ||
testSetup.buildTestWidget( | ||
LogsFiltersModal( | ||
statusBarHeight: 24.0, | ||
bottomNavBarHeight: 48.0, | ||
filterLogs: () {}, | ||
window: true, | ||
), | ||
), | ||
); | ||
|
||
expect(find.byType(LogsFiltersModal), findsOneWidget); | ||
}, | ||
skip: true, | ||
); | ||
}, | ||
); | ||
} |
Oops, something went wrong.