From d69426ce0e0f38ffe19837746826a388ce9046bb Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 11 Aug 2023 15:25:57 -0600 Subject: [PATCH 01/46] Fix path to build Android correctly --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 60d60934c2ba..ec68c74472de 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="#{Dir.pwd}/../src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"]="../src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" gradle( From 85f0d93e444f6437bff64eba4809c66ea7f2ea68 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 11 Aug 2023 15:31:03 -0600 Subject: [PATCH 02/46] Add `IS_MERGED` output --- .github/actions/javascript/getPullRequestDetails/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/javascript/getPullRequestDetails/action.yml b/.github/actions/javascript/getPullRequestDetails/action.yml index a59cf55bdf9f..6704d5220851 100644 --- a/.github/actions/javascript/getPullRequestDetails/action.yml +++ b/.github/actions/javascript/getPullRequestDetails/action.yml @@ -15,6 +15,8 @@ outputs: description: 'The merge_commit_sha of the given pull request' MERGE_ACTOR: description: 'The actor who merged the pull request' + IS_MERGED: + description: 'True if the pull request is merged' runs: using: 'node16' main: './index.js' From 45dd2b4e1b00bcea3ce29aa659874ea24f40c795 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 11 Aug 2023 15:35:14 -0600 Subject: [PATCH 03/46] Add two more missing outputs --- .github/actions/javascript/getPullRequestDetails/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/javascript/getPullRequestDetails/action.yml b/.github/actions/javascript/getPullRequestDetails/action.yml index 6704d5220851..ed2c60f018a1 100644 --- a/.github/actions/javascript/getPullRequestDetails/action.yml +++ b/.github/actions/javascript/getPullRequestDetails/action.yml @@ -13,10 +13,14 @@ inputs: outputs: MERGE_COMMIT_SHA: description: 'The merge_commit_sha of the given pull request' + HEAD_COMMIT_SHA: + description: 'The head_commit_sha of the given pull request' MERGE_ACTOR: description: 'The actor who merged the pull request' IS_MERGED: description: 'True if the pull request is merged' + FORKED_REPO_URL: + description: 'Output forked repo URL if PR includes changes from a fork' runs: using: 'node16' main: './index.js' From 20c1e05b2a54b3b9d06124839ecb6c6833e3a7f5 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 11 Aug 2023 15:40:54 -0600 Subject: [PATCH 04/46] Temp comment out fork checkout --- .github/workflows/e2ePerformanceTests.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index fe364b376e3b..548f7e901667 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -81,12 +81,13 @@ jobs: - name: Unmerged PR - Fetch head ref of unmerged PR if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} run: | - if [[ ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} != '' ]]; then - git remote add pr_remote ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} - git fetch pr_remote ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 - else +# TODO: UNDO THIS +# if [[ ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} != '' ]]; then +# git remote add pr_remote ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} +# git fetch pr_remote ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 +# else git fetch origin ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 - fi +# fi - name: Unmerged PR - Set dummy git credentials before merging if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} From 0cd275462293f0ca4238545fbb8037cc40904e8d Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 11 Aug 2023 15:41:48 -0600 Subject: [PATCH 05/46] Another temporary fix --- .github/workflows/e2ePerformanceTests.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 548f7e901667..7888c8c47c25 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -81,13 +81,7 @@ jobs: - name: Unmerged PR - Fetch head ref of unmerged PR if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} run: | -# TODO: UNDO THIS -# if [[ ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} != '' ]]; then -# git remote add pr_remote ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} -# git fetch pr_remote ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 -# else git fetch origin ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 -# fi - name: Unmerged PR - Set dummy git credentials before merging if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} From f7f3a45a86728c1cccd49bde0407d05a1f7f1c31 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 15 Aug 2023 15:45:25 -0600 Subject: [PATCH 06/46] Tweak path --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ec68c74472de..5dfccb4d93ec 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="../src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"]="{Dir.pwd}/src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" gradle( From bd51745eb262a09b416b76c2cbc7f451c6edcedd Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 15 Aug 2023 16:23:32 -0600 Subject: [PATCH 07/46] Try fixing path yet again! --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5dfccb4d93ec..cd11c5cf9e98 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="{Dir.pwd}/src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"]="src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" gradle( From 64e4effbd2c266308c09181007cd4d416c84f6e5 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 15 Aug 2023 16:52:54 -0600 Subject: [PATCH 08/46] Undo test commit --- .github/workflows/e2ePerformanceTests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 7888c8c47c25..fe364b376e3b 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -81,7 +81,12 @@ jobs: - name: Unmerged PR - Fetch head ref of unmerged PR if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} run: | + if [[ ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} != '' ]]; then + git remote add pr_remote ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} + git fetch pr_remote ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 + else git fetch origin ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 + fi - name: Unmerged PR - Set dummy git credentials before merging if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} From 9debab5bceb6bb778ac7ed83589159096c05dc32 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 15 Aug 2023 17:14:28 -0600 Subject: [PATCH 09/46] Testing full flow --- .github/workflows/e2ePerformanceTests.yml | 60 +++-------------------- 1 file changed, 6 insertions(+), 54 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index fe364b376e3b..557af1a04786 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -16,42 +16,6 @@ on: required: true jobs: - buildBaseline: - runs-on: ubuntu-latest-xl - name: Build apk from latest release as a baseline - outputs: - VERSION: ${{ steps.getMostRecentRelease.outputs.VERSION }} - steps: - - uses: actions/checkout@v3 - - - name: Get most recent release version - id: getMostRecentRelease - run: echo "VERSION=$(gh release list --limit 1 | awk '{ print $1 }')" >> "$GITHUB_OUTPUT" - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: Check if there's an existing artifact for this baseline - id: checkForExistingArtifact - uses: xSAVIKx/artifact-exists-action@3c5206b1411c0d2fc0840f56b7140646933d9d6a - with: - name: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} - - - name: Skip build if there's already an existing artifact for the baseline - if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.exists) }} - run: echo 'APK for baseline ${{ steps.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' - - - name: Checkout "Baseline" commit (last release) - if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} - run: | - git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 - git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} - - - name: Build APK - if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} - uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main - with: - ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} - buildDelta: runs-on: ubuntu-latest-xl name: Build apk from delta ref @@ -81,12 +45,7 @@ jobs: - name: Unmerged PR - Fetch head ref of unmerged PR if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} run: | - if [[ ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} != '' ]]; then - git remote add pr_remote ${{ steps.getPullRequestDetails.outputs.FORKED_REPO_URL }} - git fetch pr_remote ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 - else git fetch origin ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} --no-tags --depth=1 - fi - name: Unmerged PR - Set dummy git credentials before merging if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} @@ -119,7 +78,7 @@ jobs: runTestsInAWS: runs-on: ubuntu-latest - needs: [buildBaseline, buildDelta] + needs: [buildDelta] name: Run E2E tests in AWS device farm steps: - uses: actions/checkout@v3 @@ -127,25 +86,18 @@ jobs: - name: Make zip directory for everything to send to AWS Device Farm run: mkdir zip - - name: Download baseline APK - uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b - id: downloadBaselineAPK - with: - name: baseline-apk-${{ needs.buildBaseline.outputs.VERSION }} - path: zip - - # The downloaded artifact will be a file named "app-e2eRelease.apk" so we have to rename it - - name: Rename baseline APK - run: mv "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2eRelease.apk" "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2eRelease-baseline.apk" - - name: Download delta APK uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b + id: downloadDeltaAPK with: name: delta-apk-${{ needs.buildDelta.outputs.DELTA_REF }} path: zip - name: Rename delta APK - run: mv "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2eRelease.apk" "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2eRelease-compare.apk" + run: mv "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease.apk" "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease-compare.apk" + + - name: Copy Delta APK as compare for testing + run: mv "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease-compare.apk" "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease-baseline.apk" - name: Copy e2e code into zip folder run: cp -r tests/e2e zip From e1b500b38a023b5c82b99f0adcd0acac5b73b9a2 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 16 Aug 2023 11:12:06 -0600 Subject: [PATCH 10/46] Add more logs --- src/libs/E2E/tests/openSearchPageTest.e2e.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libs/E2E/tests/openSearchPageTest.e2e.js b/src/libs/E2E/tests/openSearchPageTest.e2e.js index 2f0f72f35bdd..12fcfc3fd1a7 100644 --- a/src/libs/E2E/tests/openSearchPageTest.e2e.js +++ b/src/libs/E2E/tests/openSearchPageTest.e2e.js @@ -7,12 +7,16 @@ import CONST from '../../../CONST'; const test = () => { // check for login (if already logged in the action will simply resolve) + console.debug('[E2E] Logging in for search'); + E2ELogin().then((neededLogin) => { if (neededLogin) { // we don't want to submit the first login to the results return E2EClient.submitTestDone(); } + console.debug('[E2E] Logged in, getting search metrics and submitting them…'); + Performance.subscribeToMeasurements((entry) => { if (entry.name !== CONST.TIMING.SEARCH_RENDER) { return; @@ -21,7 +25,14 @@ const test = () => { E2EClient.submitTestResults({ name: 'Open Search Page TTI', duration: entry.duration, - }).then(E2EClient.submitTestDone); + }) + .then(() => { + console.debug('[E2E] Done with search, exiting…'); + E2EClient.submitTestDone(); + }) + .catch((err) => { + console.debug('[E2E] Error while submitting test results:', err); + }); }); Navigation.navigate(ROUTES.SEARCH); From 6a93aeb4167656de56731b75e20e4acbc114113b Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 16 Aug 2023 13:10:24 -0600 Subject: [PATCH 11/46] Add more logs --- src/libs/E2E/tests/openSearchPageTest.e2e.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/E2E/tests/openSearchPageTest.e2e.js b/src/libs/E2E/tests/openSearchPageTest.e2e.js index 12fcfc3fd1a7..ded45f55fd9c 100644 --- a/src/libs/E2E/tests/openSearchPageTest.e2e.js +++ b/src/libs/E2E/tests/openSearchPageTest.e2e.js @@ -18,10 +18,12 @@ const test = () => { console.debug('[E2E] Logged in, getting search metrics and submitting them…'); Performance.subscribeToMeasurements((entry) => { + console.debug(`[E2E] Entry: ${entry}`); if (entry.name !== CONST.TIMING.SEARCH_RENDER) { return; } + console.debug(`[E2E] Submitting!`); E2EClient.submitTestResults({ name: 'Open Search Page TTI', duration: entry.duration, From 25af1459173556bef2f09ba0c8dc87db9e2fb707 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 16 Aug 2023 14:13:20 -0600 Subject: [PATCH 12/46] =?UTF-8?q?Fix=20logs=20=F0=9F=99=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libs/E2E/tests/openSearchPageTest.e2e.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/E2E/tests/openSearchPageTest.e2e.js b/src/libs/E2E/tests/openSearchPageTest.e2e.js index ded45f55fd9c..e96d70c95d94 100644 --- a/src/libs/E2E/tests/openSearchPageTest.e2e.js +++ b/src/libs/E2E/tests/openSearchPageTest.e2e.js @@ -18,7 +18,7 @@ const test = () => { console.debug('[E2E] Logged in, getting search metrics and submitting them…'); Performance.subscribeToMeasurements((entry) => { - console.debug(`[E2E] Entry: ${entry}`); + console.debug(`[E2E] Entry: ${JSON.stringify(entry)}`); if (entry.name !== CONST.TIMING.SEARCH_RENDER) { return; } From 028b384dce0f9888e0c20f4fd7a5cc1f6bd5586f Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 16 Aug 2023 15:48:21 -0600 Subject: [PATCH 13/46] Only navigate to search bar once sidebar is loaded --- src/libs/E2E/tests/openSearchPageTest.e2e.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libs/E2E/tests/openSearchPageTest.e2e.js b/src/libs/E2E/tests/openSearchPageTest.e2e.js index e96d70c95d94..3b2d91322cf0 100644 --- a/src/libs/E2E/tests/openSearchPageTest.e2e.js +++ b/src/libs/E2E/tests/openSearchPageTest.e2e.js @@ -18,6 +18,12 @@ const test = () => { console.debug('[E2E] Logged in, getting search metrics and submitting them…'); Performance.subscribeToMeasurements((entry) => { + if (entry.name === CONST.TIMING.SIDEBAR_LOADED) { + console.debug(`[E2E] Sidebar loaded, navigating to search route…`); + Navigation.navigate(ROUTES.SEARCH); + return; + } + console.debug(`[E2E] Entry: ${JSON.stringify(entry)}`); if (entry.name !== CONST.TIMING.SEARCH_RENDER) { return; @@ -36,8 +42,6 @@ const test = () => { console.debug('[E2E] Error while submitting test results:', err); }); }); - - Navigation.navigate(ROUTES.SEARCH); }); }; From 1dd186358d0779e3f81fd3da8c4650c119ddd882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 31 Aug 2023 10:20:27 +0200 Subject: [PATCH 14/46] point to correct .env file in build.gradle --- android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index f4dacff0324c..fad4658591dd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -58,7 +58,7 @@ project.ext.envConfigFiles = [ adhocRelease: ".env.adhoc", developmentRelease: ".env", developmentDebug: ".env", - e2eRelease: ".env.production" + e2eRelease: "tests/e2e/.env.e2e" ] /** From bc17ec74dc40c16db1551eeeae0ea05b819a4031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 12:40:08 +0200 Subject: [PATCH 15/46] fix e2e build locally --- android/app/build.gradle | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index fad4658591dd..4fe65dbc4e84 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -136,10 +136,20 @@ android { signingConfig signingConfigs.debug } release { - signingConfig signingConfigs.release productFlavors.production.signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + + signingConfig null + // buildTypes take precedence over productFlavors when it comes to the signing configuration, + // thus we need to manually set the signing config, so that the e2e uses the debug config again. + // In other words, the signingConfig setting above will be ignored when we build the flavor in release mode. + productFlavors.all { flavor -> + // All release builds should be signed with the release config ... + flavor.signingConfig signingConfigs.release + } + // ... except for the e2e flavor, which we maybe want to build locally: + productFlavors.e2e.signingConfig signingConfigs.debug } } From cdd8111cf6d3eb6427d0b00066d77c8932fc6112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 12:41:13 +0200 Subject: [PATCH 16/46] fix local e2e build paths --- tests/e2e/config.local.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/config.local.js b/tests/e2e/config.local.js index cd0b04d7c3cf..4187d3d2246f 100644 --- a/tests/e2e/config.local.js +++ b/tests/e2e/config.local.js @@ -2,7 +2,7 @@ module.exports = { WARM_UP_RUNS: 1, RUNS: 8, APP_PATHS: { - baseline: './android/app/build/outputs/apk/e2eRelease/app-e2eRelease.apk', - compare: './android/app/build/outputs/apk/e2eRelease/app-e2eRelease.apk', + baseline: './android/app/build/outputs/apk/release/app-e2e-release.apk', + compare: './android/app/build/outputs/apk/release/app-e2e-release.apk', }, }; From 9406c50da963850d55cf350aa3ff51fdc2566a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 12:44:16 +0200 Subject: [PATCH 17/46] fix lines being printed twice --- tests/e2e/utils/logger.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/e2e/utils/logger.js b/tests/e2e/utils/logger.js index aa198aec3004..1f2fff315bfc 100644 --- a/tests/e2e/utils/logger.js +++ b/tests/e2e/utils/logger.js @@ -61,19 +61,16 @@ const progressInfo = (textParam) => { }; const info = (...args) => { - console.debug('> ', ...args); - log(...args); + log('> ', ...args); }; const warn = (...args) => { const lines = [`\n${COLOR_YELLOW}⚠️`, ...args, `${COLOR_RESET}\n`]; - console.debug(...lines); log(...lines); }; const note = (...args) => { const lines = [`\n💡${COLOR_DIM}`, ...args, `${COLOR_RESET}\n`]; - console.debug(...lines); log(...lines); }; From 1b16f1d772062590e584f3415d17b5c119091a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 12:49:43 +0200 Subject: [PATCH 18/46] fix local app path --- tests/e2e/config.local.js | 4 ++-- tests/e2e/testRunner.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/config.local.js b/tests/e2e/config.local.js index 4187d3d2246f..7ce7cfea7462 100644 --- a/tests/e2e/config.local.js +++ b/tests/e2e/config.local.js @@ -2,7 +2,7 @@ module.exports = { WARM_UP_RUNS: 1, RUNS: 8, APP_PATHS: { - baseline: './android/app/build/outputs/apk/release/app-e2e-release.apk', - compare: './android/app/build/outputs/apk/release/app-e2e-release.apk', + baseline: './android/app/build/outputs/apk/e2e/release/app-e2e-release.apk', + compare: './android/app/build/outputs/apk/e2e/release/app-e2e-release.apk', }, }; diff --git a/tests/e2e/testRunner.js b/tests/e2e/testRunner.js index db421ae64ef1..401828065063 100644 --- a/tests/e2e/testRunner.js +++ b/tests/e2e/testRunner.js @@ -89,6 +89,8 @@ const runTestsOnBranch = async (baselineOrCompare, branch) => { const appExists = fs.existsSync(appPath); if (!appExists) { Logger.warn(`Build mode "${buildMode}" is not possible, because the app does not exist. Falling back to build mode "full".`); + Logger.note(`App path: ${appPath}`); + buildMode = 'full'; } } From 88ce3670d7c49e6d062a38532c59c83b8f649ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 12:54:15 +0200 Subject: [PATCH 19/46] set correct app package name --- tests/e2e/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/config.js b/tests/e2e/config.js index d322fb970b2d..d7844a29f3e4 100644 --- a/tests/e2e/config.js +++ b/tests/e2e/config.js @@ -21,7 +21,7 @@ const TEST_NAMES = { * ``` */ module.exports = { - APP_PACKAGE: 'com.expensify.chat', + APP_PACKAGE: 'com.expensify.chat.adhoc', APP_PATHS: { baseline: './app-e2eRelease-baseline.apk', From 282197bf79bc954f961335d0769ca644e273dbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 13:40:26 +0200 Subject: [PATCH 20/46] fix repackaging APK in e2e development mode --- .../android-repackage-app-bundle-and-sign.sh | 3 +- scripts/shellUtils.sh | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/scripts/android-repackage-app-bundle-and-sign.sh b/scripts/android-repackage-app-bundle-and-sign.sh index fe4ee1e4b8fc..1636edc21388 100755 --- a/scripts/android-repackage-app-bundle-and-sign.sh +++ b/scripts/android-repackage-app-bundle-and-sign.sh @@ -1,4 +1,5 @@ #!/bin/bash +source ./scripts/shellUtils.sh ### # Takes an android app that has been built with the debug keystore, @@ -41,7 +42,7 @@ if [ ! -f "$NEW_BUNDLE_FILE" ]; then echo "Bundle file not found: $NEW_BUNDLE_FILE" exit 1 fi -OUTPUT_APK=$(realpath "$OUTPUT_APK") +OUTPUT_APK=$(get_abs_path "$OUTPUT_APK") # check if "apktool" command is available if ! command -v apktool &> /dev/null then diff --git a/scripts/shellUtils.sh b/scripts/shellUtils.sh index 876933af9766..c6d21e9f14e1 100644 --- a/scripts/shellUtils.sh +++ b/scripts/shellUtils.sh @@ -41,3 +41,44 @@ function join_by_string { shift printf "%s" "$first" "${@/#/$separator}" } + +# Usage: get_abs_path +# Will make a path absolute, resolving any relative paths +# example: get_abs_path "./foo/bar" +get_abs_path() { + local the_path=$1 + local -a path_elements + IFS='/' read -ra path_elements <<< "$the_path" + + # If the path is already absolute, start with an empty string. + # We'll prepend the / later when reconstructing the path. + if [[ "$the_path" = /* ]]; then + abs_path="" + else + abs_path="$(pwd)" + fi + + # Handle each path element + for element in "${path_elements[@]}"; do + if [ "$element" = "." ] || [ -z "$element" ]; then + continue + elif [ "$element" = ".." ]; then + # Remove the last element from abs_path + abs_path=$(dirname "$abs_path") + else + # Append element to the absolute path + abs_path="${abs_path}/${element}" + fi + done + + # Remove any trailing '/' + abs_path=$(echo "$abs_path" | sed 's:/*$::') + + # Special case for root + [ -z "$abs_path" ] && abs_path="/" + + # Special case to remove any starting '//' when the input path was absolute + abs_path=$(echo "$abs_path" | sed 's:^//:/:') + + echo "$abs_path" +} From c3c32e47737af88c9fd958257ca36e80f2d8b7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 14:17:59 +0200 Subject: [PATCH 21/46] give more explanation --- tests/e2e/ADDING_TESTS.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/e2e/ADDING_TESTS.md b/tests/e2e/ADDING_TESTS.md index 39cdb97ebed0..f525c492b1f8 100644 --- a/tests/e2e/ADDING_TESTS.md +++ b/tests/e2e/ADDING_TESTS.md @@ -97,6 +97,5 @@ Done! When you now start the test runner, your new test will be executed as well ## Quickly test your test To check your new test you can simply run `npm run test:e2e`, which uses the -`--development` flag. This will run the tests on the branch you are currently on -and will do fewer iterations. +`--development` flag. This will run the tests on the branch you are currently on, runs fewer iterations and most importantly, it tries to reuse the existing APK and just patch into the new app bundle, instead of rebuilding the release app from scratch. From ff374296c248aadb94d694fc43897b2ab4d6cbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 14:21:30 +0200 Subject: [PATCH 22/46] explain debugging --- tests/e2e/ADDING_TESTS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/e2e/ADDING_TESTS.md b/tests/e2e/ADDING_TESTS.md index f525c492b1f8..566cf489e6a0 100644 --- a/tests/e2e/ADDING_TESTS.md +++ b/tests/e2e/ADDING_TESTS.md @@ -99,3 +99,8 @@ Done! When you now start the test runner, your new test will be executed as well To check your new test you can simply run `npm run test:e2e`, which uses the `--development` flag. This will run the tests on the branch you are currently on, runs fewer iterations and most importantly, it tries to reuse the existing APK and just patch into the new app bundle, instead of rebuilding the release app from scratch. +## Debugging your test + +You can use regular console statements to debug your test. The output will be visible +in logcat. I recommend opening the android studio logcat window and filter for `ReactNativeJS` to see the output you'd otherwise typically see in your metro bundler instance. + From 32940c469ec512f55530461beeabffcd434f094f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 15:00:32 +0200 Subject: [PATCH 23/46] Improve DX if any config is wrong --- src/libs/E2E/reactNativeLaunchingTest.js | 46 +++++++++++++++--------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/libs/E2E/reactNativeLaunchingTest.js b/src/libs/E2E/reactNativeLaunchingTest.js index 869f5d1f1f1a..f8bb59274b49 100644 --- a/src/libs/E2E/reactNativeLaunchingTest.js +++ b/src/libs/E2E/reactNativeLaunchingTest.js @@ -6,6 +6,7 @@ */ import Performance from '../Performance'; +import * as Metrics from '../Metrics'; // start the usual app Performance.markStart('regularAppStart'); @@ -19,6 +20,11 @@ console.debug('=========================='); console.debug('==== Running e2e test ===='); console.debug('=========================='); +// Check if the performance module is available +if (!Metrics.canCapturePerformanceMetrics()) { + throw new Error('Performance module not available! Please set CAPTURE_METRICS=true in your environment file!'); +} + // import your test here, define its name and config first in e2e/config.js const tests = { [E2EConfig.TEST_NAMES.AppStartTime]: require('./tests/appStartTimeTest.e2e').default, @@ -36,20 +42,28 @@ const appReady = new Promise((resolve) => { }); }); -E2EClient.getTestConfig().then((config) => { - const test = tests[config.name]; - if (!test) { - // instead of throwing, report the error to the server, which is better for DX - return E2EClient.submitTestResults({ - name: config.name, - error: `Test '${config.name}' not found`, - }); - } - console.debug(`[E2E] Configured for test ${config.name}. Waiting for app to become ready`); - - appReady.then(() => { - console.debug('[E2E] App is ready, running test…'); - Performance.measureFailSafe('appStartedToReady', 'regularAppStart'); - test(); +E2EClient.getTestConfig() + .then((config) => { + const test = tests[config.name]; + if (!test) { + // instead of throwing, report the error to the server, which is better for DX + return E2EClient.submitTestResults({ + name: config.name, + error: `Test '${config.name}' not found`, + }); + } + + console.debug(`[E2E] Configured for test ${config.name}. Waiting for app to become ready`); + appReady + .then(() => { + console.debug('[E2E] App is ready, running test…'); + Performance.measureFailSafe('appStartedToReady', 'regularAppStart'); + test(); + }) + .catch((error) => { + console.error('[E2E] Error while waiting for app to become ready', error); + }); + }) + .catch((error) => { + console.error("[E2E] Error while running test. Couldn't get test config!", error); }); -}); From bc114f9342ec082eccc8d964388280a54a292565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 17:53:12 +0200 Subject: [PATCH 24/46] move app loading to end --- src/libs/E2E/reactNativeLaunchingTest.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libs/E2E/reactNativeLaunchingTest.js b/src/libs/E2E/reactNativeLaunchingTest.js index f8bb59274b49..6836e9c6c296 100644 --- a/src/libs/E2E/reactNativeLaunchingTest.js +++ b/src/libs/E2E/reactNativeLaunchingTest.js @@ -8,11 +8,6 @@ import Performance from '../Performance'; import * as Metrics from '../Metrics'; -// start the usual app -Performance.markStart('regularAppStart'); -import '../../../index'; -Performance.markEnd('regularAppStart'); - import E2EConfig from '../../../tests/e2e/config'; import E2EClient from './client'; @@ -67,3 +62,8 @@ E2EClient.getTestConfig() .catch((error) => { console.error("[E2E] Error while running test. Couldn't get test config!", error); }); + +// start the usual app +Performance.markStart('regularAppStart'); +import '../../../appIndex'; +Performance.markEnd('regularAppStart'); From 37d93ffcce18bb2ecb88c51c12da65a0c75ffbea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 17:54:50 +0200 Subject: [PATCH 25/46] fix running tests in debug mode --- package.json | 2 +- tests/e2e/ADDING_TESTS.md | 49 ++++++++++++++++++++++++++++++++++- tests/e2e/config.local.js | 2 ++ tests/e2e/testRunner.js | 3 ++- tests/e2e/utils/installApp.js | 5 ++-- tests/e2e/utils/killApp.js | 4 +-- tests/e2e/utils/launchApp.js | 4 +-- 7 files changed, 60 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index e9358de7fd28..fd93d8817d54 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "analyze-packages": "ANALYZE_BUNDLE=true webpack --config config/webpack/webpack.common.js --env envFile=.env.production", "symbolicate:android": "npx metro-symbolicate android/app/build/generated/sourcemaps/react/release/index.android.bundle.map", "symbolicate:ios": "npx metro-symbolicate main.jsbundle.map", - "test:e2e": "node tests/e2e/testRunner.js --development" + "test:e2e": "node tests/e2e/testRunner.js" }, "dependencies": { "@expensify/react-native-web": "0.18.15", diff --git a/tests/e2e/ADDING_TESTS.md b/tests/e2e/ADDING_TESTS.md index 566cf489e6a0..7b1caa977a63 100644 --- a/tests/e2e/ADDING_TESTS.md +++ b/tests/e2e/ADDING_TESTS.md @@ -1,4 +1,51 @@ -# Add E2E Tests +# Adding new E2E Tests + +## Running your new test in development mode + +Typically you'd run all the tests with `npm run test:e2e` on your machine, +this will run the tests with some local settings, however that is not +optimal when you add a new test for which you want to quickly test if it works, as it +still runs the release version of the app. + +I recommend doing the following. + +> [!NOTE] +> All of the steps can be executed at once by running XXX (todo) + +1. Rename `./index.js` to `./appIndex.js` +2. Create a new `./index.js` with the following content: +```js +requrire("./src/libs/E2E/reactNativeLaunchingTest.js"); +``` +3. In `./src/libs/E2E/reactNativeLaunchingTest.js` change the main app import to the new `./appIndex.js` file: +```diff +- import '../../../index'; ++ import '../../../appIndex'; +``` + +> [!WARNING] +> Make sure to not commit these changes to the repository! + +Now you can start the metro bundler in e2e mode with: + +``` +CAPTURE_METRICS=TRUE E2E_Testing=true npm start -- --reset-cache +``` + +Then we can execute our test with: + +``` +npm run test:e2e -- --development --skipInstallDeps --buildMode skip --includes "My new test name" +``` + +> - `--development` will run the tests with a local config, which will run the tests with fewer iterations +> - `--skipInstallDeps` will skip the `npm install` step, which you probably don't need +> - `--buildMode skip` will skip rebuilding the app, and just run the existing app +> - `--includes "MyTestName"` will only run the test with the name "MyTestName" + + + +## Creating a new test Tests are executed on device, inside the app code. diff --git a/tests/e2e/config.local.js b/tests/e2e/config.local.js index 7ce7cfea7462..0c38c3f1056f 100644 --- a/tests/e2e/config.local.js +++ b/tests/e2e/config.local.js @@ -1,4 +1,6 @@ module.exports = { + APP_PACKAGE: 'com.expensify.chat.dev', + WARM_UP_RUNS: 1, RUNS: 8, APP_PATHS: { diff --git a/tests/e2e/testRunner.js b/tests/e2e/testRunner.js index 401828065063..57a550d87104 100644 --- a/tests/e2e/testRunner.js +++ b/tests/e2e/testRunner.js @@ -117,6 +117,7 @@ const runTestsOnBranch = async (baselineOrCompare, branch) => { const tempDir = `${config.OUTPUT_DIR}/temp`; const tempBundlePath = `${tempDir}/index.android.bundle`; await execAsync(`rm -rf ${tempDir} && mkdir ${tempDir}`); + // TODO: test if that breaks support for the env file await execAsync(`E2E_TESTING=true npx react-native bundle --platform android --dev false --entry-file ${config.ENTRY_FILE} --bundle-output ${tempBundlePath}`); // Repackage the existing native app with the new bundle @@ -127,7 +128,7 @@ const runTestsOnBranch = async (baselineOrCompare, branch) => { // Install app and reverse port let progressLog = Logger.progressInfo('Installing app and reversing port'); - await installApp('android', appPath); + await installApp('android', config.APP_PACKAGE, appPath); await reversePort(); progressLog.done(); diff --git a/tests/e2e/utils/installApp.js b/tests/e2e/utils/installApp.js index 136602375f85..ff961940826a 100644 --- a/tests/e2e/utils/installApp.js +++ b/tests/e2e/utils/installApp.js @@ -7,16 +7,17 @@ const Logger = require('./logger'); * It removes the app first if it already exists, so it's a clean installation. * * @param {String} platform + * @param {String} packageName * @param {String} path * @returns {Promise} */ -module.exports = function (platform = 'android', path) { +module.exports = function (platform = 'android', packageName = APP_PACKAGE, path) { if (platform !== 'android') { throw new Error(`installApp() missing implementation for platform: ${platform}`); } // Uninstall first, then install - return execAsync(`adb uninstall ${APP_PACKAGE}`) + return execAsync(`adb uninstall ${packageName}`) .catch((e) => { // Ignore errors Logger.warn('Failed to uninstall app:', e); diff --git a/tests/e2e/utils/killApp.js b/tests/e2e/utils/killApp.js index 9761ee7fc66e..bdef215bf752 100644 --- a/tests/e2e/utils/killApp.js +++ b/tests/e2e/utils/killApp.js @@ -1,11 +1,11 @@ const {APP_PACKAGE} = require('../config'); const execAsync = require('./execAsync'); -module.exports = function (platform = 'android') { +module.exports = function (platform = 'android', packageName = APP_PACKAGE) { if (platform !== 'android') { throw new Error(`killApp() missing implementation for platform: ${platform}`); } // Use adb to kill the app - return execAsync(`adb shell am force-stop ${APP_PACKAGE}`); + return execAsync(`adb shell am force-stop ${packageName}`); }; diff --git a/tests/e2e/utils/launchApp.js b/tests/e2e/utils/launchApp.js index dce17c7fbb3b..e0726d081086 100644 --- a/tests/e2e/utils/launchApp.js +++ b/tests/e2e/utils/launchApp.js @@ -1,11 +1,11 @@ const {APP_PACKAGE} = require('../config'); const execAsync = require('./execAsync'); -module.exports = function (platform = 'android') { +module.exports = function (platform = 'android', packageName = APP_PACKAGE) { if (platform !== 'android') { throw new Error(`launchApp() missing implementation for platform: ${platform}`); } // Use adb to start the app - return execAsync(`adb shell monkey -p ${APP_PACKAGE} -c android.intent.category.LAUNCHER 1`); + return execAsync(`adb shell monkey -p ${packageName} -c android.intent.category.LAUNCHER 1`); }; From 232a2e2c25d62196e61d83d1b653908fbf9cc8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 18:03:15 +0200 Subject: [PATCH 26/46] fix tests --- src/libs/E2E/API.mock.js | 1 + tests/e2e/config.local.js | 6 ++++-- tests/e2e/testRunner.js | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libs/E2E/API.mock.js b/src/libs/E2E/API.mock.js index 501108025979..47f445f72222 100644 --- a/src/libs/E2E/API.mock.js +++ b/src/libs/E2E/API.mock.js @@ -19,6 +19,7 @@ const mocks = { BeginSignIn: mockBeginSignin, SigninUser: mockSigninUser, OpenApp: mockOpenApp, + ReconnectApp: mockOpenApp, OpenReport: mockOpenReport, AuthenticatePusher: mockAuthenticatePusher, }; diff --git a/tests/e2e/config.local.js b/tests/e2e/config.local.js index 0c38c3f1056f..97ccdc91312b 100644 --- a/tests/e2e/config.local.js +++ b/tests/e2e/config.local.js @@ -4,7 +4,9 @@ module.exports = { WARM_UP_RUNS: 1, RUNS: 8, APP_PATHS: { - baseline: './android/app/build/outputs/apk/e2e/release/app-e2e-release.apk', - compare: './android/app/build/outputs/apk/e2e/release/app-e2e-release.apk', + // baseline: './android/app/build/outputs/apk/e2e/release/app-e2e-release.apk', + baseline: './android/app/build/outputs/apk/development/debug/app-development-debug.apk', + // compare: './android/app/build/outputs/apk/e2e/release/app-e2e-release.apk', + compare: './android/app/build/outputs/apk/development/debug/app-development-debug.apk', }, }; diff --git a/tests/e2e/testRunner.js b/tests/e2e/testRunner.js index 57a550d87104..d945f693ea25 100644 --- a/tests/e2e/testRunner.js +++ b/tests/e2e/testRunner.js @@ -73,9 +73,9 @@ if (isDevMode) { const restartApp = async () => { Logger.log('Killing app …'); - await killApp('android'); + await killApp('android', config.APP_PACKAGE); Logger.log('Launching app …'); - await launchApp('android'); + await launchApp('android', config.APP_PACKAGE); }; const runTestsOnBranch = async (baselineOrCompare, branch) => { From ea62c3c6550973728f3ade10a70aeeac098f9340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 1 Sep 2023 18:05:44 +0200 Subject: [PATCH 27/46] add development flag back --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fd93d8817d54..e9358de7fd28 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "analyze-packages": "ANALYZE_BUNDLE=true webpack --config config/webpack/webpack.common.js --env envFile=.env.production", "symbolicate:android": "npx metro-symbolicate android/app/build/generated/sourcemaps/react/release/index.android.bundle.map", "symbolicate:ios": "npx metro-symbolicate main.jsbundle.map", - "test:e2e": "node tests/e2e/testRunner.js" + "test:e2e": "node tests/e2e/testRunner.js --development" }, "dependencies": { "@expensify/react-native-web": "0.18.15", From f9144ed064807b0d5945c93d4b4bb45150352678 Mon Sep 17 00:00:00 2001 From: Oscar Franco Date: Tue, 12 Sep 2023 15:38:44 +0200 Subject: [PATCH 28/46] Fix main index import --- src/libs/E2E/reactNativeLaunchingTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/E2E/reactNativeLaunchingTest.js b/src/libs/E2E/reactNativeLaunchingTest.js index 6836e9c6c296..13183c1044db 100644 --- a/src/libs/E2E/reactNativeLaunchingTest.js +++ b/src/libs/E2E/reactNativeLaunchingTest.js @@ -65,5 +65,5 @@ E2EClient.getTestConfig() // start the usual app Performance.markStart('regularAppStart'); -import '../../../appIndex'; +import '../../../index'; Performance.markEnd('regularAppStart'); From b9df62987ccdd8047624fd49ba4104e6ff0267a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 19 Sep 2023 13:31:23 +0200 Subject: [PATCH 29/46] fix shell script --- scripts/shellUtils.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/shellUtils.sh b/scripts/shellUtils.sh index c6d21e9f14e1..4c9e2febc34d 100644 --- a/scripts/shellUtils.sh +++ b/scripts/shellUtils.sh @@ -72,13 +72,15 @@ get_abs_path() { done # Remove any trailing '/' - abs_path=$(echo "$abs_path" | sed 's:/*$::') + while [[ $abs_path == */ ]]; do + abs_path=${abs_path%/} + done # Special case for root [ -z "$abs_path" ] && abs_path="/" # Special case to remove any starting '//' when the input path was absolute - abs_path=$(echo "$abs_path" | sed 's:^//:/:') + abs_path=${abs_path/#\/\//\/} echo "$abs_path" -} +} \ No newline at end of file From f5f11759e957d0fbc73fa5d131d693b115a4d13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 21 Sep 2023 09:36:28 +0200 Subject: [PATCH 30/46] add baseline building back + fix app path --- .../composite/buildAndroidAPK/action.yml | 4 +- .github/workflows/e2ePerformanceTests.yml | 55 +++++++++++++++++-- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml index 819234df0bc3..fc280ab2a223 100644 --- a/.github/actions/composite/buildAndroidAPK/action.yml +++ b/.github/actions/composite/buildAndroidAPK/action.yml @@ -13,7 +13,7 @@ runs: - uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7 with: - ruby-version: '2.7' + ruby-version: "2.7" bundler-cache: true - uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef @@ -26,4 +26,4 @@ runs: uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05 with: name: ${{ inputs.ARTIFACT_NAME }} - path: android/app/build/outputs/apk/e2eRelease/app-e2eRelease.apk + path: android/app/build/outputs/apk/e2e/release/app-e2e-release.apk diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 35612eadbbae..10ca2420ed9d 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -16,6 +16,45 @@ on: required: true jobs: + buildBaseline: + runs-on: ubuntu-latest-xl + name: Build apk from latest release as a baseline + outputs: + VERSION: ${{ steps.getMostRecentRelease.outputs.VERSION }} + steps: + - uses: actions/checkout@v3 + + - name: Get most recent release version + id: getMostRecentRelease + run: echo "VERSION=$(gh release list --limit 1 | awk '{ print $1 }')" >> "$GITHUB_OUTPUT" + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Check if there's an existing artifact for this baseline + id: checkForExistingArtifact + uses: xSAVIKx/artifact-exists-action@3c5206b1411c0d2fc0840f56b7140646933d9d6a + with: + name: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} + + - name: Skip build if there's already an existing artifact for the baseline + if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.exists) }} + run: echo 'APK for baseline ${{ steps.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' + + - name: Checkout "Baseline" commit (last release) + if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} + run: | + git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 + git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} + + - name: Configure MapBox SDK + run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + + - name: Build APK + if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} + uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main + with: + ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} + buildDelta: runs-on: ubuntu-latest-xl name: Build apk from delta ref @@ -89,6 +128,17 @@ jobs: - name: Make zip directory for everything to send to AWS Device Farm run: mkdir zip + - name: Download baseline APK + uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b + id: downloadBaselineAPK + with: + name: baseline-apk-${{ needs.buildBaseline.outputs.VERSION }} + path: zip + + # The downloaded artifact will be a file named "app-e2e-release.apk" so we have to rename it + - name: Rename baseline APK + run: mv "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2e-release.apk" "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2eRelease-baseline.apk" + - name: Download delta APK uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b id: downloadDeltaAPK @@ -97,10 +147,7 @@ jobs: path: zip - name: Rename delta APK - run: mv "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease.apk" "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease-compare.apk" - - - name: Copy Delta APK as compare for testing - run: mv "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease-compare.apk" "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease-baseline.apk" + run: mv "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2e-release.apk" "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease-compare.apk" - name: Copy e2e code into zip folder run: cp -r tests/e2e zip From 475d75ce4a8e08598c3f7820cd9fe015c35eb158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 21 Sep 2023 09:48:28 +0200 Subject: [PATCH 31/46] aws job depend on buildBaseline --- .github/workflows/e2ePerformanceTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 10ca2420ed9d..bf30cc3ce213 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -120,7 +120,7 @@ jobs: runTestsInAWS: runs-on: ubuntu-latest - needs: [buildDelta] + needs: [buildBaseline, buildDelta] name: Run E2E tests in AWS device farm steps: - uses: actions/checkout@v3 From ca47840818c82d39a49d7edcf2a51b691070dafe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 21 Sep 2023 10:14:50 +0200 Subject: [PATCH 32/46] --allow-unrelated-histories --- .github/workflows/e2ePerformanceTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index bf30cc3ce213..f7f1e5fc7ac7 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -96,7 +96,7 @@ jobs: if: ${{ !fromJSON(steps.getPullRequestDetails.outputs.IS_MERGED) }} id: getMergeCommitShaIfUnmergedPR run: | - git merge --no-commit ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} + git merge --allow-unrelated-histories --no-commit ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} git checkout ${{ steps.getPullRequestDetails.outputs.HEAD_COMMIT_SHA }} env: GITHUB_TOKEN: ${{ github.token }} From d646cdfb1780eb57eb0753ca2cfd493facd08a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 21 Sep 2023 10:37:07 +0200 Subject: [PATCH 33/46] use absolute path to entry file --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index dac53193fdc6..b1babadd8f6b 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"] = File.expand_path("../src/libs/E2E/reactNativeLaunchingTest.js", Dir.pwd) ENV["E2E_TESTING"]="true" gradle( From 1daca9d5d311ad8253ab2e226dbad1d7609fed06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 21 Sep 2023 12:04:31 +0200 Subject: [PATCH 34/46] dev: check for file --- fastlane/Fastfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b1babadd8f6b..3e11d57a9529 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -20,6 +20,13 @@ platform :android do ENV["ENTRY_FILE"] = File.expand_path("../src/libs/E2E/reactNativeLaunchingTest.js", Dir.pwd) ENV["E2E_TESTING"]="true" + # Test if the entry file exists, otherwise fail early. If its there, log that we are good to proceed + if !File.file?(ENV["ENTRY_FILE"]) + UI.user_error!("E2E entry file not found at #{ENV["ENTRY_FILE"]}") + else + UI.success("E2E entry file found at #{ENV["ENTRY_FILE"]}") + end + gradle( project_dir: './android', task: ':app:assemble', From 3b31e1e43d4a16a2928a4358a7ef0dbb3e0ec2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 21 Sep 2023 12:14:10 +0200 Subject: [PATCH 35/46] dev: are the files there? --- .github/workflows/e2ePerformanceTests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index f7f1e5fc7ac7..4d6c92a63389 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -113,6 +113,12 @@ jobs: - name: Configure MapBox SDK run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + - name: List files + run: ls -la + + - name: List files src/ + run: ls -la src/ + - name: Build APK uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main with: From c0794bd8df65871d7fde7f0b507ea8e329065a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Thu, 21 Sep 2023 12:22:13 +0200 Subject: [PATCH 36/46] invoke command manually --- .github/actions/composite/buildAndroidAPK/action.yml | 2 +- .github/workflows/e2ePerformanceTests.yml | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml index fc280ab2a223..8cc88e7af679 100644 --- a/.github/actions/composite/buildAndroidAPK/action.yml +++ b/.github/actions/composite/buildAndroidAPK/action.yml @@ -19,7 +19,7 @@ runs: - uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef - name: Build APK - run: npm run android-build-e2e + run: cd android && ENTRY_FILE="../src/libs/E2E/reactNativeLaunchingTest.js" ENVFILE="../tests/e2e/.env.e2e" E2E_TESTING=true ./gradlew :app:assembleE2eRelease shell: bash - name: Upload APK diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 4d6c92a63389..f7f1e5fc7ac7 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -113,12 +113,6 @@ jobs: - name: Configure MapBox SDK run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - - name: List files - run: ls -la - - - name: List files src/ - run: ls -la src/ - - name: Build APK uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main with: From 25d9c0a46439f39695b472c62f5796c22eb758cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 22 Sep 2023 12:32:24 +0200 Subject: [PATCH 37/46] revert change --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 3e11d57a9529..332a54aa14f7 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"] = File.expand_path("../src/libs/E2E/reactNativeLaunchingTest.js", Dir.pwd) + ENV["ENTRY_FILE"]="src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" # Test if the entry file exists, otherwise fail early. If its there, log that we are good to proceed From 8e25f3dbdca6097a7d231ffeb90f54b3646e2665 Mon Sep 17 00:00:00 2001 From: Oscar Franco Date: Fri, 22 Sep 2023 12:46:57 +0200 Subject: [PATCH 38/46] Test a different path for entry file --- fastlane/Fastfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 332a54aa14f7..eced35198c95 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,11 +17,11 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"]="../src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" # Test if the entry file exists, otherwise fail early. If its there, log that we are good to proceed - if !File.file?(ENV["ENTRY_FILE"]) + if !File.exists?(ENV["ENTRY_FILE"]) UI.user_error!("E2E entry file not found at #{ENV["ENTRY_FILE"]}") else UI.success("E2E entry file found at #{ENV["ENTRY_FILE"]}") From 86d74905d3d44eb536f01fca811419fb843e28d0 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Mon, 25 Sep 2023 12:59:05 +0800 Subject: [PATCH 39/46] Add tmate --- .github/workflows/e2ePerformanceTests.yml | 10 ++++++++++ fastlane/Fastfile | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index f7f1e5fc7ac7..791c2e8ff075 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -49,6 +49,11 @@ jobs: - name: Configure MapBox SDK run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + - name: Build APK if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main @@ -113,6 +118,11 @@ jobs: - name: Configure MapBox SDK run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + - name: Build APK uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main with: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index eced35198c95..8dd4875db833 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="../src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"]="/src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" # Test if the entry file exists, otherwise fail early. If its there, log that we are good to proceed From 905b1806722eba78f9bf7f50a9871e444118778d Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Mon, 25 Sep 2023 13:15:31 +0800 Subject: [PATCH 40/46] Adjust tests --- .../composite/buildAndroidAPK/action.yml | 2 +- .github/workflows/e2ePerformanceTests.yml | 22 ++++++++++--------- fastlane/Fastfile | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml index 8cc88e7af679..fc280ab2a223 100644 --- a/.github/actions/composite/buildAndroidAPK/action.yml +++ b/.github/actions/composite/buildAndroidAPK/action.yml @@ -19,7 +19,7 @@ runs: - uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef - name: Build APK - run: cd android && ENTRY_FILE="../src/libs/E2E/reactNativeLaunchingTest.js" ENVFILE="../tests/e2e/.env.e2e" E2E_TESTING=true ./gradlew :app:assembleE2eRelease + run: npm run android-build-e2e shell: bash - name: Upload APK diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 791c2e8ff075..5dbef071c720 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -49,17 +49,18 @@ jobs: - name: Configure MapBox SDK run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - - name: Build APK if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main with: ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + buildDelta: runs-on: ubuntu-latest-xl name: Build apk from delta ref @@ -118,16 +119,17 @@ jobs: - name: Configure MapBox SDK run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - - name: Build APK uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main with: ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }} + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + runTestsInAWS: runs-on: ubuntu-latest needs: [buildBaseline, buildDelta] diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 8dd4875db833..a5e4245269a8 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="/src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"]="src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" # Test if the entry file exists, otherwise fail early. If its there, log that we are good to proceed From e9038576d89105783abfb9c68a84b5868e126cf3 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Mon, 25 Sep 2023 13:40:48 +0800 Subject: [PATCH 41/46] Remove tmate, adjust file path --- .github/workflows/e2ePerformanceTests.yml | 12 ------------ fastlane/Fastfile | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 5dbef071c720..f7f1e5fc7ac7 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -55,12 +55,6 @@ jobs: with: ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - buildDelta: runs-on: ubuntu-latest-xl name: Build apk from delta ref @@ -124,12 +118,6 @@ jobs: with: ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }} - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - runTestsInAWS: runs-on: ubuntu-latest needs: [buildBaseline, buildDelta] diff --git a/fastlane/Fastfile b/fastlane/Fastfile index a5e4245269a8..eced35198c95 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,7 +17,7 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"]="../src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" # Test if the entry file exists, otherwise fail early. If its there, log that we are good to proceed From 7f8fc198028b08bbf90c8b9c8fb2643ce60a0bea Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Mon, 25 Sep 2023 14:16:25 +0800 Subject: [PATCH 42/46] Add more debugging --- fastlane/Fastfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index eced35198c95..9926f60d9cae 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,11 +17,12 @@ platform :android do desc "Generate a new local APK for e2e testing" lane :build_e2e do ENV["ENVFILE"]="tests/e2e/.env.e2e" - ENV["ENTRY_FILE"]="../src/libs/E2E/reactNativeLaunchingTest.js" + ENV["ENTRY_FILE"]="src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" - # Test if the entry file exists, otherwise fail early. If its there, log that we are good to proceed - if !File.exists?(ENV["ENTRY_FILE"]) + UI.success("Building E2E APK #{ENV["ENTRY_FILE"]}") + + if !File.exist?(ENV["ENTRY_FILE"]) UI.user_error!("E2E entry file not found at #{ENV["ENTRY_FILE"]}") else UI.success("E2E entry file found at #{ENV["ENTRY_FILE"]}") From e3bc7ad37df31422b7c405a3fc60a0acfbea25d3 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Mon, 25 Sep 2023 14:17:28 +0800 Subject: [PATCH 43/46] Add tmate back in --- .github/workflows/e2ePerformanceTests.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index f7f1e5fc7ac7..5dbef071c720 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -55,6 +55,12 @@ jobs: with: ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + buildDelta: runs-on: ubuntu-latest-xl name: Build apk from delta ref @@ -118,6 +124,12 @@ jobs: with: ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }} + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + runTestsInAWS: runs-on: ubuntu-latest needs: [buildBaseline, buildDelta] From c18e19bda3421bf16a41bff7dbffada3c704d935 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Mon, 25 Sep 2023 15:03:15 +0800 Subject: [PATCH 44/46] Remove file check --- fastlane/Fastfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 9926f60d9cae..dac53193fdc6 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -20,14 +20,6 @@ platform :android do ENV["ENTRY_FILE"]="src/libs/E2E/reactNativeLaunchingTest.js" ENV["E2E_TESTING"]="true" - UI.success("Building E2E APK #{ENV["ENTRY_FILE"]}") - - if !File.exist?(ENV["ENTRY_FILE"]) - UI.user_error!("E2E entry file not found at #{ENV["ENTRY_FILE"]}") - else - UI.success("E2E entry file found at #{ENV["ENTRY_FILE"]}") - end - gradle( project_dir: './android', task: ':app:assemble', From 50f6401e0a6004e539280809bfc48ea25a65a9c1 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Mon, 25 Sep 2023 15:34:41 +0800 Subject: [PATCH 45/46] Checkout test branch --- .github/workflows/e2ePerformanceTests.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 5dbef071c720..587cba13ebe6 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -43,8 +43,13 @@ jobs: - name: Checkout "Baseline" commit (last release) if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} run: | - git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 - git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} + git fetch origin andrew-fix-e2e-fork + git checkout andrew-fix-e2e-fork + +# TODO: Uncomment before merging +# run: | +# git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 +# git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} - name: Configure MapBox SDK run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} From c5774514f4cf8ee8bb647226ca9af62b92f3777d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 25 Sep 2023 11:43:37 +0200 Subject: [PATCH 46/46] TESTING: build action from branch --- .github/workflows/e2ePerformanceTests.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 587cba13ebe6..b84ac6a77e54 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -46,17 +46,19 @@ jobs: git fetch origin andrew-fix-e2e-fork git checkout andrew-fix-e2e-fork -# TODO: Uncomment before merging -# run: | -# git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 -# git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} + # TODO: Uncomment before merging + # run: | + # git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 + # git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} - name: Configure MapBox SDK run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - name: Build APK if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} - uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main + # TODO: Change back before merging: + #uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main + uses: Expensify/App/.github/actions/composite/buildAndroidAPK@andrew-fix-e2e-fork with: ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} @@ -125,7 +127,9 @@ jobs: run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - name: Build APK - uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main + # TODO: Change back before merging: + #uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main + uses: Expensify/App/.github/actions/composite/buildAndroidAPK@andrew-fix-e2e-fork with: ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }}