From 1a281329cf35e34fb366a6eccd5d1cdbd4fcebd1 Mon Sep 17 00:00:00 2001 From: ruben-rebelo Date: Wed, 14 Feb 2024 09:44:47 +0000 Subject: [PATCH 1/3] [TS migration] Migrate killApp from E2E to typescript --- tests/e2e/utils/killApp.js | 11 ----------- tests/e2e/utils/killApp.ts | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 tests/e2e/utils/killApp.js create mode 100644 tests/e2e/utils/killApp.ts diff --git a/tests/e2e/utils/killApp.js b/tests/e2e/utils/killApp.js deleted file mode 100644 index bdef215bf752..000000000000 --- a/tests/e2e/utils/killApp.js +++ /dev/null @@ -1,11 +0,0 @@ -const {APP_PACKAGE} = require('../config'); -const execAsync = require('./execAsync'); - -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 ${packageName}`); -}; diff --git a/tests/e2e/utils/killApp.ts b/tests/e2e/utils/killApp.ts new file mode 100644 index 000000000000..a39e390c5908 --- /dev/null +++ b/tests/e2e/utils/killApp.ts @@ -0,0 +1,15 @@ +import {MAIN_APP_PACKAGE} from '../config'; +import execAsync from './execAsync'; + +type KillApp = (platform: string, packageName: string) => Promise; + +const killApp: KillApp = function (platform = 'android', packageName = MAIN_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 ${packageName}`); +}; + +export default killApp; From 7ba8bee237734b78596121a049928e1f0257be24 Mon Sep 17 00:00:00 2001 From: ruben-rebelo Date: Tue, 20 Feb 2024 15:59:22 +0000 Subject: [PATCH 2/3] [TS migration][killApp] Updated types --- tests/e2e/utils/killApp.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/e2e/utils/killApp.ts b/tests/e2e/utils/killApp.ts index a39e390c5908..bab2c02f0e59 100644 --- a/tests/e2e/utils/killApp.ts +++ b/tests/e2e/utils/killApp.ts @@ -1,9 +1,7 @@ import {MAIN_APP_PACKAGE} from '../config'; import execAsync from './execAsync'; -type KillApp = (platform: string, packageName: string) => Promise; - -const killApp: KillApp = function (platform = 'android', packageName = MAIN_APP_PACKAGE) { +const killApp = function (platform = 'android', packageName = MAIN_APP_PACKAGE): Promise { if (platform !== 'android') { throw new Error(`killApp() missing implementation for platform: ${platform}`); } From 15c8165639263bb56083f53073169fb1b675592c Mon Sep 17 00:00:00 2001 From: ruben-rebelo Date: Tue, 20 Feb 2024 16:04:34 +0000 Subject: [PATCH 3/3] [TS migration][killApp] Fixed config import --- tests/e2e/utils/killApp.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/utils/killApp.ts b/tests/e2e/utils/killApp.ts index bab2c02f0e59..889f345cf222 100644 --- a/tests/e2e/utils/killApp.ts +++ b/tests/e2e/utils/killApp.ts @@ -1,7 +1,7 @@ -import {MAIN_APP_PACKAGE} from '../config'; +import config from '../config'; import execAsync from './execAsync'; -const killApp = function (platform = 'android', packageName = MAIN_APP_PACKAGE): Promise { +const killApp = function (platform = 'android', packageName = config.MAIN_APP_PACKAGE): Promise { if (platform !== 'android') { throw new Error(`killApp() missing implementation for platform: ${platform}`); }