Skip to content

Commit

Permalink
Merge pull request #32713 from margelo/dev/fix-e2e-test-dev-mode
Browse files Browse the repository at this point in the history
[NoQA] dev: fix e2e test running in dev mode
  • Loading branch information
mountiny authored Dec 8, 2023
2 parents 18d4b9b + 21e6ae3 commit 2b52100
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 7 additions & 2 deletions tests/e2e/config.dev.js
Original file line number Diff line number Diff line change
@@ -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,
};
19 changes: 13 additions & 6 deletions tests/e2e/testRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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`;
Expand Down

0 comments on commit 2b52100

Please sign in to comment.