chore: fix anon test (#6375)

* chore: fix anon test

* chore: fix test
This commit is contained in:
Nathan.fooo 2024-09-21 16:04:18 +08:00 committed by GitHub
parent 7bef698f03
commit d3362bf96a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 16 deletions

View File

@ -38,7 +38,7 @@ void main() {
cloudType: AuthenticatorType.appflowyCloudSelfHost, cloudType: AuthenticatorType.appflowyCloudSelfHost,
); );
tester.expectToSeeText(LocaleKeys.signIn_loginStartWithAnonymous.tr()); await tester.tapContinousAnotherWay();
await tester.tapAnonymousSignInButton(); await tester.tapAnonymousSignInButton();
await tester.expectToSeeHomePageWithGetStartedPage(); await tester.expectToSeeHomePageWithGetStartedPage();
@ -75,18 +75,6 @@ void main() {
await tester.logout(); await tester.logout();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// tap the continue as anonymous button
await tester
.tapButton(find.text(LocaleKeys.signIn_loginStartWithAnonymous.tr()));
await tester.expectToSeeHomePage();
// New anon user name
await tester.openSettings();
await tester.openSettingsPage(SettingsPage.account);
final userNameInput =
tester.widget(find.byType(AccountUserProfile)) as AccountUserProfile;
expect(userNameInput.name, 'Me');
}); });
}); });
} }

View File

@ -57,6 +57,14 @@ extension CommonOperations on WidgetTester {
} }
} }
Future<void> tapContinousAnotherWay() async {
// local version
await tapButtonWithName(LocaleKeys.signIn_continueAnotherWay.tr());
if (Platform.isWindows) {
await pumpAndSettle(const Duration(milliseconds: 200));
}
}
/// Tap the + button on the home page. /// Tap the + button on the home page.
Future<void> tapAddViewButton({ Future<void> tapAddViewButton({
String name = gettingStarted, String name = gettingStarted,

View File

@ -12,6 +12,8 @@ class Log {
// ignore: unused_field // ignore: unused_field
late Logger _logger; late Logger _logger;
bool _enabled = false;
Log() { Log() {
_logger = Logger( _logger = Logger(
printer: PrettyPrinter( printer: PrettyPrinter(
@ -25,12 +27,14 @@ class Log {
); );
} }
static void enableFlutterLog() {
shared._enabled = true;
}
// Generic internal logging function to reduce code duplication // Generic internal logging function to reduce code duplication
static void _log(Level level, int rustLevel, dynamic msg, static void _log(Level level, int rustLevel, dynamic msg,
[dynamic error, StackTrace? stackTrace]) { [dynamic error, StackTrace? stackTrace]) {
final enableFlutterLog = false; if (shared._enabled) {
// ignore: dead_code
if (enableFlutterLog) {
switch (level) { switch (level) {
case Level.info: case Level.info:
shared._logger.i(msg, stackTrace: stackTrace); shared._logger.i(msg, stackTrace: stackTrace);