Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Download app if URL is provided (#236)
* Handling appPath if URL is provided (create repo, download file, install downloaded file) (#226) * Resolved TODO loggingPrefs for firefox. Added setLogLevel, loggingPrefs for createChromeDriver and createFirefoxDriver. * Added 2 methods isURLValid(String) and downloadFile(String, String). Both of these are used in verifyAppExistsAtMentionedPath() where if URL exist we are creating repository, downloading file, then installing the downloaded file on device. * Removed isURLValid(appPath), used isAppPathAUrl(appPath) instead. Added createDirectoryIfNotExist(directoryPath). Rewritten code for simplification * Added Logger to createDirectoryIfNotExist() based on condition. Added Logger, exception throwing in downloadFileIfNotExist(). Create method convertAppPathToFilePathIfNeeded(), and called from verifyAppExistsAtMentionedPath(). Added Logger to isAppPathAUrl() based on condition * made changes according to PR comments * pushing after pulling changes from forked * made convertAppPathToFilePathIfNeeded() public, created unit tests in AppPathTest for convertAppPathToFilePathIfNeeded() * modified method names and code as per comments * changed method naming using given, when, then. Changed to single imports. modified code as per comments * Changed to single imports. Modified code as per comments. Created separate method to open file * made directoryPath as second argument * made changes to directoryPath in variable names, for unit test using temp/unitTests directory. --------- Co-authored-by: Mukund1 Gupta <[email protected]> * updated download app functionality * renamed method from convertAppPathToFilePathIfNeeded to downloadAppAndGetFilePath * Removed openFile() method, added and modified Unit Tests (#240) * Resolved TODO loggingPrefs for firefox. Added setLogLevel, loggingPrefs for createChromeDriver and createFirefoxDriver. * Added 2 methods isURLValid(String) and downloadFile(String, String). Both of these are used in verifyAppExistsAtMentionedPath() where if URL exist we are creating repository, downloading file, then installing the downloaded file on device. * Removed isURLValid(appPath), used isAppPathAUrl(appPath) instead. Added createDirectoryIfNotExist(directoryPath). Rewritten code for simplification * Added Logger to createDirectoryIfNotExist() based on condition. Added Logger, exception throwing in downloadFileIfNotExist(). Create method convertAppPathToFilePathIfNeeded(), and called from verifyAppExistsAtMentionedPath(). Added Logger to isAppPathAUrl() based on condition * made changes according to PR comments * pushing after pulling changes from forked * made convertAppPathToFilePathIfNeeded() public, created unit tests in AppPathTest for convertAppPathToFilePathIfNeeded() * modified method names and code as per comments * changed method naming using given, when, then. Changed to single imports. modified code as per comments * Changed to single imports. Modified code as per comments. Created separate method to open file * made directoryPath as second argument * made changes to directoryPath in variable names, for unit test using temp/unitTests directory. * removed openFile() method and its calling from convertAppPathToFilePathIfNeeded() method * modified code, created all 12 possible unit tests * changed unit test method name * modified code as per downloadApp branch and called createDirectory() inside downloadFile() * modified method names for unit tests and method called for downloading file. * add isAppPathAUrl() method to confirm url is valid or invalid after confirming it is an url * change assertions to assertThrows and replace Exception * add conditional code for handling file does not exist or incorrect file path by throwing exception * made changes to unit test assertions, replaced with assertThrows to catch exceptions * add methods checkEitherFilePathIsIncorrectOrFileIsMissing(), downloadFileIfDoesNotExist() --------- Co-authored-by: Mukund1 Gupta <[email protected]> * fixed and optimised downloadApp if URL is given functionality. Updated tests. --------- Co-authored-by: Mukund Gupta <[email protected]> Co-authored-by: Mukund1 Gupta <[email protected]>
- Loading branch information