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

[No QA] e2e fix dev run #55004

Merged
merged 2 commits into from
Jan 14, 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
3 changes: 2 additions & 1 deletion tests/e2e/config.dev.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {Config} from './config.local';

const packageName = 'com.expensify.chat.dev';
const appPath = './android/app/build/outputs/apk/development/debug/app-development-debug.apk';
const appPath = './android/app/build/intermediates/apk/development/debug/app-development-debug.apk';

const config: Config = {
MAIN_APP_PACKAGE: packageName,
Expand All @@ -12,6 +12,7 @@ const config: Config = {
DELTA_APP_PATH: appPath,
RUNS: 8,
BOOT_COOL_DOWN: 5 * 1000,
FLAG: '-t',
};

export default config;
1 change: 1 addition & 0 deletions tests/e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default {

MAIN_APP_PATH: './app-e2eRelease.apk',
DELTA_APP_PATH: './app-e2edeltaRelease.apk',
FLAG: '',

BRANCH_MAIN: 'main',
BRANCH_DELTA: 'delta',
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ try {
// START OF TEST CODE
const runTests = async (): Promise<void> => {
Logger.info('Installing apps and reversing port');
await installApp(config.MAIN_APP_PACKAGE, mainAppPath);
await installApp(config.DELTA_APP_PACKAGE, deltaAppPath);
await installApp(config.MAIN_APP_PACKAGE, mainAppPath, undefined, defaultConfig.FLAG);
await installApp(config.DELTA_APP_PACKAGE, deltaAppPath, undefined, defaultConfig.FLAG);
await reversePort();

// Start the HTTP server
Expand Down Expand Up @@ -241,8 +241,8 @@ const runTests = async (): Promise<void> => {
const test = Object.values(config.TESTS_CONFIG).at(testIndex);

// re-instal app for each new test suite
await installApp(config.MAIN_APP_PACKAGE, mainAppPath);
await installApp(config.DELTA_APP_PACKAGE, deltaAppPath);
await installApp(config.MAIN_APP_PACKAGE, mainAppPath, undefined, defaultConfig.FLAG);
await installApp(config.DELTA_APP_PACKAGE, deltaAppPath, undefined, defaultConfig.FLAG);

// check if we want to skip the test
if (args.includes('--includes')) {
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/utils/installApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import * as Logger from './logger';
* Installs the app on the currently connected device for the given platform.
* It removes the app first if it already exists, so it's a clean installation.
*/
export default function (packageName: string, path: string, platform = 'android'): PromiseWithAbort {
export default function (packageName: string, path: string, platform = 'android', flag = ''): PromiseWithAbort {
if (platform !== 'android') {
throw new Error(`installApp() missing implementation for platform: ${platform}`);
}

const installCommand = flag ? `adb install ${flag}` : 'adb install';

// Uninstall first, then install
return (
execAsync(`adb uninstall ${packageName}`)
Expand All @@ -23,7 +25,7 @@ export default function (packageName: string, path: string, platform = 'android'
// eslint-disable-next-line @typescript-eslint/no-misused-promises
.finally(() =>
// install the app
execAsync(`adb install ${path}`).then(() =>
execAsync(`${installCommand} ${path}`).then(() =>
// and grant push notifications permissions right away (the popup may block e2e tests sometimes)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
execAsync(`adb shell pm grant ${packageName.split('/').at(0)} android.permission.POST_NOTIFICATIONS`).catch((_: ExecException) =>
Expand Down
Loading