Skip to content

Commit

Permalink
chore: fix anon test (AppFlowy-IO#6375)
Browse files Browse the repository at this point in the history
* chore: fix anon test

* chore: fix test
  • Loading branch information
appflowy authored Sep 21, 2024
1 parent 7bef698 commit d3362bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void main() {
cloudType: AuthenticatorType.appflowyCloudSelfHost,
);

tester.expectToSeeText(LocaleKeys.signIn_loginStartWithAnonymous.tr());
await tester.tapContinousAnotherWay();
await tester.tapAnonymousSignInButton();
await tester.expectToSeeHomePageWithGetStartedPage();

Expand Down Expand Up @@ -75,18 +75,6 @@ void main() {

await tester.logout();
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');
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Future<void> tapAddViewButton({
String name = gettingStarted,
Expand Down
10 changes: 7 additions & 3 deletions frontend/appflowy_flutter/packages/appflowy_backend/lib/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Log {
// ignore: unused_field
late Logger _logger;

bool _enabled = false;

Log() {
_logger = Logger(
printer: PrettyPrinter(
Expand All @@ -25,12 +27,14 @@ class Log {
);
}

static void enableFlutterLog() {
shared._enabled = true;
}

// Generic internal logging function to reduce code duplication
static void _log(Level level, int rustLevel, dynamic msg,
[dynamic error, StackTrace? stackTrace]) {
final enableFlutterLog = false;
// ignore: dead_code
if (enableFlutterLog) {
if (shared._enabled) {
switch (level) {
case Level.info:
shared._logger.i(msg, stackTrace: stackTrace);
Expand Down

0 comments on commit d3362bf

Please sign in to comment.