mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
tests: more cloud test (#4204)
* test: add anon user test * chore: add to runner * test: fix * test: fix * test: add tests * chore: add test * chore: fix warn * chore: fix warn * fix: build * fix: test * chore: rename * chore: fix test * chore: fix test * chore: fix test * chore: disable test
This commit is contained in:
@ -131,7 +131,7 @@ void _resolveUserDeps(GetIt getIt, IntegrationMode mode) {
|
||||
case AuthenticatorType.local:
|
||||
getIt.registerFactory<AuthService>(
|
||||
() => BackendAuthService(
|
||||
AuthTypePB.Local,
|
||||
AuthenticatorPB.Local,
|
||||
),
|
||||
);
|
||||
break;
|
||||
|
@ -3,7 +3,7 @@ import 'package:appflowy/startup/startup.dart';
|
||||
import 'package:appflowy/user/presentation/screens/splash_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FlowyApp implements EntryPoint {
|
||||
class AppFlowyApplication implements EntryPoint {
|
||||
@override
|
||||
Widget create(LaunchConfiguration config) {
|
||||
return SplashScreen(
|
||||
|
@ -29,14 +29,30 @@ class FlowyRunnerContext {
|
||||
FlowyRunnerContext({required this.applicationDataDirectory});
|
||||
}
|
||||
|
||||
Future<void> runAppFlowy() async {
|
||||
await FlowyRunner.run(
|
||||
FlowyApp(),
|
||||
integrationMode(),
|
||||
);
|
||||
Future<void> runAppFlowy({bool isAnon = false}) async {
|
||||
if (kReleaseMode) {
|
||||
await FlowyRunner.run(
|
||||
AppFlowyApplication(),
|
||||
integrationMode(),
|
||||
isAnon: isAnon,
|
||||
);
|
||||
} else {
|
||||
// When running the app in integration test mode, we need to
|
||||
// specify the mode to run the app again.
|
||||
await FlowyRunner.run(
|
||||
AppFlowyApplication(),
|
||||
FlowyRunner.currentMode,
|
||||
didInitGetItCallback: IntegrationTestHelper.didInitGetItCallback,
|
||||
rustEnvsBuilder: IntegrationTestHelper.rustEnvsBuilder,
|
||||
isAnon: isAnon,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FlowyRunner {
|
||||
// This variable specifies the initial mode of the app when it is launched for the first time.
|
||||
// The same mode will be automatically applied in subsequent executions when the runAppFlowy()
|
||||
// method is called.
|
||||
static var currentMode = integrationMode();
|
||||
|
||||
static Future<FlowyRunnerContext> run(
|
||||
@ -55,6 +71,13 @@ class FlowyRunner {
|
||||
bool isAnon = false,
|
||||
}) async {
|
||||
currentMode = mode;
|
||||
|
||||
// Only set the mode when it's not release mode
|
||||
if (!kReleaseMode) {
|
||||
IntegrationTestHelper.didInitGetItCallback = didInitGetItCallback;
|
||||
IntegrationTestHelper.rustEnvsBuilder = rustEnvsBuilder;
|
||||
}
|
||||
|
||||
// Clear all the states in case of rebuilding.
|
||||
await getIt.reset();
|
||||
|
||||
@ -220,3 +243,9 @@ IntegrationMode integrationMode() {
|
||||
|
||||
return IntegrationMode.develop;
|
||||
}
|
||||
|
||||
/// Only used for integration test
|
||||
class IntegrationTestHelper {
|
||||
static Future Function()? didInitGetItCallback;
|
||||
static Map<String, String> Function()? rustEnvsBuilder;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class AppFlowyCloudDeepLink {
|
||||
(_) async {
|
||||
final deviceId = await getDeviceId();
|
||||
final payload = OauthSignInPB(
|
||||
authType: AuthTypePB.AFCloud,
|
||||
authType: AuthenticatorPB.AppFlowyCloud,
|
||||
map: {
|
||||
AuthServiceMapKeys.signInURL: uri.toString(),
|
||||
AuthServiceMapKeys.deviceId: deviceId,
|
||||
|
Reference in New Issue
Block a user