mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
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:
@ -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(
|
||||
|
31
pubspec.lock
31
pubspec.lock
@ -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:
|
||||
|
@ -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
11
test_driver/git.dart
Normal 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
32
test_driver/git_test.dart
Normal 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);
|
||||
});
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user