chore(project): move structure changes and remove FlutterDriverUtils as this functionality is now in the app driver adapters

This commit is contained in:
Jon Samwell 2021-01-07 14:39:20 +11:00
parent 07f16dc962
commit e4af918cf9
8 changed files with 8 additions and 116 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\integration_test-1.0.1\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\integration_test-1.0.1\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2021-01-07 14:28:20.721377","version":"1.22.5"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\integration_test-1.0.1\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\integration_test-1.0.1\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2021-01-07 14:33:49.048225","version":"1.22.5"}

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,10 @@
library flutter_gherkin;
// Flutter specific implementations
export 'src/flutter/build_mode.dart';
export 'src/flutter/configuration/build_mode.dart';
export 'src/flutter/world/flutter_world.dart';
export 'src/flutter/configuration/flutter_test_configuration.dart';
export 'src/flutter/configuration/flutter_driver_test_configuration.dart';
export 'src/flutter/utils/driver_utils.dart';
export 'src/flutter/adapters/app_driver_adapter.dart';
export 'src/flutter/adapters/flutter_driver_app_driver_adapter.dart';

View File

@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:flutter_gherkin/src/flutter/build_mode.dart';
import 'package:flutter_gherkin/src/flutter/configuration/build_mode.dart';
import 'package:flutter_gherkin/src/flutter/world/flutter_driver_world.dart';
import 'package:flutter_gherkin/src/flutter/world/flutter_world.dart';
import 'package:flutter_gherkin/src/flutter/hooks/app_runner_hook.dart';

View File

@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter_gherkin/src/flutter/build_mode.dart';
import 'package:flutter_gherkin/src/flutter/configuration/build_mode.dart';
import 'package:gherkin/gherkin.dart';
class FlutterRunProcessHandler extends ProcessHandler {

View File

@ -1,109 +0,0 @@
import 'dart:async';
import 'package:flutter_driver/flutter_driver.dart';
class FlutterDriverUtils {
static Future<bool> isPresent(
FlutterDriver driver,
SerializableFinder finder, {
Duration timeout = const Duration(seconds: 1),
}) async {
try {
await driver.waitFor(finder, timeout: timeout);
return true;
} catch (_) {
return false;
}
}
static Future<bool> isAbsent(
FlutterDriver driver,
SerializableFinder finder, {
Duration timeout = const Duration(seconds: 30),
}) async {
try {
await driver.waitForAbsent(finder, timeout: timeout);
return true;
} catch (_) {
return false;
}
}
static Future<bool> waitForFlutter(
FlutterDriver driver, {
Duration timeout = const Duration(seconds: 30),
}) async {
try {
await driver.waitUntilNoTransientCallbacks(timeout: timeout);
return true;
} catch (_) {
return false;
}
}
static Future<void> enterText(
FlutterDriver driver,
SerializableFinder finder,
String text, {
Duration timeout = const Duration(seconds: 30),
}) async {
await FlutterDriverUtils.tap(driver, finder, timeout: timeout);
await driver.enterText(text, timeout: timeout);
}
static Future<String> getText(
FlutterDriver driver,
SerializableFinder finder, {
Duration timeout = const Duration(seconds: 30),
}) async {
await FlutterDriverUtils.waitForFlutter(driver, timeout: timeout);
final text = await driver.getText(finder, timeout: timeout);
return text;
}
static Future<void> tap(
FlutterDriver driver,
SerializableFinder finder, {
Duration timeout = const Duration(seconds: 30),
}) async {
await driver.tap(finder, timeout: timeout);
await FlutterDriverUtils.waitForFlutter(driver, timeout: timeout);
}
static Future<void> longPress(
FlutterDriver driver,
SerializableFinder finder, {
Duration pressDuration = const Duration(milliseconds: 500),
Duration timeout = const Duration(seconds: 30),
}) async {
await driver.scroll(finder, 0, 0, pressDuration, timeout: timeout);
await FlutterDriverUtils.waitForFlutter(driver, timeout: timeout);
}
/// Waits until the [condition] returns true
/// Will raise a complete with a [TimeoutException] if the
/// condition does not return true with the timeout period.
static Future<void> waitUntil(
FlutterDriver driver,
Future<bool> Function() condition, {
Duration timeout = const Duration(seconds: 10),
Duration pollInterval = const Duration(milliseconds: 500),
}) async {
return Future.microtask(() async {
final completer = Completer<void>();
var maxAttempts =
(timeout.inMilliseconds / pollInterval.inMilliseconds).round();
var attempts = 0;
while (attempts < maxAttempts) {
final result = await condition();
if (result) {
completer.complete();
break;
} else {
await Future.delayed(pollInterval);
}
}
}).timeout(timeout);
}
}

View File

@ -14,5 +14,7 @@ abstract class FlutterWorld extends World {
Future<bool> restartApp({
Duration timeout = const Duration(seconds: 60),
});
}) {
throw UnimplementedError('Unable to restart the app during the test');
}
}