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

[QAA-425][Detox][Speculos] Add possibility to target production firebase env #8903

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 10 additions & 2 deletions .github/workflows/test-mobile-e2e-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ on:
required: false
type: boolean
default: false
production_firebase:
description: "Target Production Firebase environment"
required: false
type: boolean
default: false

# Uncomment to have log-level: trace on detox run and build
# (cf: apps/ledger-live-mobile/detox.config.js)
Expand Down Expand Up @@ -266,7 +271,9 @@ jobs:
shell: bash
- name: Build Android app for Detox test run
run: |
pnpm mobile e2e:ci -p android -b
pnpm mobile e2e:ci -p android -b $([[ "$PRODUCTION" == "true" ]] && printf %s '--production')
env:
PRODUCTION: ${{ inputs.production_firebase }}
- name: cache android emulator
timeout-minutes: 5
uses: tespkg/actions-cache@v1
Expand Down Expand Up @@ -316,12 +323,13 @@ jobs:
schedule_cron: ${{ github.event.schedule.cron }}
- name: Run Android Tests
id: detox
run: pnpm mobile e2e:ci -p android -t $([[ "$INPUT_SPECULOS" == "true" ]] && printf %s '--speculos') --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: pnpm mobile e2e:ci -p android -t $([[ "$INPUT_SPECULOS" == "true" ]] && printf %s '--speculos') $([[ "$PRODUCTION" == "true" ]] && printf %s '--production') --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
timeout-minutes: ${{ env.SPECULOS_RUN && 120 || 45 }}
env:
DETOX_INSTALL_TIMEOUT: 120000
SEED: ${{ secrets.SEED_QAA_B2C }}
INPUT_SPECULOS: ${{ env.SPECULOS_RUN }}
PRODUCTION: ${{ inputs.production_firebase }}
- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() || steps.detox.outcome == 'cancelled' }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-mobile-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ on:
required: false
type: boolean
default: false
production_firebase:
description: "Target Production Firebase environment"
required: false
type: boolean
default: false

