chore: only run appflowy cloud if it's not exist (#5799)

* chore: only run appflowy cloud if it's not exist

* chore: update

* chore: log error

* chore: fix sign out test

* chore: update test
This commit is contained in:
Nathan.fooo 2024-07-25 07:59:03 +08:00 committed by GitHub
parent 01747f13e8
commit 1e54c2dc7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 71 additions and 54 deletions

View File

@ -248,10 +248,13 @@ jobs:
env: env:
BACKEND_VERSION: 0.3.24-amd64 BACKEND_VERSION: 0.3.24-amd64
run: | run: |
docker compose down -v --remove-orphans if [ "$(docker ps --filter name=appflowy-cloud -q)" == "" ]; then
docker compose pull docker compose pull
docker compose up -d docker compose up -d
sleep 10 sleep 10
else
echo "Docker container 'appflowy-cloud' is already running."
fi
- name: Checkout source code - name: Checkout source code
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@ -106,11 +106,14 @@ jobs:
- name: Run Docker-Compose - name: Run Docker-Compose
working-directory: AppFlowy-Cloud working-directory: AppFlowy-Cloud
env:
BACKEND_VERSION: 0.3.24-amd64
run: | run: |
docker pull appflowyinc/appflowy_cloud:latest if [ "$(docker ps --filter name=appflowy-cloud -q)" == "" ]; then
docker compose up -d docker compose pull
docker compose up -d
sleep 10
else
echo "Docker container 'appflowy-cloud' is already running."
fi
- name: Run rust-lib tests - name: Run rust-lib tests
working-directory: frontend/rust-lib working-directory: frontend/rust-lib

View File

@ -47,11 +47,11 @@ void main() {
); );
await tester.tapButton(find.byType(SignInOutButton)); await tester.tapButton(find.byType(SignInOutButton));
tester.expectToSeeText(LocaleKeys.button_confirm.tr()); tester.expectToSeeText(LocaleKeys.button_ok.tr());
await tester.tapButtonWithName(LocaleKeys.button_confirm.tr()); await tester.tapButtonWithName(LocaleKeys.button_ok.tr());
// Go to the sign in page again // Go to the sign in page again
await tester.pumpAndSettle(const Duration(seconds: 1)); await tester.pumpAndSettle(const Duration(seconds: 5));
tester.expectToSeeGoogleLoginButton(); tester.expectToSeeGoogleLoginButton();
}); });

View File

@ -50,26 +50,28 @@ void main() {
await tester.tapEscButton(); await tester.tapEscButton();
// wait 2 seconds for the sync to finish // wait 2 seconds for the sync to finish
await tester.pumpAndSettle(const Duration(seconds: 2)); await tester.pumpAndSettle(const Duration(seconds: 6));
});
testWidgets('get user icon and name from server', (tester) async {
await tester.initializeAppFlowy(
cloudType: AuthenticatorType.appflowyCloudSelfHost,
email: email,
);
await tester.tapGoogleLoginInButton();
await tester.expectToSeeHomePageWithGetStartedPage();
await tester.pumpAndSettle();
await tester.openSettings();
await tester.openSettingsPage(SettingsPage.account);
// Verify name
final profileSetting =
tester.widget(find.byType(UserProfileSetting)) as UserProfileSetting;
expect(profileSetting.name, name);
}); });
}); });
testWidgets('get user icon and name from server', (tester) async {
await tester.initializeAppFlowy(
cloudType: AuthenticatorType.appflowyCloudSelfHost,
email: email,
);
await tester.tapGoogleLoginInButton();
await tester.expectToSeeHomePageWithGetStartedPage();
await tester.pumpAndSettle();
await tester.openSettings();
await tester.openSettingsPage(SettingsPage.account);
// Verify name
final profileSetting =
tester.widget(find.byType(UserProfileSetting)) as UserProfileSetting;
expect(profileSetting.name, name);
});
} }

View File

@ -10,6 +10,7 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
import 'package:appflowy_result/appflowy_result.dart'; import 'package:appflowy_result/appflowy_result.dart';
import 'package:flowy_infra/uuid.dart'; import 'package:flowy_infra/uuid.dart';
import 'package:flutter/material.dart';
/// Only used for testing. /// Only used for testing.
class AppFlowyCloudMockAuthService implements AuthService { class AppFlowyCloudMockAuthService implements AuthService {
@ -64,12 +65,18 @@ class AppFlowyCloudMockAuthService implements AuthService {
); );
Log.info("UserEventOauthSignIn with payload: $payload"); Log.info("UserEventOauthSignIn with payload: $payload");
return UserEventOauthSignIn(payload).send().then((value) { return UserEventOauthSignIn(payload).send().then((value) {
value.fold((l) => null, (err) => Log.error(err)); value.fold(
(l) => null,
(err) {
debugPrint("Error: $err");
Log.error(err);
},
);
return value; return value;
}); });
}, },
(r) { (r) {
Log.error(r); debugPrint("Error: $r");
return FlowyResult.failure(r); return FlowyResult.failure(r);
}, },
); );

View File

@ -411,30 +411,32 @@ class _UserProfileSettingState extends State<UserProfileSetting> {
), ),
const HSpace(16), const HSpace(16),
if (!isEditing) ...[ if (!isEditing) ...[
Padding( Flexible(
padding: const EdgeInsets.only(top: 12), child: Padding(
child: Row( padding: const EdgeInsets.only(top: 12),
mainAxisSize: MainAxisSize.min, child: Row(
children: [ mainAxisSize: MainAxisSize.min,
Flexible( children: [
child: FlowyText.medium( Flexible(
widget.name, child: FlowyText.medium(
overflow: TextOverflow.ellipsis, widget.name,
), overflow: TextOverflow.ellipsis,
),
const HSpace(4),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => setState(() => isEditing = true),
child: const FlowyHover(
resetHoverOnRebuild: false,
child: Padding(
padding: EdgeInsets.all(4),
child: FlowySvg(FlowySvgs.edit_s),
), ),
), ),
), const HSpace(4),
], GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => setState(() => isEditing = true),
child: const FlowyHover(
resetHoverOnRebuild: false,
child: Padding(
padding: EdgeInsets.all(4),
child: FlowySvg(FlowySvgs.edit_s),
),
),
),
],
),
), ),
), ),
] else ...[ ] else ...[