Skip to content

Commit

Permalink
test: ✅ add the first smoke test
Browse files Browse the repository at this point in the history
check if the application starts on the correct screen
  • Loading branch information
lukki15 committed Jan 5, 2025
1 parent 27a742b commit fcab8bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
6 changes: 3 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import 'package:network_info_app/pages/main_scaffold.dart';

Future<void> main() async {
await setupNetworkTools();
runApp(const _Application());
runApp(const Application());
}

class _Application extends StatelessWidget {
const _Application();
class Application extends StatelessWidget {
const Application({super.key});

@override
Widget build(BuildContext context) => MaterialApp(
Expand Down
19 changes: 5 additions & 14 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,17 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:network_info_app/main.dart';

void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
testWidgets('Application smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
await tester.pumpWidget(const Application());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();

// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
// starts with the network info screen
expect(find.text('Network Info'), findsOneWidget);
expect(find.text('Wi-Fi'), findsOneWidget);
});
}

0 comments on commit fcab8bb

Please sign in to comment.