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

feat: install apk #56

Merged
merged 3 commits into from
Aug 14, 2024
Merged

feat: install apk #56

merged 3 commits into from
Aug 14, 2024

Conversation

itsspriyansh
Copy link
Contributor

@itsspriyansh itsspriyansh commented Jul 29, 2024

Description

This PR:

  1. Adds the functionality to install an APK in a target device (AVD / Real device). The feature can be accessed with the new install subcommand as shown below:
npx @nightwatch/mobile-helper android install --app [--path <path_to_apk>] [--deviceId <target_device_id>]
  1. Adds a new execBinaryAsync function instead of reusing the previously present execBinarySync function. This was done because synchronous flow cannot catch the error thrown by the adb install command. execBinaryAsync function runs the command asynchronously allowing us to handle any possible errors.
Screencast.from.29-07-24.03.06.52.PM.IST.webm

Copy link
Member

@garg3133 garg3133 left a comment

Choose a reason for hiding this comment

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

Can you also specify the reason for creating a new execBinaryAsync function instead of reusing the execBinarySync function in the description of the pull request (for documentation purposes)?

src/commands/android/utils/sdk.ts Outdated Show resolved Hide resolved
src/commands/android/subcommands/install/app.ts Outdated Show resolved Hide resolved
src/commands/android/subcommands/install/app.ts Outdated Show resolved Hide resolved
src/commands/android/subcommands/install/app.ts Outdated Show resolved Hide resolved
src/commands/android/subcommands/install/app.ts Outdated Show resolved Hide resolved
src/commands/android/subcommands/install/app.ts Outdated Show resolved Hide resolved
src/commands/android/subcommands/install/app.ts Outdated Show resolved Hide resolved
@itsspriyansh
Copy link
Contributor Author

@garg3133 PR updated

Copy link
Member

@garg3133 garg3133 left a comment

Choose a reason for hiding this comment

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

Looks good now, thanks!

@garg3133 garg3133 merged commit f801657 into nightwatchjs:main Aug 14, 2024
2 checks passed
@garg3133
Copy link
Member

Ah, sorry about changing the showMissingBinaryHelp function. I thought of making it more universal by moving the binary not found message to the caller function because the main error message and its style could be specific to the caller. But I see that it can very well be reused as it is in other subcommands.

Putting it back in another commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants