我正在对我的登录页面进行集成测试。这是我得到的错误。我该如何解决这个错误。
C:\ Users \ user \ AndroidStudioProjects \ flutter_project> flutter驱动器--target = test_driver / app.dart找到多个已连接的设备:SM J210F•4200a590689b1400•android-arm•Android 6.0.1(API 23)适用于x86的Android SDK•模拟器-5554•android-x86•Android 8.1.0(API 27)(模拟器)使用设备SM J210F。 启动应用程序:test_driver / app.dart build \ app \ outputs \ apk \ app.apk ... 92.6s运行 Gradle任务“ assembleDebug” ... I / flutter(5922):天文台 正在听http://127.0.0.1:54862/GeAeXgP3k4M=/
E / FlutterFcmService(5922):致命:无法找到回调
I / flutter(7271):天文台在监听 http://127.0.0.1:48093/UgDcJGtlUI0=/
E / FlutterFcmService(7271):致命:无法找到回调
registerResGeneratingTask已弃用,请使用 registerGeneratedResFolders(FileCollection)
registerResGeneratingTask已弃用,请使用 registerGeneratedResFolders(FileCollection)
registerResGeneratingTask已弃用,请使用 registerGeneratedResFolders(FileCollection)正在运行Gradle任务 'assembleDebug'... 95.3s√内置 build \ app \ outputs \ apk \ debug \ app-debug.apk。正在安装 build \ app \ outputs \ apk \ app.apk ... 28.1s软件包 安装错误:失败[INSTALL_FAILED_INSUFFICIENT_STORAGE] 卸载旧版本...正在安装 build \ app \ outputs \ apk \ app.apk ... 93.1s I / flutter(8617):天文台正在监听 http://127.0.0.1:54916/WUrIswnOm3g=/ E / FlutterFcmService(8617): 致命:找不到回调/
D:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.4+2/lib/cloud_firestore.dart:8:8: 错误:找不到:'dart:ui'导入'dart:ui'显示hashList;
^ /D:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.12/lib/firebase_messaging.dart:7:8: 错误:找不到:'dart:ui'导入'dart:ui';
^ /D:/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: 错误:找不到:'dart:ui'作为ui显示Paint,Path,
导入'dart:ui' 画布;/D:/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: 错误:找不到:'dart:ui'导入'dart:ui'显示lerpDouble;
^ /D:/flutter/packages/flutter/lib/src/material/app.dart:5:8:错误:找不到:'dart:ui'将dart:ui作为ui导入;
- ^ /D:/flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: 错误:找不到:'dart:ui'导入'dart:ui'显示lerpDouble;
^ /D:/flutter/packages/flutter/lib/src/material/arc.dart:6:8:错误:找不到:'dart:ui'import'dart:ui'show lerpDouble;
^ /D:/flutter/packages/flutter/lib/src/material/bottom_app_bar_theme.dart:5:8: 错误:找不到:'dart:ui'导入'dart:ui'显示lerpDouble;
^ /D:/flutter/packages/flutter/lib/src/material/bottom_sheet_theme.dart:5:8: 错误:找不到:'dart:ui'导入'dart:ui'显示lerpDouble;
^ /D:/flutter/packages/flutter/lib/src/material/button_bar_theme.dart:5:8: 错误:找不到:'dart:ui'导入'dart:ui'显示lerpDouble; ^
- 停止应用程序实例。驱动程序测试失败:254
我的app_test.dart代码
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';`
void main() {
group("Flutter Auth Test", () {
final emailField = find.byValueKey("emailfield");
final passwordField = find.byValueKey("passwordfield");
final signbutton = find.byValueKey("log");
final adminPage = find.byValueKey("home");
final userPage = find.byValueKey("userp");
FlutterDriver driver;
setUpAll(()async{
driver = await FlutterDriver.connect();
});
tearDownAll(()async{
if(driver != null) {
driver.close();
}
});
test("login with incorrect email and password",() async{
await driver.tap(emailField);
await driver.enterText("test@gmail.com");
await driver.tap(passwordField);
await driver.enterText("test123");
await driver.tap(signbutton);
await driver.waitUntilNoTransientCallbacks();
assert(adminPage == null && userPage == null);
});
test("login admin with correct email and password",() async {
await driver.tap(emailField);
await driver.enterText("madhuwanthiaah@gmail.com");
await driver.tap(passwordField);
await driver.enterText("admin123");
await driver.tap(signbutton);
assert(adminPage != null && userPage == null);
});
test("login user with correct email and password",() async {
await driver.tap(emailField);
await driver.enterText("cst16029@gmail.com");
await driver.tap(passwordField);
await driver.enterText("user123");
await driver.tap(signbutton);
assert(userPage != null && adminPage == null);
});
});
}
答案 0 :(得分:0)
我解决了更新软件包并运行的问题,
flutter drive --target=test_driver/app.dart
命令。
这个对我有用。我使用android模拟器进行了测试。