Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 95476a5

Browse files
author
nturgut
committed
create an io version of the test to fix build-ipas+drive-examples's html error
1 parent 6d89b95 commit 95476a5

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This is a Flutter widget test can take a screenshot.
2+
//
3+
// NOTE: Screenshots are only supported on Web for now.
4+
//
5+
// To perform an interaction with a widget in your test, use the WidgetTester
6+
// utility that Flutter provides. For example, you can send tap and scroll
7+
// gestures. You can also use WidgetTester to find child widgets in the widget
8+
// tree, read text, and verify that the values of widget properties are correct.
9+
10+
import 'package:integration_test/integration_test.dart';
11+
12+
import 'example_integration_io_extended.dart'
13+
if (dart.library.html) 'example_integration_web_extended.dart' as tests;
14+
15+
void main() {
16+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
17+
tests.main();
18+
}

packages/integration_test/example/test_driver/example_integration_web_extended_test.dart renamed to packages/integration_test/example/test_driver/example_integration_extended_test.dart

File renamed without changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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: Add screenshot capability for mobile platforms.
26+
27+
// Verify that platform version is retrieved.
28+
expect(
29+
find.byWidgetPredicate(
30+
(Widget widget) =>
31+
widget is Text &&
32+
widget.data.startsWith('Platform: ${Platform.operatingSystem}'),
33+
),
34+
findsOneWidget,
35+
);
36+
});
37+
}

0 commit comments

Comments
 (0)