test(fdc): add e2e and unit tests to fdc #33
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: e2e-web | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- 'website/**' | |
- '**/example/**' | |
- '**/flutterfire_ui/**' | |
- '**.md' | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- 'website/**' | |
- '**/example/**' | |
- '**/flutterfire_ui/**' | |
- '**.md' | |
jobs: | |
web: | |
runs-on: macos-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
working_directory: | |
['tests', 'packages/cloud_firestore/cloud_firestore/example'] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b | |
name: Install Node.js 20 | |
with: | |
node-version: '20' | |
- uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 | |
with: | |
channel: 'stable' | |
cache: true | |
- uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 | |
with: | |
run-bootstrap: false | |
melos-version: '5.3.0' | |
- name: 'Bootstrap package' | |
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*" | |
- name: 'Install Tools' | |
run: sudo npm i -g firebase-tools | |
- name: Cache Firebase Emulator | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 | |
with: | |
path: ~/.cache/firebase/emulators | |
key: firebase-emulators-v3-${{ github.run_id }} | |
restore-keys: firebase-emulators-v3 | |
- name: Start Firebase Emulator | |
run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh | |
- name: 'E2E Tests' | |
working-directory: ${{ matrix.working_directory }} | |
# Web devices are not supported for the `flutter test` command yet. As a | |
# workaround we can use the `flutter drive` command. Tracking issue: | |
# https://github.com/flutter/flutter/issues/66264 | |
run: | | |
chromedriver --port=4444 --trace-buffer-size=100000 & | |
flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --dart-define=CI=true | tee output.log | |
# We have to check the output for failed tests matching the string "[E]" | |
output=$(<output.log) | |
if [[ "$output" =~ \[E\] ]]; then | |
# You will see "All tests passed." in the logs even when tests failed. | |
echo "All tests did not pass. Please check the logs for more information." | |
exit 1 | |
fi | |
shell: bash | |
web-app-check: | |
runs-on: macos-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b | |
name: Install Node.js 20 | |
with: | |
node-version: '20' | |
- uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 | |
with: | |
channel: 'stable' | |
cache: true | |
- uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 | |
with: | |
run-bootstrap: false | |
melos-version: '5.3.0' | |
- name: 'Bootstrap package' | |
run: melos bootstrap --scope tests | |
- name: 'Install Tools' | |
run: sudo npm i -g firebase-tools | |
- name: Cache Firebase Emulator | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 | |
with: | |
path: ~/.cache/firebase/emulators | |
key: firebase-emulators-v3-${{ github.run_id }} | |
restore-keys: firebase-emulators-v3 | |
- name: Start Firebase Emulator | |
run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh | |
- name: 'E2E Tests' | |
working-directory: tests | |
# Web devices are not supported for the `flutter test` command yet. As a | |
# workaround we can use the `flutter drive` command. Tracking issue: | |
# https://github.com/flutter/flutter/issues/66264 | |
run: | | |
chromedriver --port=4444 --trace-buffer-size=100000 & | |
flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --dart-define=CI=true --dart-define=APP_CHECK_E2E=true | tee output.log | |
# We have to check the output for failed tests matching the string "[E]" | |
output=$(<output.log) | |
if [[ "$output" =~ \[E\] ]]; then | |
# You will see "All tests passed." in the logs even when tests failed. | |
echo "All tests did not pass. Please check the logs for more information." | |
exit 1 | |
fi | |
shell: bash | |
web-wasm: | |
runs-on: macos-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
working_directory: | |
['tests', 'packages/cloud_firestore/cloud_firestore/example'] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b | |
name: Install Node.js 20 | |
with: | |
node-version: '20' | |
- uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 | |
with: | |
channel: 'stable' | |
cache: true | |
- uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52 | |
with: | |
run-bootstrap: false | |
melos-version: '5.3.0' | |
- name: 'Bootstrap package' | |
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*" | |
- name: 'Install Tools' | |
run: sudo npm i -g firebase-tools | |
- name: Cache Firebase Emulator | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 | |
with: | |
path: ~/.cache/firebase/emulators | |
key: firebase-emulators-v3-${{ github.run_id }} | |
restore-keys: firebase-emulators-v3 | |
- name: Start Firebase Emulator | |
run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh | |
- name: 'E2E Tests' | |
working-directory: ${{ matrix.working_directory }} | |
# Web devices are not supported for the `flutter test` command yet. As a | |
# workaround we can use the `flutter drive` command. Tracking issue: | |
# https://github.com/flutter/flutter/issues/66264 | |
run: | | |
chromedriver --port=4444 --trace-buffer-size=100000 & | |
mv ./web/wasm_index.html ./web/index.html | |
flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --wasm --dart-define=CI=true | tee output.log | |
# We have to check the output for failed tests matching the string "[E]" | |
output=$(<output.log) | |
if [[ "$output" =~ \[E\] ]]; then | |
# You will see "All tests passed." in the logs even when tests failed. | |
echo "All tests did not pass. Please check the logs for more information." | |
exit 1 | |
fi | |
shell: bash |