From 21e6ae31dcc00cfb0558bd0480f01530dbe2f26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 8 Dec 2023 11:53:20 +0100 Subject: [PATCH] dev: fix e2e test running in dev mode --- package.json | 1 + tests/e2e/config.dev.js | 9 +++++++-- tests/e2e/testRunner.js | 19 +++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 3491b9ed0293..db0e0c15a3f2 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "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 --skipCheckout --skipInstallDeps --buildMode none", + "test:e2e:dev": "node tests/e2e/testRunner.js --development --skipCheckout --config ./config.dev.js --buildMode skip --skipInstallDeps", "gh-actions-unused-styles": "./.github/scripts/findUnusedKeys.sh", "workflow-test": "./workflow_tests/scripts/runWorkflowTests.sh", "workflow-test:generate": "node workflow_tests/utils/preGenerateTest.js", diff --git a/tests/e2e/config.dev.js b/tests/e2e/config.dev.js index 46191ebdee48..894b4737c36f 100644 --- a/tests/e2e/config.dev.js +++ b/tests/e2e/config.dev.js @@ -1,5 +1,10 @@ +const packageName = 'com.expensify.chat.dev'; +const appPath = './android/app/build/outputs/apk/development/debug/app-development-debug.apk'; + module.exports = { - APP_PACKAGE: 'com.expensify.chat.dev', - APP_PATH: './android/app/build/outputs/apk/development/debug/app-development-debug.apk', + MAIN_APP_PACKAGE: packageName, + DELTA_APP_PACKAGE: packageName, + MAIN_APP_PATH: appPath, + DELTA_APP_PATH: appPath, RUNS: 8, }; diff --git a/tests/e2e/testRunner.js b/tests/e2e/testRunner.js index 1cedbf1abd76..880e8641dd6f 100644 --- a/tests/e2e/testRunner.js +++ b/tests/e2e/testRunner.js @@ -30,15 +30,22 @@ const compare = require('./compare/compare'); // VARIABLE CONFIGURATION const args = process.argv.slice(2); +const getArg = (argName) => { + const argIndex = args.indexOf(argName); + if (argIndex === -1) { + return undefined; + } + return args[argIndex + 1]; +}; let branch = 'main'; if (args.includes('--branch')) { - branch = args[args.indexOf('--branch') + 1]; + branch = getArg('--branch'); } let label = branch; if (args.includes('--label')) { - label = args[args.indexOf('--label') + 1]; + label = getArg('--label'); } let config = defaultConfig; @@ -71,17 +78,17 @@ if (isDevMode) { } if (args.includes('--buildMode')) { - buildMode = args[args.indexOf('--buildMode') + 1]; + buildMode = getArg('--buildMode'); } if (args.includes('--config')) { - const configPath = args[args.indexOf('--config') + 1]; + const configPath = getArg('--config'); setConfigPath(configPath); } // Important set app path after correct config file has been set -let mainAppPath = args[args.indexOf('--mainAppPath') + 1] || config.MAIN_APP_PATH; -let deltaAppPath = args[args.indexOf('--deltaAppPath') + 1] || config.DELTA_APP_PATH; +let mainAppPath = getArg('--mainAppPath') || config.MAIN_APP_PATH; +let deltaAppPath = getArg('--deltaAppPath') || config.DELTA_APP_PATH; // Create some variables after the correct config file has been loaded const OUTPUT_FILE = `${config.OUTPUT_DIR}/${label}.json`;