This repository was archived by the owner on Feb 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +36
-26
lines changed
packages/e2e/example/test_driver Expand file tree Collapse file tree 4 files changed +36
-26
lines changed 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' as app ;
10+ import 'example_e2e_io .dart' if (dart.library.html) 'example_e2e_web.dart' as tests ;
1411
1512void main () {
1613 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- });
14+ tests.main ();
3415}
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 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- @TestOn ('browser' )
9-
108import 'dart:html' as html;
119import 'package:flutter/material.dart' ;
1210import 'package:flutter_test/flutter_test.dart' ;
Original file line number Diff line number Diff line change 1- @TestOn ('browser' )
2-
31import 'dart:async' ;
42import 'dart:io' ;
53
64import 'package:flutter_driver/flutter_driver.dart' ;
7- import 'package:test/test.dart' ;
85
96Future <void > main () async {
107 final FlutterDriver driver = await FlutterDriver .connect ();
You can’t perform that action at this time.
0 commit comments