Skip to content

Commit df2774f

Browse files
swift-kimbbrto21
andauthored
[integration_test] Add integration_test_tizen package (#2)
Co-authored-by: Boram Bae <[email protected]>
1 parent 9c30669 commit df2774f

31 files changed

+745
-0
lines changed
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 1.0.0
2+
3+
* Initial release

packages/integration_test/LICENSE

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
2+
Copyright (c) 2019 The Chromium Authors. All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the names of the copyright holders nor the names of the
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

packages/integration_test/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# integration_test_tizen
2+
3+
The Tizen implementation of [`integration_test`](https://github.com/flutter/plugins/tree/master/packages/integration_test).
4+
5+
## Usage
6+
7+
This package is not an _endorsed_ implementation of `integration_test`. Therefore, you have to include `integration_test_tizen` alongside `integration_test` as dependencies in your `pubspec.yaml` file.
8+
9+
```yaml
10+
dependencies:
11+
integration_test: ^0.9.2
12+
integration_test_tizen: ^1.0.0
13+
```
14+
15+
Then you can import `integration_test` in your Dart code:
16+
17+
```dart
18+
import 'package:integration_test/integration_test.dart';
19+
```
20+
21+
For detailed usage, see https://github.com/flutter/plugins/tree/master/packages/integration_test#usage.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
#.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
.dart_tool/
26+
.flutter-plugins
27+
.packages
28+
.pub-cache/
29+
.pub/
30+
/build/
31+
32+
# Android related
33+
**/android/**/gradle-wrapper.jar
34+
**/android/.gradle
35+
**/android/captures/
36+
**/android/gradlew
37+
**/android/gradlew.bat
38+
**/android/local.properties
39+
**/android/**/GeneratedPluginRegistrant.java
40+
41+
# iOS/XCode related
42+
**/ios/**/*.mode1v3
43+
**/ios/**/*.mode2v3
44+
**/ios/**/*.moved-aside
45+
**/ios/**/*.pbxuser
46+
**/ios/**/*.perspectivev3
47+
**/ios/**/*sync/
48+
**/ios/**/.sconsign.dblite
49+
**/ios/**/.tags*
50+
**/ios/**/.vagrant/
51+
**/ios/**/DerivedData/
52+
**/ios/**/Icon?
53+
**/ios/**/Pods/
54+
**/ios/**/.symlinks/
55+
**/ios/**/profile
56+
**/ios/**/xcuserdata
57+
**/ios/.generated/
58+
**/ios/Flutter/App.framework
59+
**/ios/Flutter/Flutter.framework
60+
**/ios/Flutter/Generated.xcconfig
61+
**/ios/Flutter/app.flx
62+
**/ios/Flutter/app.zip
63+
**/ios/Flutter/flutter_assets/
64+
**/ios/Flutter/flutter_export_environment.sh
65+
**/ios/ServiceDefinitions.json
66+
**/ios/Runner/GeneratedPluginRegistrant.*
67+
68+
# Exceptions to above rules.
69+
!**/ios/**/default.mode1v3
70+
!**/ios/**/default.mode2v3
71+
!**/ios/**/default.pbxuser
72+
!**/ios/**/default.perspectivev3
73+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# integration_test_example
2+
3+
Demonstrates how to use the integration_test_tizen plugin.
4+
5+
To run `integration_test/example_test.dart` with the [flutter-tizen](https://github.com/flutter-tizen/flutter-tizen) tool, use the following command.
6+
7+
```sh
8+
flutter-tizen drive \
9+
--driver=test_driver/integration_test.dart \
10+
--target=integration_test/example_test.dart
11+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// This is a basic Flutter widget test.
2+
//
3+
// To perform an interaction with a widget in your test, use the WidgetTester
4+
// utility that Flutter provides. For example, you can send tap and scroll
5+
// gestures. You can also use WidgetTester to find child widgets in the widget
6+
// tree, read text, and verify that the values of widget properties are correct.
7+
8+
import 'dart:io' show Platform;
9+
import 'package:flutter/material.dart';
10+
import 'package:flutter_test/flutter_test.dart';
11+
import 'package:integration_test/integration_test.dart';
12+
13+
import 'package:integration_test_example/main.dart' as app;
14+
15+
void main() {
16+
final IntegrationTestWidgetsFlutterBinding binding =
17+
IntegrationTestWidgetsFlutterBinding.ensureInitialized()
18+
as IntegrationTestWidgetsFlutterBinding;
19+
testWidgets('verify text', (WidgetTester tester) async {
20+
// Build our app and trigger a frame.
21+
app.main();
22+
23+
// Trace the timeline of the following operation. The timeline result will
24+
// be written to `build/integration_response_data.json` with the key
25+
// `timeline`.
26+
await binding.traceAction(() async {
27+
// Trigger a frame.
28+
await tester.pumpAndSettle();
29+
30+
// Verify that platform version is retrieved.
31+
expect(
32+
find.byWidgetPredicate(
33+
(Widget widget) =>
34+
widget is Text &&
35+
widget.data.startsWith('Platform: ${Platform.operatingSystem}'),
36+
),
37+
findsOneWidget,
38+
);
39+
});
40+
});
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// This is a basic Flutter widget test.
2+
//
3+
// To perform an interaction with a widget in your test, use the WidgetTester
4+
// utility that Flutter provides. For example, you can send tap and scroll
5+
// gestures. You can also use WidgetTester to find child widgets in the widget
6+
// tree, read text, and verify that the values of widget properties are correct.
7+
8+
import 'dart:html' as html;
9+
import 'package:flutter/material.dart';
10+
import 'package:flutter_test/flutter_test.dart';
11+
import 'package:integration_test/integration_test.dart';
12+
13+
import 'package:integration_test_example/main.dart' as app;
14+
15+
void main() {
16+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
17+
testWidgets('verify text', (WidgetTester tester) async {
18+
// Build our app and trigger a frame.
19+
app.main();
20+
21+
// Trigger a frame.
22+
await tester.pumpAndSettle();
23+
24+
// Verify that platform is retrieved.
25+
expect(
26+
find.byWidgetPredicate(
27+
(Widget widget) =>
28+
widget is Text &&
29+
widget.data
30+
.startsWith('Platform: ${html.window.navigator.platform}\n'),
31+
),
32+
findsOneWidget,
33+
);
34+
});
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// This is a basic Flutter widget test.
2+
//
3+
// To perform an interaction with a widget in your test, use the WidgetTester
4+
// utility that Flutter provides. For example, you can send tap and scroll
5+
// gestures. You can also use WidgetTester to find child widgets in the widget
6+
// tree, read text, and verify that the values of widget properties are correct.
7+
8+
import 'dart:io' show Platform;
9+
import 'package:flutter/material.dart';
10+
import 'package:flutter_test/flutter_test.dart';
11+
import 'package:integration_test/integration_test.dart';
12+
13+
import 'package:integration_test_example/main.dart' as app;
14+
15+
void main() {
16+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
17+
18+
testWidgets('verify text', (WidgetTester tester) async {
19+
// Build our app and trigger a frame.
20+
app.main();
21+
22+
// Trigger a frame.
23+
await tester.pumpAndSettle();
24+
25+
// TODO: https://github.com/flutter/flutter/issues/51890
26+
// Add screenshot capability for mobile platforms.
27+
28+
// Verify that platform version is retrieved.
29+
expect(
30+
find.byWidgetPredicate(
31+
(Widget widget) =>
32+
widget is Text &&
33+
widget.data.startsWith('Platform: ${Platform.operatingSystem}'),
34+
),
35+
findsOneWidget,
36+
);
37+
});
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// This is a basic Flutter widget test.
2+
//
3+
// To perform an interaction with a widget in your test, use the WidgetTester
4+
// utility that Flutter provides. For example, you can send tap and scroll
5+
// gestures. You can also use WidgetTester to find child widgets in the widget
6+
// tree, read text, and verify that the values of widget properties are correct.
7+
8+
import 'dart:html' as html;
9+
import 'package:flutter/material.dart';
10+
import 'package:flutter_test/flutter_test.dart';
11+
import 'package:integration_test/integration_test.dart';
12+
13+
import 'package:integration_test_example/main.dart' as app;
14+
15+
void main() {
16+
final IntegrationTestWidgetsFlutterBinding binding =
17+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
18+
19+
testWidgets('verify text', (WidgetTester tester) async {
20+
// Build our app and trigger a frame.
21+
app.main();
22+
23+
// Trigger a frame.
24+
await tester.pumpAndSettle();
25+
26+
// Take a screenshot.
27+
await binding.takeScreenshot('platform_name');
28+
29+
// Verify that platform is retrieved.
30+
expect(
31+
find.byWidgetPredicate(
32+
(Widget widget) =>
33+
widget is Text &&
34+
widget.data
35+
.startsWith('Platform: ${html.window.navigator.platform}\n'),
36+
),
37+
findsOneWidget,
38+
);
39+
});
40+
41+
testWidgets('verify screenshot', (WidgetTester tester) async {
42+
// Build our app and trigger a frame.
43+
app.main();
44+
45+
// Trigger a frame.
46+
await tester.pumpAndSettle();
47+
48+
// Multiple methods can take screenshots. Screenshots are taken with the
49+
// same order the methods run.
50+
await binding.takeScreenshot('platform_name_2');
51+
});
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This is a basic Flutter widget test.
2+
//
3+
// To perform an interaction with a widget in your test, use the WidgetTester
4+
// utility that Flutter provides. For example, you can send tap and scroll
5+
// gestures. You can also use WidgetTester to find child widgets in the widget
6+
// tree, read text, and verify that the values of widget properties are correct.
7+
8+
import 'package:integration_test/integration_test.dart';
9+
10+
import '_example_test_io.dart' if (dart.library.html) '_example_test_web.dart'
11+
as tests;
12+
13+
void main() {
14+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
15+
tests.main();
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This is a Flutter widget test can take a screenshot.
2+
//
3+
// NOTE: Screenshots are only supported on Web for now. For Web, this needs to
4+
// be executed with the `test_driver/integration_test_extended_driver.dart`.
5+
//
6+
// To perform an interaction with a widget in your test, use the WidgetTester
7+
// utility that Flutter provides. For example, you can send tap and scroll
8+
// gestures. You can also use WidgetTester to find child widgets in the widget
9+
// tree, read text, and verify that the values of widget properties are correct.
10+
11+
import 'package:integration_test/integration_test.dart';
12+
13+
import '_extended_test_io.dart' if (dart.library.html) '_extended_test_web.dart'
14+
as tests;
15+
16+
void main() {
17+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
18+
tests.main();
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import 'my_app.dart' if (dart.library.html) 'my_web_app.dart';
2+
3+
// ignore_for_file: public_member_api_docs
4+
5+
void main() => startApp();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'dart:io' show Platform;
2+
import 'package:flutter/material.dart';
3+
4+
// ignore_for_file: public_member_api_docs
5+
6+
void startApp() => runApp(MyApp());
7+
8+
class MyApp extends StatefulWidget {
9+
@override
10+
_MyAppState createState() => _MyAppState();
11+
}
12+
13+
class _MyAppState extends State<MyApp> {
14+
@override
15+
Widget build(BuildContext context) {
16+
return MaterialApp(
17+
home: Scaffold(
18+
appBar: AppBar(
19+
title: const Text('Plugin example app'),
20+
),
21+
body: Center(
22+
child: Text('Platform: ${Platform.operatingSystem}\n'),
23+
),
24+
),
25+
);
26+
}
27+
}

0 commit comments

Comments
 (0)