This repository has been archived on 2023-09-08. You can view files and clone it, but cannot push or open issues or pull requests.
moxplatform/src/my_plugin/example/integration_test/app_test.dart

31 lines
926 B
Dart
Raw Normal View History

2022-02-28 18:02:46 +00:00
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}');
}