Add the first integration test using the flutter driver

We need to test the git operations on all the devices.
This commit is contained in:
Vishesh Handa
2019-02-05 14:35:36 +01:00
parent e948a23c55
commit cb020c00fe
5 changed files with 78 additions and 2 deletions

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:journal/apis/git.dart';
import 'package:journal/apis/git_migration.dart';
const basePath = "journal";
@ -32,7 +31,8 @@ buildGitButtons() {
RaisedButton(
child: Text("Git Clone"),
onPressed: () async {
gitClone("root@bcn.vhanda.in:git/test", basePath);
gitClone(
"git@github.com:GitJournal/GitJournal.github.io.git", basePath);
},
),
RaisedButton(

View File

@ -94,6 +94,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.7"
firebase_analytics:
dependency: "direct main"
description:
@ -113,6 +120,11 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
flutter_driver:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_launcher_icons:
dependency: "direct dev"
description:
@ -132,6 +144,11 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.9+1"
fuchsia_remote_debug_protocol:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
glob:
dependency: transitive
description:
@ -286,6 +303,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
plugin:
dependency: transitive
description:
@ -300,6 +324,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.9"
pub_semver:
dependency: transitive
description:

View File

@ -23,6 +23,8 @@ dev_dependencies:
test: ^1.5.1
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
flutter:
uses-material-design: true

11
test_driver/git.dart Normal file
View File

@ -0,0 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_driver/driver_extension.dart';
import 'package:journal/gitapp.dart';
//import 'package:journal/apis/git.dart';
void main() {
// This line enables the extension
enableFlutterDriverExtension();
runApp(GitApp());
}

32
test_driver/git_test.dart Normal file
View File

@ -0,0 +1,32 @@
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';
void main() {
group('Git Test', () {
// First, define the Finders. We can use these to locate Widgets from the
// test suite. Note: the Strings provided to the `byValueKey` method must
// be the same as the Strings we used for the Keys in step 1.
// final counterTextFinder = find.byValueKey('counter');
final buttonFinder = find.text('Git Clone');
FlutterDriver driver;
// Connect to the Flutter driver before running any tests
setUpAll(() async {
driver = await FlutterDriver.connect();
});
// Close the connection to the driver after the tests have completed
tearDownAll(() async {
if (driver != null) {
driver.close();
}
});
test('Anonymous GitClone works', () async {
print(buttonFinder.finderType);
print(buttonFinder.serialize());
await driver.tap(buttonFinder);
});
});
}