mirror of
https://github.com/foss42/apidash.git
synced 2025-05-28 12:18:06 +08:00
Update integration test
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import 'package:apidash/models/settings_model.dart';
|
||||
import 'package:apidash/providers/providers.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
@ -34,17 +36,24 @@ class ApidashTestHelper {
|
||||
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
|
||||
await app.initApp();
|
||||
await app.initApp(false);
|
||||
await app.initWindow(sz: size);
|
||||
|
||||
return binding;
|
||||
}
|
||||
|
||||
static Future<void> loadApp(WidgetTester tester) async {
|
||||
await app.initApp();
|
||||
await app.initApp(false);
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: DashApp(),
|
||||
ProviderScope(
|
||||
overrides: [
|
||||
settingsProvider.overrideWith(
|
||||
(ref) => ThemeStateNotifier(
|
||||
settingsModel: const SettingsModel()
|
||||
.copyWithPath(workspaceFolderPath: "test")),
|
||||
)
|
||||
],
|
||||
child: const DashApp(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -11,7 +11,10 @@ import 'app.dart';
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
var settingsModel = await getSettingsFromSharedPrefs();
|
||||
final initStatus = await initApp(settingsModel: settingsModel);
|
||||
final initStatus = await initApp(
|
||||
kIsDesktop,
|
||||
settingsModel: settingsModel,
|
||||
);
|
||||
if (kIsDesktop) {
|
||||
await initWindow(settingsModel: settingsModel);
|
||||
}
|
||||
@ -31,11 +34,14 @@ void main() async {
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> initApp({SettingsModel? settingsModel}) async {
|
||||
Future<bool> initApp(
|
||||
bool initializeUsingPath, {
|
||||
SettingsModel? settingsModel,
|
||||
}) async {
|
||||
GoogleFonts.config.allowRuntimeFetching = false;
|
||||
try {
|
||||
final openBoxesStatus = await openBoxes(
|
||||
kIsDesktop,
|
||||
initializeUsingPath,
|
||||
settingsModel?.workspaceFolderPath,
|
||||
);
|
||||
debugPrint("openBoxesStatus: $openBoxesStatus");
|
||||
|
@ -11,11 +11,11 @@ const String kHistoryBoxIds = "historyIds";
|
||||
const String kHistoryLazyBox = "apidash-history-lazy";
|
||||
|
||||
Future<bool> openBoxes(
|
||||
bool isDesktop,
|
||||
bool initializeUsingPath,
|
||||
String? workspaceFolderPath,
|
||||
) async {
|
||||
try {
|
||||
if (isDesktop) {
|
||||
if (initializeUsingPath) {
|
||||
if (workspaceFolderPath != null) {
|
||||
Hive.init(workspaceFolderPath);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user