ci: e2e tests (#9)

This commit is contained in:
Felix Angelov
2022-02-28 12:02:46 -06:00
committed by GitHub
parent 568ff904a3
commit 229c2755d7
4 changed files with 170 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:my_plugin_example/main.dart' as app;
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
group('E2E', () {
testWidgets('getPlatformName', (tester) async {
app.main();
await tester.pumpAndSettle();
await tester.tap(find.text('Get Platform Name'));
await tester.pumpAndSettle();
final expected = expectedPlatformName();
await tester.ensureVisible(find.text('Platform Name: $expected'));
});
});
}
String expectedPlatformName() {
if (Platform.isAndroid) return 'Android';
if (Platform.isIOS) return 'iOS';
if (Platform.isLinux) return 'Linux';
if (Platform.isMacOS) return 'MacOS';
if (Platform.isWindows) return 'Windows';
throw UnsupportedError('Unsupported platform ${Platform.operatingSystem}');
}

View File

@@ -19,6 +19,10 @@ dependencies:
path: ../
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
very_good_analysis: ^2.4.0
flutter:

View File

@@ -37,9 +37,9 @@ dependencies:
my_plugin_windows:
path: ../my_plugin_windows
dev_dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
sdk: flutter
mocktail: ^0.2.0
plugin_platform_interface: ^2.0.0
very_good_analysis: ^2.4.0