Skip to content

Commit 3d5bfc3

Browse files
refactor(all): move e2e tests to example/test_driver and update docs (#39)
* refactor(all): move e2e tests to example/test_driver and update docs * fixes * add missing file
1 parent 530e2c4 commit 3d5bfc3

11 files changed

Lines changed: 25 additions & 47 deletions

File tree

CONTRIBUTING.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ To run an example, run the `flutter run` command from the `example` directory of
5656
directory. For example, for `sensors_plus` example:
5757

5858
```bash
59-
cd packages/sensors_plus/sensors_plus/example
59+
cd packages/sensors_plus/example
6060
flutter run
6161
```
6262

@@ -75,25 +75,27 @@ interact with 3rd party services, and mock where possible. To run unit tests for
7575
with the following commands:
7676

7777
```bash
78-
cd packages/sensors_plus/sensors_plus_platform_interface
78+
cd packages/sensors_plus
7979
flutter test
8080
```
8181

8282
### End-to-end (e2e) tests
8383

84-
E2e tests are those which directly communicate with Flutter, whose results cannot be mocked. These tests run directly from
85-
an example application. To run e2e tests, run the `flutter drive` command from the plugins main `example` directory, targeting the
84+
E2e tests are those which directly communicate with Flutter, whose results cannot be mocked. **These tests run directly from
85+
an example application.**
86+
87+
To run e2e tests, run the `flutter drive` command from the plugins main `example` directory, targeting the
8688
entry e2e test file.
8789

8890
```bash
89-
cd packages/sensors_plus/sensors_plus/example
91+
cd packages/sensors_plus/example
9092
flutter drive --target=./test_driver/sensors_plus_e2e.dart
9193
```
9294

9395
To run tests against web environments, run the command as a release build:
9496

9597
```bash
96-
cd packages/sensors_plus/sensors_plus/example
98+
cd packages/sensors_plus/example
9799
flutter drive --target=./test_driver/sensors_plus_e2e.dart --release -d chrome
98100
```
99101

File renamed without changes.

packages/connectivity_plus/example/test_driver/test/connectivity_e2e_test.dart renamed to packages/battery_plus/example/test_driver/battery_e2e_test.dart

File renamed without changes.

packages/battery_plus/test/battery_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void main() {
4343
tearDown(() {
4444
controller.close();
4545
});
46+
4647
test('receive values', () async {
4748
final StreamQueue<BatteryState> queue =
4849
StreamQueue<BatteryState>(battery.onBatteryStateChanged);

packages/connectivity_plus/example/test_driver/test/connectivity_e2e.dart renamed to packages/connectivity_plus/example/test_driver/connectivity_e2e.dart

File renamed without changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2019 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:convert';
6+
import 'dart:io';
7+
import 'package:flutter_driver/flutter_driver.dart';
8+
9+
Future<void> main() async {
10+
final FlutterDriver driver = await FlutterDriver.connect();
11+
final String data =
12+
await driver.requestData(null, timeout: const Duration(minutes: 1));
13+
await driver.close();
14+
final Map<String, dynamic> result = jsonDecode(data);
15+
exit(result['result'] == 'true' ? 0 : 1);
16+
}

packages/connectivity_plus/test/connectivity_e2e.dart

Lines changed: 0 additions & 41 deletions
This file was deleted.
File renamed without changes.

packages/sensors_plus/example/test_driver/test/sensors_e2e_test.dart renamed to packages/sensors_plus/example/test_driver/sensors_e2e_test.dart

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)