diff --git a/tests/e2e/testRunner.js b/tests/e2e/testRunner.js index 77b2033dfece..35d653a1bd79 100644 --- a/tests/e2e/testRunner.js +++ b/tests/e2e/testRunner.js @@ -79,8 +79,8 @@ try { const runTests = async () => { Logger.info('Installing apps and reversing port'); - await installApp('android', config.MAIN_APP_PACKAGE, mainAppPath); - await installApp('android', config.DELTA_APP_PACKAGE, deltaAppPath); + await installApp(config.MAIN_APP_PACKAGE, mainAppPath); + await installApp(config.DELTA_APP_PACKAGE, deltaAppPath); await reversePort(); // Start the HTTP server diff --git a/tests/e2e/utils/installApp.js b/tests/e2e/utils/installApp.js deleted file mode 100644 index 31dc205ecda1..000000000000 --- a/tests/e2e/utils/installApp.js +++ /dev/null @@ -1,26 +0,0 @@ -import execAsync from './execAsync'; -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. - * - * @param {String} platform - * @param {String} packageName - * @param {String} path - * @returns {Promise} - */ -// eslint-disable-next-line default-param-last -export default function (platform = 'android', packageName, path) { - if (platform !== 'android') { - throw new Error(`installApp() missing implementation for platform: ${platform}`); - } - - // Uninstall first, then install - return execAsync(`adb uninstall ${packageName}`) - .catch((e) => { - // Ignore errors - Logger.warn('Failed to uninstall app:', e); - }) - .finally(() => execAsync(`adb install ${path}`)); -} diff --git a/tests/e2e/utils/installApp.ts b/tests/e2e/utils/installApp.ts new file mode 100644 index 000000000000..b443344e6f02 --- /dev/null +++ b/tests/e2e/utils/installApp.ts @@ -0,0 +1,25 @@ +import type {ExecException} from 'child_process'; +import execAsync from './execAsync'; +import type {PromiseWithAbort} from './execAsync'; +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 { + if (platform !== 'android') { + throw new Error(`installApp() missing implementation for platform: ${platform}`); + } + + // Uninstall first, then install + return ( + execAsync(`adb uninstall ${packageName}`) + .catch((error: ExecException) => { + // Ignore errors + Logger.warn('Failed to uninstall app:', error); + }) + // eslint-disable-next-line @typescript-eslint/no-misused-promises + .finally(() => execAsync(`adb install ${path}`)) + ); +}