Skip to content

Commit

Permalink
feat: add integration test on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Jan 30, 2024
1 parent e9d7d0b commit 519d4f8
Show file tree
Hide file tree
Showing 71 changed files with 219 additions and 156 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/mobile_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ jobs:
build:
if: github.event.pull_request.draft != true
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ubuntu-latest]
include:
- os: ubuntu-latest
target: aarch64-linux-android
os: [macos-latest]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -55,7 +52,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
target: ${{ matrix.target }}
target: aarch64-linux-android
override: true
profile: minimal

Expand All @@ -75,7 +72,7 @@ jobs:

- uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.6.3
gradle-version: 7.4.2

- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -115,3 +112,13 @@ jobs:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
cargo make --profile development-android appflowy-android-dev-ci
- name: Run integration tests
# https://github.com/ReactiveCircus/android-emulator-runner
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: arm64-v8a
profile: Pixel 6
working-directory: frontend/appflowy_flutter
script: flutter test integration_test/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'util/util.dart';
import '../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/util.dart';
import '../../util/util.dart';

const defaultFirstCardName = 'Card 1';
const defaultLastCardName = 'Card 3';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:appflowy_board/appflowy_board.dart';

import '../util/util.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/util.dart';
import '../util/database_test_op.dart';
import '../../util/util.dart';
import '../../util/database_test_op.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:appflowy_board/appflowy_board.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'util/util.dart';

import '../util/util.dart';

/// Integration tests for an empty board. The [TestWorkspaceService] will load
/// a workspace from an empty board `assets/test/workspaces/board.zip` for all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import 'package:flowy_infra/uuid.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path/path.dart' as p;
import 'package:integration_test/integration_test.dart';
import '../util/dir.dart';
import '../util/mock/mock_file_picker.dart';
import '../util/util.dart';
import '../../util/dir.dart';
import '../../util/mock/mock_file_picker.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import 'package:appflowy/workspace/presentation/settings/widgets/settings_user_v
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/uuid.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path/path.dart' as p;
import 'package:integration_test/integration_test.dart';
import '../util/mock/mock_file_picker.dart';
import '../util/util.dart';
import 'package:path/path.dart' as p;

import '../../util/mock/mock_file_picker.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -47,13 +48,13 @@ void main() {
tester.expectToSeeGoogleLoginButton();
});

testWidgets('sign in as annoymous', (tester) async {
testWidgets('sign in as anonymous', (tester) async {
await tester.initializeAppFlowy(
cloudType: AuthenticatorType.appflowyCloudSelfHost,
);
await tester.tapSignInAsGuest();

// should not see the sync setting page when sign in as annoymous
// should not see the sync setting page when sign in as anonymous
await tester.openSettings();
await tester.openSettingsPage(SettingsPage.user);
tester.expectToSeeGoogleLoginButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import 'package:flowy_infra/uuid.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path/path.dart' as p;
import 'package:integration_test/integration_test.dart';
import '../util/dir.dart';
import '../util/mock/mock_file_picker.dart';
import '../util/util.dart';
import '../../util/dir.dart';
import '../../util/mock/mock_file_picker.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:appflowy/env/cloud_env.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/util.dart';
import '../../util/util.dart';

// This test is meaningless, just for preventing the CI from failing.
void main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import 'package:appflowy/workspace/presentation/settings/widgets/settings_user_v
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import '../util/util.dart';

import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -35,11 +36,11 @@ void main() {
tester.expectToSeeGoogleLoginButton();
});

testWidgets('sign in as annoymous', (tester) async {
testWidgets('sign in as anonymous', (tester) async {
await tester.initializeAppFlowy(cloudType: AuthenticatorType.supabase);
await tester.tapSignInAsGuest();

// should not see the sync setting page when sign in as annoymous
// should not see the sync setting page when sign in as anonymous
await tester.openSettings();
await tester.openSettingsPage(SettingsPage.user);
tester.expectToSeeGoogleLoginButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path/path.dart' as p;
import 'package:integration_test/integration_test.dart';
import '../util/database_test_op.dart';
import '../util/dir.dart';
import '../util/emoji.dart';
import '../util/mock/mock_file_picker.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/dir.dart';
import '../../util/emoji.dart';
import '../../util/mock/mock_file_picker.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:intl/intl.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:intl/intl.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../../util/database_test_op.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../util/emoji.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/emoji.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../../util/database_test_op.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../../util/database_test_op.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/database_test_op.dart';
import '../util/util.dart';
import '../../util/database_test_op.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/keyboard.dart';
import '../util/util.dart';
import '../../util/keyboard.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/util.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/util.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/util.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import 'package:flutter/services.dart';

import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart';
import 'package:appflowy/plugins/inline_actions/widgets/inline_actions_handler.dart';
import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart';
import 'package:flowy_infra/uuid.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import '../util/keyboard.dart';
import '../util/util.dart';
import '../../util/keyboard.dart';
import '../../util/util.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Loading

0 comments on commit 519d4f8

Please sign in to comment.