mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-18 09:22:47 +08:00
Add a trivial integration test which just takes a screenshot
This required refactoring the code. With this we can now write an integration test to test the main parts of the app, but more importantly we can automate the process of generating the screenshots.
This commit is contained in:
@ -2,11 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_crashlytics/flutter_crashlytics.dart';
|
||||
import 'package:journal/apis/git.dart';
|
||||
import 'package:journal/app.dart';
|
||||
import 'package:journal/settings.dart';
|
||||
import 'package:journal/state_container.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
void main() async {
|
||||
FlutterError.onError = (FlutterErrorDetails details) {
|
||||
@ -22,55 +18,9 @@ void main() async {
|
||||
}
|
||||
|
||||
runZoned<Future<void>>(() async {
|
||||
await runJournalApp();
|
||||
await JournalApp.main();
|
||||
}, onError: (Object error, StackTrace stackTrace) async {
|
||||
await FlutterCrashlytics()
|
||||
.reportCrash(error, stackTrace, forceCrash: false);
|
||||
});
|
||||
}
|
||||
|
||||
Future runJournalApp() async {
|
||||
var pref = await SharedPreferences.getInstance();
|
||||
JournalApp.preferences = pref;
|
||||
|
||||
var localGitRepoConfigured = pref.getBool("localGitRepoConfigured") ?? false;
|
||||
var remoteGitRepoConfigured =
|
||||
pref.getBool("remoteGitRepoConfigured") ?? false;
|
||||
var localGitRepoPath = pref.getString("localGitRepoPath") ?? "";
|
||||
var remoteGitRepoFolderName = pref.getString("remoteGitRepoPath") ?? "";
|
||||
var remoteGitRepoSubFolder = pref.getString("remoteGitRepoSubFolder") ?? "";
|
||||
var onBoardingCompleted =
|
||||
true; //pref.getBool("onBoardingCompleted") ?? false;
|
||||
|
||||
if (JournalApp.isInDebugMode) {
|
||||
if (JournalApp.analytics.android != null) {
|
||||
JournalApp.analytics.android.setAnalyticsCollectionEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (localGitRepoConfigured == false) {
|
||||
// FIXME: What about exceptions!
|
||||
localGitRepoPath = "journal_local";
|
||||
await gitInit(localGitRepoPath);
|
||||
|
||||
localGitRepoConfigured = true;
|
||||
|
||||
await pref.setBool("localGitRepoConfigured", localGitRepoConfigured);
|
||||
await pref.setString("localGitRepoPath", localGitRepoPath);
|
||||
}
|
||||
|
||||
var dir = await getGitBaseDirectory();
|
||||
|
||||
await Settings.instance.load();
|
||||
|
||||
runApp(StateContainer(
|
||||
localGitRepoConfigured: localGitRepoConfigured,
|
||||
remoteGitRepoConfigured: remoteGitRepoConfigured,
|
||||
localGitRepoPath: localGitRepoPath,
|
||||
remoteGitRepoFolderName: remoteGitRepoFolderName,
|
||||
remoteGitRepoSubFolder: remoteGitRepoSubFolder,
|
||||
gitBaseDirectory: dir.path,
|
||||
onBoardingCompleted: onBoardingCompleted,
|
||||
child: JournalApp(),
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user