# Uncomment to have log-level: trace on detox run and build
# (cf: apps/ledger-live-mobile/detox.config.js)
Expand Down
12 changes: 12 additions & 0 deletions apps/ledger-live-mobile/.env.mock.prerelease
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
APP_NAME="LLmock"
MOCK=1
DETOX=1
DISABLE_YELLOW_BOX=1
GOOGLE_SERVICE_INFO_NAME="GoogleService-Info-Production"
FORCE_DEBUG_VISIBLE=1
BRAZE_ANDROID_API_KEY="be5e1bc8-43f1-4864-b097-076a3c693a43"
BRAZE_IOS_API_KEY="e0a7dfaf-fc30-48f6-b998-01dbebbb73a4"
BRAZE_CUSTOM_ENDPOINT="sdk.fra-02.braze.eu"
FEATURE_FLAGS={"ratingsPrompt":{"enabled":false},"brazePushNotifications":{"enabled":false}}
# Fix random iOS app crash https://github.com/wix/Detox/pull/3135
SIMCTL_CHILD_NSZombieEnabled=YES
6 changes: 6 additions & 0 deletions apps/ledger-live-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ project.ext.envConfigFiles = [
release: ".env.android.release",
stagingrelease: ".env.android.staging",
detox: ".env.mock",
detoxprerelease: ".env.mock.prerelease",
]

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
Expand Down Expand Up @@ -190,6 +191,11 @@ android {
applicationIdSuffix ".detox"
matchingFallbacks = ['stagingRelease', 'release']
}
detoxPreRelease {
initWith(buildTypes.release)
signingConfig signingConfigs.stagingRelease
matchingFallbacks = ['release']
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"project_info": {
"project_number": "212042068804",
"project_id": "ledger-live-production",
"storage_bucket": "ledger-live-production.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:212042068804:android:cdf1f537910a5066b51d11",
"android_client_info": {
"package_name": "com.ledger.live"
}
},
"oauth_client": [
{
"client_id": "212042068804-drh6m4ulmedj9kd0q6337avsuuhhchmg.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCe9QrkYnsxCfnBilRFxnpC-uqgoF5IIyA"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "212042068804-drh6m4ulmedj9kd0q6337avsuuhhchmg.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "212042068804-n7rglq1e800k8fo9urt70etkbh2tia8l.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "ledgerlivemobile"
}
}
]
}
}
}
],
"configuration_version": "1"
}
20 changes: 20 additions & 0 deletions apps/ledger-live-mobile/detox.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ module.exports = {
build: `export ENVFILE=.env.mock && xcodebuild ARCHS=${iosArch} ONLY_ACTIVE_ARCH=YES -workspace ios/ledgerlivemobile.xcworkspace -scheme ledgerlivemobile -configuration Release -sdk iphonesimulator -derivedDataPath ios/build`,
binaryPath: "ios/build/Build/Products/Release-iphonesimulator/ledgerlivemobile.app",
},
"ios.prerelease": {
type: "ios.app",
build: `export ENVFILE=.env.mock.prerelease && xcodebuild ARCHS=${iosArch} ONLY_ACTIVE_ARCH=YES -workspace ios/ledgerlivemobile.xcworkspace -scheme ledgerlivemobile -configuration Release -sdk iphonesimulator -derivedDataPath ios/build`,
binaryPath: "ios/build/Build/Products/Release-iphonesimulator/ledgerlivemobile.app",
},
"android.debug": {
type: "android.apk",
build: `cd android && ENVFILE=.env.mock ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug -PreactNativeArchitectures=${androidArch} && cd ..`,
Expand All @@ -56,6 +61,13 @@ module.exports = {
binaryPath: `android/app/build/outputs/apk/detox/app-${androidArch}-detox.apk`,
testBinaryPath: "android/app/build/outputs/apk/androidTest/detox/app-detox-androidTest.apk",
},
"android.prerelease": {
type: "android.apk",
build: `cd android && ENVFILE=.env.mock.prerelease ./gradlew app:assembleDetoxPreRelease app:assembleAndroidTest -DtestBuildType=detoxPreRelease -PreactNativeArchitectures=${androidArch} && cd ..`,
binaryPath: `android/app/build/outputs/apk/detoxPreRelease/app-${androidArch}-detoxPreRelease.apk`,
testBinaryPath:
"android/app/build/outputs/apk/androidTest/detoxPreRelease/app-detoxPreRelease-androidTest.apk",
},
},
devices: {
simulator: {
Expand Down Expand Up @@ -87,6 +99,10 @@ module.exports = {
device: "simulator",
app: "ios.release",
},
"ios.sim.prerelease": {
device: "simulator",
app: "ios.prerelease",
},
"android.emu.debug": {
device: "emulator",
app: "android.debug",
Expand All @@ -95,5 +111,9 @@ module.exports = {
device: "emulator",
app: "android.release",
},
"android.emu.prerelease": {
device: "emulator",
app: "android.prerelease",
},
},
};
10 changes: 7 additions & 3 deletions apps/ledger-live-mobile/scripts/e2e-ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ let platform, test, build, bundle;
let speculos = "";
let cache = true;
let shard = "";
let target = "release";

const usage = (exitCode = 1) => {
console.log(
`Usage: ${basename(
__filename,
)} -p --platform <ios|android> [-h --help] [-t --test] [-b --build] [--bundle] [--cache | --no-cache] [--speculos] [--shard]`,
)} -p --platform <ios|android> [-h --help] [-t --test] [-b --build] [--bundle] [--cache | --no-cache] [--speculos] [--shard] [--production]`,
);
process.exit(exitCode);
};
Expand Down Expand Up @@ -51,12 +52,12 @@ const test_ios = async () => {
};

const build_android = async () => {
await $`pnpm mobile e2e:build -c android.emu.release`;
await $`pnpm mobile e2e:build -c android.emu.${target}`;
};

const test_android = async () => {
await $`pnpm mobile e2e:test${speculos} \\
-c android.emu.release \\
-c android.emu.${target} \\
--loglevel error \\
--record-logs all \\
--take-screenshots all \\
Expand Down Expand Up @@ -117,6 +118,9 @@ for (const argName in argv) {
case "shard":
shard = argv[argName];
break;
case "production":
target = "prerelease";
break;
default:
usage(42);
break;
Expand Down
Loading