Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Testing #1207

Open
wants to merge 174 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
1336acd
Setup test suite
jigar-f Oct 4, 2024
bfe7a28
Implement dependency injection for model setup
jigar-f Oct 7, 2024
a6a298a
Start adding test cases for home.
jigar-f Oct 7, 2024
07bd393
Added home test cases for IOS.
jigar-f Oct 9, 2024
c35c821
started adding test cases for vpn tap.
jigar-f Oct 9, 2024
d133b89
Merge branch 'main' into jigar/setup-test-suite
jigar-f Oct 10, 2024
2194b7d
Added test for vpn tap.
jigar-f Oct 10, 2024
01054b3
Create reuseable method.
jigar-f Oct 10, 2024
14f0075
Added test for vpn tap and start setting up patrol.
jigar-f Oct 10, 2024
88f1d35
added patrol for android and start adding some basic test for integra…
jigar-f Oct 14, 2024
6239185
add more test for app.dart.
jigar-f Oct 15, 2024
9b512f2
more test changes.
jigar-f Oct 16, 2024
05b37ab
Mock home test
jigar-f Oct 16, 2024
b54d027
Merge branch 'main' into jigar/setup-test-suite
jigar-f Oct 17, 2024
4eb1775
Routing without context and some other test cases fixes.
jigar-f Oct 18, 2024
95aea94
Added test case for VPN tap.
jigar-f Oct 18, 2024
16461ad
Fix android session model issue.
jigar-f Oct 18, 2024
1a1cd49
Added macos setup and vpn tap test for dekstop.
jigar-f Oct 18, 2024
2006a5e
More stuff
jigar-f Oct 23, 2024
fa6111b
Update homepage_flow_mock_test.dart
jigar-f Oct 23, 2024
63d6a49
Update .gitignore
jigar-f Oct 23, 2024
cfe0bee
test improvements.
jigar-f Oct 23, 2024
9f66bf9
Implemented account flow test
jigar-f Oct 24, 2024
1c07351
Updated account flow test cases to support desktop
jigar-f Oct 24, 2024
cc61496
Setting flow, report issue flow test cases.
jigar-f Oct 25, 2024
30e5a6c
language flow test cases.
jigar-f Oct 25, 2024
7822fb1
Merge branch 'main' into jigar/setup-test-suite
jigar-f Oct 25, 2024
2e52056
Update language_flow_test.dart
jigar-f Oct 25, 2024
e538df1
Script for running all test as single in macos.
jigar-f Oct 28, 2024
3560a8d
More changes.
jigar-f Oct 28, 2024
cd7953e
Remove prints and fix android test issue.
jigar-f Oct 29, 2024
4a296b9
Fix issue while running android.
jigar-f Oct 29, 2024
1003f52
merge latest
atavism Nov 8, 2024
83b6948
Merge branch 'main' into jigar/setup-test-suite
jigar-f Nov 18, 2024
f209be3
More chanegs
jigar-f Nov 20, 2024
2f999b7
Remove some utils methods.
jigar-f Nov 20, 2024
d5c36eb
support test cases for pro users.
jigar-f Nov 21, 2024
87dcda5
update readme
jigar-f Nov 21, 2024
299b656
Add script for firebase test labs and updates readme.
jigar-f Nov 22, 2024
58482b0
Update README.md
jigar-f Nov 22, 2024
c8c88af
Fix widget test for dekstop.
jigar-f Nov 22, 2024
2576285
Update widget test case to use patrol.
jigar-f Nov 25, 2024
d760017
Added github action for running tests.
jigar-f Nov 25, 2024
d33ef89
update test action.
jigar-f Nov 25, 2024
ccf5452
generate libraries on github action.
jigar-f Nov 25, 2024
a9e34e9
update actions.
jigar-f Nov 25, 2024
ebeb5f8
Update test.yml
jigar-f Nov 25, 2024
5cce3dd
try to fix desktop test
jigar-f Nov 25, 2024
fcdba5b
Debug issue.
jigar-f Nov 25, 2024
1b0fcc5
Update test.yml
jigar-f Nov 25, 2024
bfb7927
Update test.yml
jigar-f Nov 26, 2024
b80930f
Update test.yml
jigar-f Nov 26, 2024
450c075
added verbose.
jigar-f Nov 26, 2024
231a65a
fix command.
jigar-f Nov 26, 2024
ae9a851
more CI changes.
jigar-f Nov 26, 2024
7405865
CI changes.
jigar-f Nov 26, 2024
87cfdd4
timeout changes.
jigar-f Nov 26, 2024
47f4b3e
Trial and error.
jigar-f Nov 26, 2024
d1fdcc8
added verbose flag.
jigar-f Nov 26, 2024
9278ccd
Merge branch 'main' into jigar/setup-test-suite
jigar-f Nov 26, 2024
a247fa4
added logs.
jigar-f Nov 26, 2024
b510d6b
Update Makefile
jigar-f Nov 26, 2024
017d53c
Update main.dart
jigar-f Nov 26, 2024
c1b07e5
Increase timeouts.
jigar-f Nov 26, 2024
ea704bc
Added more logs.
jigar-f Nov 26, 2024
e3fe207
more CI logs.
jigar-f Nov 26, 2024
986d1d7
Make more changes.
jigar-f Nov 26, 2024
2bb1348
Update Release.entitlements
jigar-f Nov 26, 2024
114db2f
Revert "Update Release.entitlements"
jigar-f Nov 26, 2024
ea62f3b
Revert "Make more changes."
jigar-f Nov 26, 2024
d0d5a1d
Revert "more CI logs."
jigar-f Nov 26, 2024
416844b
Revert "Added more logs."
jigar-f Nov 26, 2024
00c3e92
Revert "Increase timeouts."
jigar-f Nov 26, 2024
9c87d9f
Revert "Update main.dart"
jigar-f Nov 26, 2024
4a19dc4
Revert "Update Makefile"
jigar-f Nov 26, 2024
abce26c
Revert "added logs."
jigar-f Nov 26, 2024
68ad01c
Update main.dart
jigar-f Nov 26, 2024
49f2e8e
Update test.yml
jigar-f Nov 26, 2024
7712624
change startup sequence.
jigar-f Nov 26, 2024
585c40f
run job on linux
jigar-f Nov 26, 2024
eed855d
Update test.yml
jigar-f Nov 26, 2024
a4b5dda
update Linux CI.
jigar-f Nov 26, 2024
818eb35
Update test.yml
jigar-f Nov 26, 2024
ce87cdd
Update test.yml
jigar-f Nov 26, 2024
c3ebf90
Update test.yml
jigar-f Nov 26, 2024
b98cfcc
Update test.yml
jigar-f Nov 26, 2024
c8f256a
update parol cli guard.
jigar-f Nov 26, 2024
50d0609
update firebase test labs script.
jigar-f Nov 26, 2024
4b9ce8b
Use macos runner.
jigar-f Nov 26, 2024
1e16c9b
Update test.yml
jigar-f Nov 26, 2024
c383676
Update Release.entitlements
jigar-f Nov 27, 2024
d74ef6a
Update humanize_test.dart
jigar-f Nov 27, 2024
bb01e56
Fix date test case
jigar-f Nov 27, 2024
574afa8
Update test.yml
jigar-f Nov 27, 2024
5fa2153
Update lantern_ffi_service.dart
jigar-f Nov 27, 2024
93c9733
added logs in ffi.
jigar-f Nov 27, 2024
2600523
Added ls tag in github CI.
jigar-f Nov 27, 2024
444744e
Update run_test.sh
jigar-f Nov 27, 2024
70984d8
FIx LS issue.
jigar-f Nov 27, 2024
1ee3dec
use intel bases ci.
jigar-f Nov 27, 2024
385ab69
Use ubuntu-latest
jigar-f Nov 27, 2024
7562591
Added gcloud config
jigar-f Nov 27, 2024
75cd560
Move the android test.
jigar-f Nov 27, 2024
22ead95
update test labs script.
jigar-f Nov 27, 2024
e6f9832
cleanup disk space before running macos test
jigar-f Nov 28, 2024
ced66dc
clean up more space.
jigar-f Nov 28, 2024
439276f
Upgrade patrol
jigar-f Nov 28, 2024
ce735c9
Update homepage_flow_mock_test.dart
jigar-f Nov 28, 2024
0e596db
Update account_flow_test.dart
jigar-f Nov 28, 2024
aa8594a
Update account test case.
jigar-f Nov 28, 2024
87f49c1
Remove logs.
jigar-f Nov 28, 2024
0523cdd
Fix user create sequence.
jigar-f Nov 28, 2024
2b8c4a6
update sentry flutter.
jigar-f Nov 28, 2024
0e30b71
Revert "update sentry flutter."
jigar-f Nov 28, 2024
fd6d54f
added try catch
jigar-f Nov 28, 2024
593b64c
update device list.
jigar-f Nov 28, 2024
e285fe1
update test
jigar-f Nov 28, 2024
7c6cf70
enable CGO
jigar-f Nov 29, 2024
f3d1561
Hide widget test for now.
jigar-f Nov 29, 2024
dac7c73
Update test.yml
jigar-f Nov 29, 2024
dca9956
Merge branch 'main' into jigar/setup-test-suite
jigar-f Nov 29, 2024
e4335dd
add disk space check.
jigar-f Nov 29, 2024
6510903
update runner.
jigar-f Nov 29, 2024
3b90482
Update test.yml
jigar-f Nov 29, 2024
49bbb16
downgrade patrol
jigar-f Nov 29, 2024
6802bef
update some settings.
jigar-f Nov 29, 2024
e9f7344
Update MainActivityTest.java
jigar-f Nov 29, 2024
ce26a18
update runner to 16 core.
jigar-f Nov 29, 2024
dc9bf96
Update build.gradle
jigar-f Nov 29, 2024
54d7681
Update app_startup_flow_test.dart
jigar-f Nov 29, 2024
dd6bd79
added flaky-test-attempts
jigar-f Nov 29, 2024
5ef7e76
Hide app start up test
jigar-f Nov 29, 2024
a48278a
added concurrency and some other changes.
jigar-f Nov 29, 2024
891a066
Merge remote-tracking branch 'origin/main' into jigar/setup-test-suite
atavism Dec 2, 2024
226b177
Merge latest code.
jigar-f Dec 2, 2024
0f7a5c7
Added windows script.
jigar-f Dec 2, 2024
ebc6743
Fix issue with desktop test cases.
jigar-f Dec 2, 2024
3392d30
Fix go test cases issue.
jigar-f Dec 2, 2024
92f12cb
Fix UserCreate test cases go.
jigar-f Dec 2, 2024
93f45df
Update README.md
jigar-f Dec 2, 2024
d982e36
Setup test run on windows.
jigar-f Dec 3, 2024
eec3b87
Update test.yml
jigar-f Dec 3, 2024
e7032d0
Fix github CI action.
jigar-f Dec 3, 2024
de5193b
Updated Build Library step
jigar-f Dec 3, 2024
c26bdee
Try to fix windows parse error.
jigar-f Dec 3, 2024
e9d6bfa
Update test.yml
jigar-f Dec 3, 2024
63e5065
Seprate step for building lib.
jigar-f Dec 3, 2024
79a8be3
Merge branch 'main' into jigar/setup-test-suite
jigar-f Dec 17, 2024
1fcc1f4
Merge branch 'main' into jigar/setup-test-suite
jigar-f Dec 24, 2024
e2cfe45
Fix issue with datacap.
jigar-f Dec 24, 2024
d98970d
Merge branch 'main' into jigar/setup-test-suite
jigar-f Dec 26, 2024
c16efea
Fix syntax issue.
jigar-f Dec 26, 2024
01721ae
Fix more compile time issue
jigar-f Dec 26, 2024
2b54f3d
nites on android test, Hide ads while running on CI.
jigar-f Dec 26, 2024
4ee0dac
Setup IOS for testing.
jigar-f Dec 27, 2024
cce9f72
More changes for IOS.
jigar-f Dec 31, 2024
97cd275
Fix test case.
jigar-f Dec 31, 2024
22fbba2
Update run_android_testlabs.sh
jigar-f Dec 31, 2024
09333db
Add support for IOS.
jigar-f Dec 31, 2024
717d62a
Trigger CI
jigar-f Dec 31, 2024
80c5c33
Update test.yml
jigar-f Dec 31, 2024
0561c3f
Update test.yml
jigar-f Dec 31, 2024
4c2f0ee
Added ID
jigar-f Dec 31, 2024
1985694
Fix test case.
jigar-f Dec 31, 2024
d11e839
Upload xc result.
jigar-f Dec 31, 2024
a4c5cac
Back to run on macos 14.
jigar-f Dec 31, 2024
95b862f
Hide macos runner.
jigar-f Dec 31, 2024
7080710
Added stipe checkout test.
jigar-f Jan 2, 2025
fcadec4
Fix stripe checkout test.
jigar-f Jan 2, 2025
f0e2708
Combine all checkout in one test.
jigar-f Jan 6, 2025
190f825
Update checkout_flow_test.dart
jigar-f Jan 7, 2025
ebb05b8
Fix checkout flow test crash.
jigar-f Jan 8, 2025
4d19479
Merge branch 'main' into jigar/setup-test-suite
jigar-f Jan 8, 2025
845cf70
Fix crashes.
jigar-f Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: Test Suite

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
GOPRIVATE: github.com/getlantern

