From 780f08dd288642d30b85a5f353c9f54c1c91f5fc Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Thu, 7 Mar 2024 12:48:51 +0800 Subject: [PATCH] test: execute the integration tests concurrently (#4831) --- .github/actions/flutter_build/action.yml | 104 ++++++ .../flutter_integration_test/action.yml | 78 +++++ .github/workflows/flutter_ci.yaml | 317 ++++++------------ .../integration_test/desktop_runner.dart | 68 ---- .../integration_test/desktop_runner_1.dart | 21 ++ .../integration_test/desktop_runner_2.dart | 40 +++ .../integration_test/desktop_runner_3.dart | 36 ++ .../integration_test/mobile_runner.dart | 3 + .../integration_test/runner.dart | 11 +- 9 files changed, 392 insertions(+), 286 deletions(-) create mode 100644 .github/actions/flutter_build/action.yml create mode 100644 .github/actions/flutter_integration_test/action.yml delete mode 100644 frontend/appflowy_flutter/integration_test/desktop_runner.dart create mode 100644 frontend/appflowy_flutter/integration_test/desktop_runner_1.dart create mode 100644 frontend/appflowy_flutter/integration_test/desktop_runner_2.dart create mode 100644 frontend/appflowy_flutter/integration_test/desktop_runner_3.dart diff --git a/.github/actions/flutter_build/action.yml b/.github/actions/flutter_build/action.yml new file mode 100644 index 0000000000..cb7b325e82 --- /dev/null +++ b/.github/actions/flutter_build/action.yml @@ -0,0 +1,104 @@ +name: Flutter Integration Test +description: Run integration tests for AppFlowy + +inputs: + os: + description: "The operating system to run the tests on" + required: true + flutter_version: + description: "The version of Flutter to use" + required: true + rust_toolchain: + description: "The version of Rust to use" + required: true + cargo_make_version: + description: "The version of cargo-make to use" + required: true + rust_target: + description: "The target to build for" + required: true + flutter_profile: + description: "The profile to build with" + required: true + +runs: + using: "composite" + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + id: rust_toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ inputs.rust_toolchain }} + target: ${{ inputs.rust_target }} + override: true + profile: minimal + + - name: Export pub environment variables and add to PATH + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + echo "PUB_CACHE=$LOCALAPPDATA\\Pub\\Cache" >> $GITHUB_ENV + fi + shell: bash + + - name: Install flutter + id: flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ inputs.flutter_version }} + cache: true + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ inputs.os }} + workspaces: | + frontend/rust-lib + cache-all-crates: true + + - uses: taiki-e/install-action@v2 + with: + tool: cargo-make@${{ inputs.cargo_make_version }}, duckscript_cli + + - name: Install prerequisites + working-directory: frontend + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub + sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list + sudo apt-get update + sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev + elif [ "$RUNNER_OS" == "Windows" ]; then + vcpkg integrate install + elif [ "$RUNNER_OS" == "macOS" ]; then + echo 'do nothing' + fi + cargo make appflowy-flutter-deps-tools + shell: bash + + - name: Build AppFlowy + working-directory: frontend + run: cargo make --profile ${{ inputs.flutter_profile }} appflowy-core-dev + shell: bash + + - name: Run code generation + working-directory: frontend + run: cargo make code_generation + shell: bash + + - name: Flutter Analyzer + working-directory: frontend/appflowy_flutter + run: flutter analyze . + shell: bash + + - name: Compress appflowy_flutter + run: tar -czf appflowy_flutter.tar.gz frontend/appflowy_flutter + shell: bash + + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.run_id }}-${{ matrix.os }} + path: appflowy_flutter.tar.gz \ No newline at end of file diff --git a/.github/actions/flutter_integration_test/action.yml b/.github/actions/flutter_integration_test/action.yml new file mode 100644 index 0000000000..6df3ec005d --- /dev/null +++ b/.github/actions/flutter_integration_test/action.yml @@ -0,0 +1,78 @@ +name: Flutter Integration Test +description: Run integration tests for AppFlowy + +inputs: + test_path: + description: "The path to the integration test file" + required: true + flutter_version: + description: "The version of Flutter to use" + required: true + rust_toolchain: + description: "The version of Rust to use" + required: true + cargo_make_version: + description: "The version of cargo-make to use" + required: true + rust_target: + description: "The target to build for" + required: true + +runs: + using: "composite" + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + id: rust_toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ inputs.RUST_TOOLCHAIN }} + target: ${{ inputs.rust_target }} + override: true + profile: minimal + + - name: Install flutter + id: flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ inputs.flutter_version }} + cache: true + + - uses: taiki-e/install-action@v2 + with: + tool: cargo-make@${{ inputs.cargo_make_version }} + + - name: Install prerequisites + working-directory: frontend + run: | + sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub + sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list + sudo apt-get update + sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev network-manager + shell: bash + + - name: Enable Flutter Desktop + run: | + flutter config --enable-linux-desktop + shell: bash + + - uses: actions/download-artifact@v4 + with: + name: ${{ github.run_id }}-ubuntu-latest + + - name: Uncompressed appflowy_flutter + run: tar -xf appflowy_flutter.tar.gz + shell: bash + + - name: Run Flutter integration tests + working-directory: frontend/appflowy_flutter + run: | + export DISPLAY=:99 + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + sudo apt-get install network-manager + flutter test ${{ inputs.test_path }} -d Linux --coverage + shell: bash \ No newline at end of file diff --git a/.github/workflows/flutter_ci.yaml b/.github/workflows/flutter_ci.yaml index d3ddc17be8..a5cb5f8f96 100644 --- a/.github/workflows/flutter_ci.yaml +++ b/.github/workflows/flutter_ci.yaml @@ -32,28 +32,21 @@ concurrency: cancel-in-progress: true jobs: - prepare: + prepare-linux: if: github.event.pull_request.draft != true strategy: - fail-fast: false + fail-fast: true matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest] include: - os: ubuntu-latest flutter_profile: development-linux-x86_64 target: x86_64-unknown-linux-gnu - - os: macos-latest - flutter_profile: development-mac-x86_64 - target: x86_64-apple-darwin - - os: windows-latest - flutter_profile: development-windows-x86 - target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} steps: # the following step is required to avoid running out of space - name: Maximize build space - if: matrix.os == 'ubuntu-latest' run: | sudo rm -rf /usr/share/dotnet sudo rm -rf /opt/ghc @@ -63,80 +56,70 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 - - name: Install Rust toolchain - id: rust_toolchain - uses: actions-rs/toolchain@v1 + - name: Flutter build + uses: ./.github/actions/flutter_build with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - target: ${{ matrix.target }} - override: true - profile: minimal + os: ${{ matrix.os }} + flutter_version: ${{ env.FLUTTER_VERSION }} + rust_toolchain: ${{ env.RUST_TOOLCHAIN }} + cargo_make_version: ${{ env.CARGO_MAKE_VERSION }} + rust_target: ${{ matrix.target }} + flutter_profile: ${{ matrix.flutter_profile }} - - name: Export pub environment variables and add to PATH - run: | - if [ "$RUNNER_OS" == "Windows" ]; then - echo "PUB_CACHE=$LOCALAPPDATA\\Pub\\Cache" >> $GITHUB_ENV - fi - shell: bash + prepare-windows: + if: github.event.pull_request.draft != true + strategy: + fail-fast: true + matrix: + os: [windows-latest] + include: + - os: windows-latest + flutter_profile: development-windows-x86 + target: x86_64-pc-windows-msvc + runs-on: ${{ matrix.os }} - - name: Install flutter - id: flutter - uses: subosito/flutter-action@v2 + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Flutter build + uses: ./.github/actions/flutter_build with: - channel: "stable" - flutter-version: ${{ env.FLUTTER_VERSION }} - cache: true + os: ${{ matrix.os }} + flutter_version: ${{ env.FLUTTER_VERSION }} + rust_toolchain: ${{ env.RUST_TOOLCHAIN }} + cargo_make_version: ${{ env.CARGO_MAKE_VERSION }} + rust_target: ${{ matrix.target }} + flutter_profile: ${{ matrix.flutter_profile }} - - uses: Swatinem/rust-cache@v2 + prepare-macos: + if: github.event.pull_request.draft != true + strategy: + fail-fast: true + matrix: + os: [macos-latest] + include: + - os: macos-latest + flutter_profile: development-mac-x86_64 + target: x86_64-apple-darwin + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Flutter build + uses: ./.github/actions/flutter_build with: - prefix-key: ${{ matrix.os }} - workspaces: | - frontend/rust-lib - cache-all-crates: true - - - uses: taiki-e/install-action@v2 - with: - tool: cargo-make@${{ env.CARGO_MAKE_VERSION }}, duckscript_cli - - - name: Install prerequisites - working-directory: frontend - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub - sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list - sudo apt-get update - sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev - elif [ "$RUNNER_OS" == "Windows" ]; then - vcpkg integrate install - elif [ "$RUNNER_OS" == "macOS" ]; then - echo 'do nothing' - fi - cargo make appflowy-flutter-deps-tools - shell: bash - - - name: Build AppFlowy - working-directory: frontend - run: cargo make --profile ${{ matrix.flutter_profile }} appflowy-core-dev - - - name: Run code generation - working-directory: frontend - run: cargo make code_generation - - - name: Flutter Analyzer - working-directory: frontend/appflowy_flutter - run: flutter analyze . - - - name: Compress appflowy_flutter - run: | - tar -czf appflowy_flutter.tar.gz frontend/appflowy_flutter - - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.run_id }}-${{ matrix.os }} - path: appflowy_flutter.tar.gz + os: ${{ matrix.os }} + flutter_version: ${{ env.FLUTTER_VERSION }} + rust_toolchain: ${{ env.RUST_TOOLCHAIN }} + cargo_make_version: ${{ env.CARGO_MAKE_VERSION }} + rust_target: ${{ matrix.target }} + flutter_profile: ${{ matrix.flutter_profile }} unit_test: - needs: [prepare] + needs: [prepare-linux] if: github.event.pull_request.draft != true strategy: fail-fast: false @@ -227,7 +210,7 @@ jobs: shell: bash cloud_integration_test: - needs: [prepare] + needs: [prepare-linux] strategy: fail-fast: false matrix: @@ -314,8 +297,9 @@ jobs: flutter test integration_test/cloud/cloud_runner.dart -d Linux --coverage shell: bash - integration_test: - needs: [prepare] + # split the integration tests into different machines to minimize the time + integration_test_1: + needs: [prepare-linux] if: github.event.pull_request.draft != true strategy: fail-fast: false @@ -323,158 +307,65 @@ jobs: os: [ubuntu-latest] include: - os: ubuntu-latest - flutter_profile: development-linux-x86_64 - target: x86_64-unknown-linux-gnu + target: 'x86_64-unknown-linux-gnu' runs-on: ${{ matrix.os }} - steps: - name: Checkout source code uses: actions/checkout@v4 - - name: Install Rust toolchain - id: rust_toolchain - uses: actions-rs/toolchain@v1 + - name: Flutter Integration Test 1 + uses: ./.github/actions/flutter_integration_test with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - target: ${{ matrix.target }} - override: true - profile: minimal + test_path: integration_test/desktop_runner_1.dart + flutter_version: ${{ env.FLUTTER_VERSION }} + rust_toolchain: ${{ env.RUST_TOOLCHAIN }} + cargo_make_version: ${{ env.CARGO_MAKE_VERSION }} + rust_target: ${{ matrix.target }} - - name: Install flutter - id: flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - flutter-version: ${{ env.FLUTTER_VERSION }} - cache: true - - - uses: taiki-e/install-action@v2 - with: - tool: cargo-make@${{ env.CARGO_MAKE_VERSION }} - - - name: Install prerequisites - working-directory: frontend - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub - sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list - sudo apt-get update - sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev - fi - shell: bash - - - name: Enable Flutter Desktop - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - flutter config --enable-linux-desktop - elif [ "$RUNNER_OS" == "macOS" ]; then - flutter config --enable-macos-desktop - elif [ "$RUNNER_OS" == "Windows" ]; then - git config --system core.longpaths true - flutter config --enable-windows-desktop - fi - shell: bash - - - uses: actions/download-artifact@v4 - with: - name: ${{ github.run_id }}-${{ matrix.os }} - - - name: Uncompressed appflowy_flutter - run: tar -xf appflowy_flutter.tar.gz - - - name: Run flutter pub get - working-directory: frontend - run: cargo make pub_get - - - name: Run Flutter integration tests - working-directory: frontend/appflowy_flutter - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - export DISPLAY=:99 - sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & - sudo apt-get install network-manager - flutter test integration_test/runner.dart -d Linux --coverage - elif [ "$RUNNER_OS" == "macOS" ]; then - flutter test integration_test/runner.dart -d macOS --coverage - elif [ "$RUNNER_OS" == "Windows" ]; then - flutter test integration_test/runner.dart -d Windows --coverage - fi - shell: bash - build: - needs: [prepare] + integration_test_2: + needs: [prepare-linux] if: github.event.pull_request.draft != true strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest] include: - os: ubuntu-latest - flutter_profile: development-linux-x86_64 - target: x86_64-unknown-linux-gnu - - os: macos-latest - flutter_profile: development-mac-x86_64 - target: x86_64-apple-darwin - - os: windows-latest - flutter_profile: development-windows-x86 - target: x86_64-pc-windows-msvc + target: 'x86_64-unknown-linux-gnu' runs-on: ${{ matrix.os }} - steps: - name: Checkout source code uses: actions/checkout@v4 - - name: Install Rust toolchain - id: rust_toolchain - uses: actions-rs/toolchain@v1 + - name: Flutter Integration Test 2 + uses: ./.github/actions/flutter_integration_test with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - target: ${{ matrix.target }} - override: true - profile: minimal + test_path: integration_test/desktop_runner_2.dart + flutter_version: ${{ env.FLUTTER_VERSION }} + rust_toolchain: ${{ env.RUST_TOOLCHAIN }} + cargo_make_version: ${{ env.CARGO_MAKE_VERSION }} + rust_target: ${{ matrix.target }} - - name: Install flutter - id: flutter - uses: subosito/flutter-action@v2 + integration_test_3: + needs: [prepare-linux] + if: github.event.pull_request.draft != true + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + include: + - os: ubuntu-latest + target: 'x86_64-unknown-linux-gnu' + runs-on: ${{ matrix.os }} + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Flutter Integration Test 3 + uses: ./.github/actions/flutter_integration_test with: - channel: "stable" - flutter-version: ${{ env.FLUTTER_VERSION }} - cache: true - - - uses: taiki-e/install-action@v2 - with: - tool: cargo-make@${{ env.CARGO_MAKE_VERSION }} - - - name: Install prerequisites - working-directory: frontend - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub - sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list - sudo apt-get update - sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev - fi - shell: bash - - - name: Enable Flutter Desktop - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - flutter config --enable-linux-desktop - elif [ "$RUNNER_OS" == "macOS" ]; then - flutter config --enable-macos-desktop - elif [ "$RUNNER_OS" == "Windows" ]; then - git config --system core.longpaths true - flutter config --enable-windows-desktop - fi - shell: bash - - - uses: actions/download-artifact@v4 - with: - name: ${{ github.run_id }}-${{ matrix.os }} - - - name: Uncompressed appflowy_flutter - run: tar -xf appflowy_flutter.tar.gz - - - name: Build flutter product - working-directory: frontend - run: | - cargo make --profile ${{ matrix.flutter_profile }} appflowy-make-product-dev + test_path: integration_test/desktop_runner_3.dart + flutter_version: ${{ env.FLUTTER_VERSION }} + rust_toolchain: ${{ env.RUST_TOOLCHAIN }} + cargo_make_version: ${{ env.CARGO_MAKE_VERSION }} + rust_target: ${{ matrix.target }} \ No newline at end of file diff --git a/frontend/appflowy_flutter/integration_test/desktop_runner.dart b/frontend/appflowy_flutter/integration_test/desktop_runner.dart deleted file mode 100644 index 66532d947c..0000000000 --- a/frontend/appflowy_flutter/integration_test/desktop_runner.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'desktop/uncategorized/appearance_settings_test.dart' as appearance_test_runner; -import 'desktop/board/board_test_runner.dart' as board_test_runner; -import 'desktop/database/database_calendar_test.dart' as database_calendar_test; -import 'desktop/database/database_cell_test.dart' as database_cell_test; -import 'desktop/database/database_field_settings_test.dart' - as database_field_settings_test; -import 'desktop/database/database_field_test.dart' as database_field_test; -import 'desktop/database/database_filter_test.dart' as database_filter_test; -import 'desktop/database/database_row_page_test.dart' as database_row_page_test; -import 'desktop/database/database_row_test.dart' as database_row_test; -import 'desktop/database/database_setting_test.dart' as database_setting_test; -import 'desktop/database/database_share_test.dart' as database_share_test; -import 'desktop/database/database_sort_test.dart' as database_sort_test; -import 'desktop/database/database_view_test.dart' as database_view_test; -import 'desktop/document/document_test_runner.dart' as document_test_runner; -import 'desktop/uncategorized/emoji_shortcut_test.dart' as emoji_shortcut_test; -import 'desktop/uncategorized/empty_test.dart' as first_test; -import 'desktop/uncategorized/hotkeys_test.dart' as hotkeys_test; -import 'desktop/uncategorized/import_files_test.dart' as import_files_test; -import 'desktop/settings/settings_runner.dart' as settings_test_runner; -import 'desktop/uncategorized/share_markdown_test.dart' as share_markdown_test; -import 'desktop/sidebar/sidebar_test_runner.dart' as sidebar_test_runner; -import 'desktop/uncategorized/switch_folder_test.dart' as switch_folder_test; -import 'desktop/uncategorized/tabs_test.dart' as tabs_test; - -Future runIntegrationOnDesktop() async { - // This test must be run first, otherwise the CI will fail. - first_test.main(); - - switch_folder_test.main(); - share_markdown_test.main(); - import_files_test.main(); - - // Document integration tests - document_test_runner.startTesting(); - - // Sidebar integration tests - sidebar_test_runner.startTesting(); - - // Board integration test - board_test_runner.startTesting(); - - // Database integration tests - database_cell_test.main(); - database_field_test.main(); - database_field_settings_test.main(); - database_share_test.main(); - database_row_page_test.main(); - database_row_test.main(); - database_setting_test.main(); - database_filter_test.main(); - database_sort_test.main(); - database_view_test.main(); - database_calendar_test.main(); - - // Tabs - tabs_test.main(); - - // Others - hotkeys_test.main(); - emoji_shortcut_test.main(); - - // Appearance integration test - appearance_test_runner.main(); - - // User settings - settings_test_runner.main(); -} diff --git a/frontend/appflowy_flutter/integration_test/desktop_runner_1.dart b/frontend/appflowy_flutter/integration_test/desktop_runner_1.dart new file mode 100644 index 0000000000..e972f49fbb --- /dev/null +++ b/frontend/appflowy_flutter/integration_test/desktop_runner_1.dart @@ -0,0 +1,21 @@ +import 'package:integration_test/integration_test.dart'; + +import 'desktop/document/document_test_runner.dart' as document_test_runner; +import 'desktop/uncategorized/empty_test.dart' as first_test; +import 'desktop/uncategorized/switch_folder_test.dart' as switch_folder_test; + +Future main() async { + await runIntegration1OnDesktop(); +} + +Future runIntegration1OnDesktop() async { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + // This test must be run first, otherwise the CI will fail. + first_test.main(); + + switch_folder_test.main(); + document_test_runner.startTesting(); + + // DON'T add more tests here. This is the first test runner for desktop. +} diff --git a/frontend/appflowy_flutter/integration_test/desktop_runner_2.dart b/frontend/appflowy_flutter/integration_test/desktop_runner_2.dart new file mode 100644 index 0000000000..9053da8d18 --- /dev/null +++ b/frontend/appflowy_flutter/integration_test/desktop_runner_2.dart @@ -0,0 +1,40 @@ +import 'package:integration_test/integration_test.dart'; + +import 'desktop/database/database_calendar_test.dart' as database_calendar_test; +import 'desktop/database/database_cell_test.dart' as database_cell_test; +import 'desktop/database/database_field_settings_test.dart' + as database_field_settings_test; +import 'desktop/database/database_field_test.dart' as database_field_test; +import 'desktop/database/database_filter_test.dart' as database_filter_test; +import 'desktop/database/database_row_page_test.dart' as database_row_page_test; +import 'desktop/database/database_row_test.dart' as database_row_test; +import 'desktop/database/database_setting_test.dart' as database_setting_test; +import 'desktop/database/database_share_test.dart' as database_share_test; +import 'desktop/database/database_sort_test.dart' as database_sort_test; +import 'desktop/database/database_view_test.dart' as database_view_test; +import 'desktop/uncategorized/empty_test.dart' as first_test; + +Future main() async { + await runIntegration2OnDesktop(); +} + +Future runIntegration2OnDesktop() async { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + // This test must be run first, otherwise the CI will fail. + first_test.main(); + + database_cell_test.main(); + database_field_test.main(); + database_field_settings_test.main(); + database_share_test.main(); + database_row_page_test.main(); + database_row_test.main(); + database_setting_test.main(); + database_filter_test.main(); + database_sort_test.main(); + database_view_test.main(); + database_calendar_test.main(); + + // DON'T add more tests here. This is the second test runner for desktop. +} diff --git a/frontend/appflowy_flutter/integration_test/desktop_runner_3.dart b/frontend/appflowy_flutter/integration_test/desktop_runner_3.dart new file mode 100644 index 0000000000..09a784d4fc --- /dev/null +++ b/frontend/appflowy_flutter/integration_test/desktop_runner_3.dart @@ -0,0 +1,36 @@ +import 'package:integration_test/integration_test.dart'; + +import 'desktop/board/board_test_runner.dart' as board_test_runner; +import 'desktop/settings/settings_runner.dart' as settings_test_runner; +import 'desktop/sidebar/sidebar_test_runner.dart' as sidebar_test_runner; +import 'desktop/uncategorized/appearance_settings_test.dart' + as appearance_test_runner; +import 'desktop/uncategorized/emoji_shortcut_test.dart' as emoji_shortcut_test; +import 'desktop/uncategorized/empty_test.dart' as first_test; +import 'desktop/uncategorized/hotkeys_test.dart' as hotkeys_test; +import 'desktop/uncategorized/import_files_test.dart' as import_files_test; +import 'desktop/uncategorized/share_markdown_test.dart' as share_markdown_test; +import 'desktop/uncategorized/tabs_test.dart' as tabs_test; + +Future main() async { + await runIntegration3OnDesktop(); +} + +Future runIntegration3OnDesktop() async { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + // This test must be run first, otherwise the CI will fail. + first_test.main(); + + hotkeys_test.main(); + emoji_shortcut_test.main(); + hotkeys_test.main(); + emoji_shortcut_test.main(); + appearance_test_runner.main(); + settings_test_runner.main(); + share_markdown_test.main(); + import_files_test.main(); + sidebar_test_runner.startTesting(); + board_test_runner.startTesting(); + tabs_test.main(); +} diff --git a/frontend/appflowy_flutter/integration_test/mobile_runner.dart b/frontend/appflowy_flutter/integration_test/mobile_runner.dart index daab343060..ca1a7ae0d3 100644 --- a/frontend/appflowy_flutter/integration_test/mobile_runner.dart +++ b/frontend/appflowy_flutter/integration_test/mobile_runner.dart @@ -1,5 +1,8 @@ +import 'package:integration_test/integration_test.dart'; + import 'mobile/sign_in/anonymous_sign_in_test.dart' as anonymous_sign_in_test; Future runIntegrationOnMobile() async { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); anonymous_sign_in_test.main(); } diff --git a/frontend/appflowy_flutter/integration_test/runner.dart b/frontend/appflowy_flutter/integration_test/runner.dart index 39f0bf45e1..cb7d2d6e33 100644 --- a/frontend/appflowy_flutter/integration_test/runner.dart +++ b/frontend/appflowy_flutter/integration_test/runner.dart @@ -1,8 +1,8 @@ import 'dart:io'; -import 'package:integration_test/integration_test.dart'; - -import 'desktop_runner.dart'; +import 'desktop_runner_1.dart'; +import 'desktop_runner_2.dart'; +import 'desktop_runner_3.dart'; import 'mobile_runner.dart'; /// The main task runner for all integration tests in AppFlowy. @@ -13,9 +13,10 @@ import 'mobile_runner.dart'; /// Once removed, the integration_test.yaml must be updated to exclude this as /// as the test target. Future main() async { - IntegrationTestWidgetsFlutterBinding.ensureInitialized(); if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) { - await runIntegrationOnDesktop(); + await runIntegration1OnDesktop(); + await runIntegration2OnDesktop(); + await runIntegration3OnDesktop(); } else if (Platform.isIOS || Platform.isAndroid) { await runIntegrationOnMobile(); } else {