mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +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:flutter/material.dart';
|
||||||
import 'package:journal/apis/git.dart';
|
import 'package:journal/apis/git.dart';
|
||||||
|
|
||||||
import 'package:journal/apis/git_migration.dart';
|
import 'package:journal/apis/git_migration.dart';
|
||||||
|
|
||||||
const basePath = "journal";
|
const basePath = "journal";
|
||||||
@ -32,7 +31,8 @@ buildGitButtons() {
|
|||||||
RaisedButton(
|
RaisedButton(
|
||||||
child: Text("Git Clone"),
|
child: Text("Git Clone"),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
gitClone("root@bcn.vhanda.in:git/test", basePath);
|
gitClone(
|
||||||
|
"git@github.com:GitJournal/GitJournal.github.io.git", basePath);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
RaisedButton(
|
RaisedButton(
|
||||||
|
31
pubspec.lock
31
pubspec.lock
@ -94,6 +94,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.4"
|
version: "0.0.4"
|
||||||
|
file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.7"
|
||||||
firebase_analytics:
|
firebase_analytics:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -113,6 +120,11 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.2.0"
|
||||||
|
flutter_driver:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@ -132,6 +144,11 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.9+1"
|
version: "0.1.9+1"
|
||||||
|
fuchsia_remote_debug_protocol:
|
||||||
|
dependency: transitive
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -286,6 +303,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.1"
|
||||||
|
platform:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: platform
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.0"
|
||||||
plugin:
|
plugin:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -300,6 +324,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.4.0"
|
||||||
|
process:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: process
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.9"
|
||||||
pub_semver:
|
pub_semver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -23,6 +23,8 @@ dev_dependencies:
|
|||||||
test: ^1.5.1
|
test: ^1.5.1
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_driver:
|
||||||
|
sdk: flutter
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
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