jobs:
test-suite:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest-16-cores, windows-latest ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true

- name: Pull LFS objects
run: git lfs pull

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Granting private modules access
run: git config --global url."https://${{ secrets.GH_TOKEN }}:[email protected]/".insteadOf "https://github.com/"

- name: GCloud Auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}

- name: 'Set up Cloud SDK'
uses: google-github-actions/setup-gcloud@v2

- name: Setup protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install latest protoc-gen-go
run: go install github.com/golang/protobuf/protoc-gen-go@latest

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: 'gradle'

- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"

- name: Activate dart plugins
run: |
dart pub global activate protoc_plugin
dart pub global activate patrol_cli

- name: Install dependencies
run: flutter pub get

- name: Generate app.env
env:
ANDROID_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID }}
IOS_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID_IOS }}
TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID: ${{ secrets.TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID }}
TAPSELL_INTERSTITIAL_ZONE_ID: ${{ secrets.TAPSELL_INTERSTITIAL_ZONE_ID }}
run: |
touch app.env
echo "Android_interstitialAd=$ANDROID_INTERSTITIAL_AD_ID" > app.env
echo "IOS_interstitialAd=$IOS_INTERSTITIAL_AD_ID" >> app.env
echo "VideoInterstitialZoneId=$TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID" >> app.env
echo "InterstitialZoneId=$TAPSELL_INTERSTITIAL_ZONE_ID" >> app.env

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
if: runner.os == 'macOS'
with:
xcode-version: latest-stable

- name: Install Linux dependencies
if: runner.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y network-manager dbus-x11
sudo apt-get install -y libwebkit2gtk-4.1-dev
sudo apt-get install -y libunwind-dev libstdc++-12-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-d cmake
sudo apt-get install -y libgtk-3-0 libblkid1 liblzma5
sudo apt-get install -y libpcap-dev libgtk-3-dev libayatana-appindicator3-dev ruby ruby-dev && sudo gem install bundler -v 2.2.26

- name: Install the ninja build tool
if: runner.os == 'linux'
uses: seanmiddleditch/gha-setup-ninja@master

- name: Install WebView2 Runtime
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "MicrosoftEdgeWebView2Setup.exe"
Start-Process -FilePath ".\MicrosoftEdgeWebView2Setup.exe" -ArgumentList "/silent", "/install" -Wait

- name: Set up MinGW
if: matrix.os == 'windows-latest'
run: choco install mingw -y

- name: Build for Windows
if: matrix.os == 'windows-latest'
run: |
echo "Building for Windows..."
make windows
make ffigen

- name: Build linux Libraries
shell: bash
if: runner.os == 'linux'
run: |
make android ANDROID_ARCH=all
make linux
make ffigen

- name: Build for IOS
if: runner.os == 'macOS'
run: |
make ios
make ffigen

- name: Running widget tests
run: make widget-tests

# Run firebase test only on one OS runner
# Does not make sense to run on all OS runners
- name: Running workflow test for android on Firebase test labs
if: runner.os == 'linux'
run: make ci-android-test

- name: Starting Simulator
id: simulator
if: runner.os == 'macOS'
uses: futureware-tech/simulator-action@v4
with:
model: 'iPhone 15 Pro'

- name: Running workflow test for iOS
run: patrol test -d ${{ steps.simulator.outputs.udid }}
if: runner.os == 'macOS'
timeout-minutes: 70

- name: Upload xc result
if: runner.os == 'macOS' && always()
uses: actions/upload-artifact@v4
with:
name: xc-result
path: ${{ github.workspace }}/build/ios
retention-days: 2

- name: Running workflow test for linux
uses: coactions/setup-xvfb@v1
if: runner.os == 'linux'
timeout-minutes: 60
with:
run: |
sudo systemctl start dbus
sudo systemctl start NetworkManager
make linuxDesktopTest

- name: Running workflow test for windows
run: make windowsDesktopTest
if: runner.os == 'windows'
timeout-minutes: 60
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ lib/generated_bindings.dart

*.env
ExportOptions.plist
integration_test/test_bundle.dart
integration_test/test_bundle.dart
86 changes: 85 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test:
TEST ?= *_test

# integration-test:
# @flutter drive --driver test_driver/integration_driver.dart --debug --flavor prod --target `ls integration_test/$(TEST).dart`
# @flutter drive --driver test_driver/integration_test.dart --debug --flavor prod --target `ls integration_test/$(TEST).dart`

APP ?= lantern
CAPITALIZED_APP := Lantern
Expand Down Expand Up @@ -88,6 +88,7 @@ ADB := $(call get-command,adb)
OPENSSL := $(call get-command,openssl)
GMSAAS := $(call get-command,gmsaas)
SENTRY := $(call get-command,sentry-cli)
PATROL := $(call get-command,patrol)
BASE64 := $(call get-command,base64)

GIT_REVISION_SHORTCODE := $(shell git rev-parse --short HEAD)
Expand Down Expand Up @@ -745,3 +746,86 @@ clean:
rm -f `which gomobile` && \
rm -f `which gobind`
rm -Rf "$(FLASHLIGHT_FRAMEWORK_PATH)" "$(INTERMEDIATE_FLASHLIGHT_FRAMEWORK_PATH)"


# Test environment scripts and other utilities

require-patrol:
@if [[ -z "$(PATROL)" ]]; then echo 'patrol-cli is not installed. Please install it with dart pub global activate patrol_cli'; exit 1; fi


# Build android apk for test
test-build-android:
@echo "Building apk for test..."
@patrol build android

# Application test cases

# Run all native tests
nativeTest: require-patrol
@echo "Running native tests..."
patrol test --target integration_test/features/vpn/vpn_flow_test.dart --dart-define native=true --flavor=prod --verbose

# Run specific native tests

runNativeTest: require-patrol
@ARGUMENTS=$(filter-out $@,$(MAKECMDGOALS)); \
echo "Running patrol native tests on: $$ARGUMENTS" && \
patrol test --target $$ARGUMENTS --flavor=prod


#Runs all integration tests
appWorkflowTest:
@echo "Running all integration tests..."
patrol test


# Run specific integration tests
# Usage: make run-specific-integration-tests integration_test/app_startup_flow_test.dart
runTest:
@ARGUMENTS=$(filter-out $@,$(MAKECMDGOALS)); \
echo "Running tests on: $$ARGUMENTS" && \
patrol test --target $$ARGUMENTS


#------- Desktop test and utils ------------

# Run all workflow tests on desktop
maOSWorkflowTest:
@echo "Running all integration tests..."
sh $(CURDIR)/integration_test/run_macos_test.sh

linuxDesktopTest:
@echo "Running all integration tests..."
sh $(CURDIR)/integration_test/run_linux_test.sh

windowsDesktopTest:
@echo "Running all integration tests..."
sh $(CURDIR)/integration_test/run_windows_test.sh

# Run specific tests on desktop
#you can pass DEVICE=<platform> (e.g., macOS, linux, windows)
runDesktopTest:
@ARGUMENTS=$(filter-out $@,$(MAKECMDGOALS)); \
DEVICE=$(DEVICE); \
if [ -z "$$DEVICE" ]; then \
echo "Error: DEVICE is not specified. Use DEVICE=<platform> (e.g., macOS, linux, android)"; \
exit 1; \
fi; \
echo "Running tests on: $$ARGUMENTS" && \
flutter test $$ARGUMENTS -d $$DEVICE -r expanded


# Run all android test on Firebase test lab
ci-android-test:test-build-android
@echo "Running tests on Firebase test labs..."
sh $(CURDIR)/integration_test/run_android_testlabs.sh


#Runs widget tets
widget-tests:
@echo "Running widget tests..."
flutter test test/



Loading
Loading