From f43a8e947b61f3703b8f8b47ebea2879661aece8 Mon Sep 17 00:00:00 2001 From: Nicolas Ayral Seydoux Date: Thu, 8 Aug 2024 14:50:25 +0200 Subject: [PATCH] Add CI config to detox emulator --- .detoxrc.js | 5 ++++- Dockerfile | 15 +++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.detoxrc.js b/.detoxrc.js index e8ff3ea..211bfe7 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -47,7 +47,10 @@ module.exports = { type: 'android.emulator', device: { avdName: process.env.TEST_ANDROID_EMU - } + }, + // If running in CI, the emulator requires additional configuration options. + bootArgs: process.env.NODE_ENV === "development" ? "" : "-no-snapshot -accel off -noaudio -no-boot-anim -camera-back none", + headless: process.env.NODE_ENV !== "development" } }, configurations: { diff --git a/Dockerfile b/Dockerfile index 40589f9..e73162a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,11 @@ RUN sdkmanager --verbose ${ANDROID_SDK_PACKAGES} RUN avdmanager --verbose create avd --name "pixel_7" --device "pixel_7" --package "system-images;android-34;google_apis_playstore;x86_64" WORKDIR /inrupt-wallet-frontend/ +COPY package.json package-lock.json ./ +RUN echo "Installing the dependencies" +RUN npm ci +COPY .detoxrc.js app.config.ts metro.config.js tsconfig.json ./ COPY android-config/ ./android-config/ COPY api/ ./api/ COPY app/ ./app/ @@ -26,20 +30,15 @@ COPY hooks/ ./hooks/ COPY plugins/ ./plugins/ COPY types/ ./types/ COPY utils/ ./utils/ -COPY .detoxrc.js app.config.ts metro.config.js package.json package-lock.json run-ui-tests.sh tsconfig.json ./ # The APK must be compiled beforehand # TODO: Add a test checking for its presence -COPY android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk . +COPY android/app/build/outputs/apk/release/app-release.apk ./android/app/build/outputs/apk/release/app-release.apk +COPY android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk ./android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk RUN chown circleci . ENV CI=true ENV SIGNING_CONFIG_PATH=/inrupt-wallet-frontend/android-config/signing-config.gradle - -RUN echo "Installing the dependencies" -RUN npm ci - -# The following starts an emulator, it seems successfully -#emulator @pixel -no-snapshot -accel off -no-window -noaudio -no-boot-anim -camera-back none +ENV TEST_ANDROID_EMU="pixel_7" CMD ["bash", "-c", "npx detox test --configuration android.emu.release"]