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

[TS migration] Migrate killApp from E2E to typescript #36466

Merged
merged 4 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 0 additions & 11 deletions tests/e2e/utils/killApp.js

This file was deleted.

15 changes: 15 additions & 0 deletions tests/e2e/utils/killApp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {MAIN_APP_PACKAGE} from '../config';
import execAsync from './execAsync';

type KillApp = (platform: string, packageName: string) => Promise<void>;

const killApp: KillApp = function (platform = 'android', packageName = MAIN_APP_PACKAGE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?

Suggested change
type KillApp = (platform: string, packageName: string) => Promise<void>;
const killApp: KillApp = function (platform = 'android', packageName = MAIN_APP_PACKAGE) {
function killApp(platform = 'android', packageName = MAIN_APP_PACKAGE): Promise<void> {

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;
Loading