diff --git a/.github/workflows/browerstack.yml b/.github/workflows/browerstack.yml index a34ddb1f1..06dd5a072 100644 --- a/.github/workflows/browerstack.yml +++ b/.github/workflows/browerstack.yml @@ -70,7 +70,7 @@ jobs: CI: "true" run: | flutter pub get - make do-android-debug ANDROID_ARCH=all + make appium-test-build - name: List files in current directory run: ls -la @@ -82,7 +82,7 @@ jobs: env: BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - BROWSERSTACK_APP_PATH: "build/app/outputs/flutter-apk/app-prod-debug.apk" + BROWSERSTACK_APP_PATH: "build/app/outputs/flutter-apk/app-appiumtest-debug.apk" run: | response=$(curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ -X POST "https://api-cloud.browserstack.com/app-automate/upload" \ diff --git a/.run/Appium Test.run.xml b/.run/Appium Test.run.xml new file mode 100644 index 000000000..4933e78fa --- /dev/null +++ b/.run/Appium Test.run.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/Makefile b/Makefile index f5d3497a6..408018a10 100644 --- a/Makefile +++ b/Makefile @@ -274,9 +274,12 @@ $(MOBILE_ANDROID_LIB): $(ANDROID_LIB) mkdir -p $(MOBILE_LIBS) && \ cp $(ANDROID_LIB) $(MOBILE_ANDROID_LIB) -.PHONY: android-lib +.PHONY: android-lib appium-test-build android-lib: $(MOBILE_ANDROID_LIB) +appium-test-build: + flutter build apk --flavor=appiumTest --dart-define=app.flavor=appiumTest --debug + $(MOBILE_TEST_APK) $(MOBILE_TESTS_APK): $(MOBILE_SOURCES) $(MOBILE_ANDROID_LIB) @$(GRADLE) -PandroidArch=$(ANDROID_ARCH) \ -PandroidArchJava="$(ANDROID_ARCH_JAVA)" \ diff --git a/android/app/build.gradle b/android/app/build.gradle index 45a8c0cd6..fe5f86a0f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -170,8 +170,7 @@ android { } buildTypes { - - debug { + debug { minifyEnabled false shrinkResources false debuggable true @@ -254,6 +253,9 @@ android { autoTest { versionCode 1 // so we can always test auto-update. } + appiumTest { + buildConfigField "boolean", "CI", "true" + } } splits { diff --git a/android/app/src/main/java/org/getlantern/mobilesdk/model/SessionManager.kt b/android/app/src/main/java/org/getlantern/mobilesdk/model/SessionManager.kt index 1c9292d3a..4d0e071ba 100644 --- a/android/app/src/main/java/org/getlantern/mobilesdk/model/SessionManager.kt +++ b/android/app/src/main/java/org/getlantern/mobilesdk/model/SessionManager.kt @@ -328,7 +328,7 @@ abstract class SessionManager(application: Application) : Session { val isPaymentTestMode: Boolean get() { val paymentTestMode = prefs.getBoolean(PAYMENT_TEST_MODE, false) - val ciValue = BuildConfig.CI + val ciValue = BuildConfig.FLAVOR == "appiumTest" return ciValue || paymentTestMode } diff --git a/lib/main.dart b/lib/main.dart index f4f137df9..34cd5fb94 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,12 +6,13 @@ import 'package:lantern/common/common.dart'; Future main() async { // CI will be true only when running appium test - var CI = const String.fromEnvironment('CI', defaultValue: 'false'); - var boolCI = bool.fromEnvironment("CI", defaultValue: false); - print('Appium CI is running $CI and bool $boolCI'); - if (CI == 'true') { + const String flavor = String.fromEnvironment('app.flavor'); + print("Running Flavor $flavor"); + if (flavor == 'appiumTest') { + print("Flutter extension enabled $flavor"); enableFlutterDriverExtension(); } + WidgetsFlutterBinding.ensureInitialized(); await _initGoogleMobileAds(); await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);