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
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
6 changes: 4 additions & 2 deletions tests/e2e/utils/killApp.js → tests/e2e/utils/killApp.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import config from '../config';
import execAsync from './execAsync';

export default function (platform = 'android', packageName = config.APP_PACKAGE) {
const killApp = function (platform = 'android', packageName = config.MAIN_APP_PACKAGE): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

@ruben-rebelo Should we add type for param here

platform: string = 'android', packageName: string = config.APP_PACKAGE

cc @blazejkustra

Copy link
Contributor

Choose a reason for hiding this comment

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

One more note here, in this PR we remove APP_PACKAGE and add MAIN_APP_PACKAGE. But we miss to update here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DylanDylann I don't think so, if you add the type even lint complains about Type trivially inferred as we are directly assigning a string to the param.
Regarding the APP_PACKAGE part I've noticed that and I've changed it to 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.

I see. But It doesn't relate to this PR so I give a note for more clear

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