This repository has been archived by the owner on Nov 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Move plotva #35
Merged
Merged
Move plotva #35
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
436693d
add sendKeys and click via adb
kosteman de8820b
add ADBKeyBoard
kosteman 5e007af
get deviceUDID from static field
kosteman 0b10940
update properties sample
kosteman 44630f3
fix fill by adb; fix props reading
kosteman 570854e
fix comments
kosteman 6be2f03
remove unnecessary cast to "T"
kosteman ffd1b91
add comments
kosteman 6e975c1
add space in comments
kosteman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/ru/sbtqa/tag/pagefactory/support/MobileConsole.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package ru.sbtqa.tag.pagefactory.support; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import ru.sbtqa.tag.pagefactory.drivers.TagMobileDriver; | ||
|
||
public class MobileConsole { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AdbConsole. Because when we will add Iphone it will confuse everything. Also you can describe the interface which will abstract you from mobile platform. |
||
|
||
private static final Logger LOG = LoggerFactory.getLogger(MobileConsole.class); | ||
|
||
public static boolean execute(String command) { | ||
return execute(TagMobileDriver.getDeviceUDID(), command); | ||
} | ||
|
||
public static boolean execute(String deviceUDID, String command) { | ||
ProcessBuilder processBuilder = new ProcessBuilder(new String[]{"adb", "-s", deviceUDID, "shell", command}); | ||
LOG.info("Command '{}' is processing...", command); | ||
Process process; | ||
try { | ||
process = processBuilder.start(); | ||
|
||
BufferedReader reader | ||
= new BufferedReader(new InputStreamReader(process.getInputStream())); | ||
StringBuilder builder = new StringBuilder(); | ||
String line; | ||
while ((line = reader.readLine()) != null) { | ||
builder.append(line); | ||
builder.append(System.getProperty("line.separator")); | ||
} | ||
LOG.debug(builder.toString()); | ||
|
||
return (process.waitFor() == 0); | ||
} catch (IOException | InterruptedException ex) { | ||
LOG.error("Failed to process command '{}'", command); | ||
} | ||
|
||
return false; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch/case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rejected.