This repository was archived by the owner on Feb 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 17 files changed +223
-46
lines changed Expand file tree Collapse file tree 17 files changed +223
-46
lines changed Original file line number Diff line number Diff line change 66 dockerfile : .ci/Dockerfile
77 cpu : 8
88 memory : 16G
9+ env :
10+ E2E_PATH : " ./packages/e2e"
911 upgrade_script :
1012 - flutter channel stable
1113 - flutter upgrade
4547 - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi
4648 - flutter channel $CHANNEL
4749 - ./script/build_all_plugins_app.sh apk
50+ - name : e2e_web_smoke_test
51+ # Tests e2e example test in web.
52+ only_if : " changesInclude('.cirrus.yml', 'packages/e2e/**') || $CIRRUS_PR == ''"
53+ install_script :
54+ - flutter config --enable-web
55+ - git clone https://github.com/flutter/web_installers.git
56+ - cd web_installers/packages/web_drivers/
57+ - pub get
58+ - dart lib/web_driver_installer.dart chromedriver --install-only
59+ - ./chromedriver/chromedriver --port=4444 &
60+ test_script :
61+ - cd $E2E_PATH/example/
62+ - flutter drive -v --target=test_driver/example_e2e.dart -d web-server --release --browser-name=chrome
4863 - name : build-apks+java-test+firebase-test-lab
4964 env :
5065 matrix :
Original file line number Diff line number Diff line change 1+ ## 0.2.4+4
2+
3+ * Fixed a hang that occurred on platforms that don't have a ` MethodChannel ` listener registered..
4+
15## 0.2.4+3
26
37* Fixed code snippet in the readme under the "Using Flutter driver to run tests" section.
Original file line number Diff line number Diff line change @@ -69,6 +69,15 @@ cd example
6969flutter drive --driver=test_driver/<package_name>_test.dart test/<package_name>_e2e.dart
7070```
7171
72+ You can run tests on web on release mode.
73+
74+ First you need to make sure you have downloaded the driver for the browser.
75+
76+ ```
77+ cd example
78+ flutter drive -v --target=test_driver/<package_name>dart -d web-server --release --browser-name=chrome
79+ ```
80+
7281## Android device testing
7382
7483Create an instrumentation test file in your application's
Original file line number Diff line number Diff line change 1- import 'dart:io' show Platform;
2- import 'package:flutter/material.dart' ;
1+ import 'my_app.dart' if (dart.library.html) 'my_web_app.dart' ;
32
43// ignore_for_file: public_member_api_docs
54
6- void main () => 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- }
5+ void main () => startApp ();
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 1+ import 'dart:html' as html;
2+ import 'package:flutter/material.dart' ;
3+
4+ // ignore_for_file: public_member_api_docs
5+
6+ void startApp () => runApp (MyWebApp ());
7+
8+ class MyWebApp extends StatefulWidget {
9+ @override
10+ _MyWebAppState createState () => _MyWebAppState ();
11+ }
12+
13+ class _MyWebAppState extends State <MyWebApp > {
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+ key: Key ('mainapp' ),
23+ child: Text ('Platform: ${html .window .navigator .platform }\n ' ),
24+ ),
25+ ),
26+ );
27+ }
28+ }
Original file line number Diff line number Diff line change 55// gestures. You can also use WidgetTester to find child widgets in the widget
66// tree, read text, and verify that the values of widget properties are correct.
77
8- import 'dart:io' show Platform;
9- import 'package:flutter/material.dart' ;
10- import 'package:flutter_test/flutter_test.dart' ;
118import 'package:e2e/e2e.dart' ;
129
13- import 'package:e2e_example/main.dart' ;
10+ import 'example_e2e_io.dart' if (dart.library.html) 'example_e2e_web.dart'
11+ as tests;
1412
1513void main () {
1614 E2EWidgetsFlutterBinding .ensureInitialized ();
17- testWidgets ('verify text' , (WidgetTester tester) async {
18- // Build our app and trigger a frame.
19- await tester.pumpWidget (MyApp ());
20-
21- // Verify that platform version is retrieved.
22- expect (
23- find.byWidgetPredicate (
24- (Widget widget) =>
25- widget is Text &&
26- widget.data.startsWith ('Platform: ${Platform .operatingSystem }' ),
27- ),
28- findsOneWidget,
29- );
30- });
15+ tests.main ();
3116}
Original file line number Diff line number Diff line change 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:e2e/e2e.dart' ;
12+
13+ import 'package:e2e_example/main.dart' as app;
14+
15+ void main () {
16+ E2EWidgetsFlutterBinding .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 version is retrieved.
25+ expect (
26+ find.byWidgetPredicate (
27+ (Widget widget) =>
28+ widget is Text &&
29+ widget.data.startsWith ('Platform: ${Platform .operatingSystem }' ),
30+ ),
31+ findsOneWidget,
32+ );
33+ });
34+ }
Original file line number Diff line number Diff line change 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:e2e/e2e.dart' ;
12+
13+ import 'package:e2e_example/main.dart' as app;
14+
15+ void main () {
16+ E2EWidgetsFlutterBinding .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 number Diff line number Diff line change @@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
66import 'package:flutter_test/flutter_test.dart' ;
77import 'package:e2e/e2e.dart' ;
88
9- import 'package:e2e_example/main.dart' ;
9+ import 'package:e2e_example/main.dart' as app ;
1010
1111// Tests the failure behavior of the E2EWidgetsFlutterBinding
1212//
@@ -21,10 +21,10 @@ void main() {
2121
2222 testWidgets ('failure 1' , (WidgetTester tester) async {
2323 // Build our app and trigger a frame.
24- await tester. pumpWidget ( MyApp () );
24+ app. main ( );
2525
2626 // Verify that platform version is retrieved.
27- expect (
27+ await expectLater (
2828 find.byWidgetPredicate (
2929 (Widget widget) =>
3030 widget is Text && widget.data.startsWith ('This should fail' ),
You can’t perform that action at this time.
0 commit comments