This repository has been archived by the owner on May 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not install requirements by default
- Loading branch information
1 parent
1fc367d
commit 8066792
Showing
3 changed files
with
52 additions
and
38 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ | |
*_vfsdata.go | ||
atx-agent | ||
*.tmp/ | ||
*.exe.old | ||
*.exe.old | ||
*.apk |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"os/exec" | ||
"runtime" | ||
"time" | ||
) | ||
|
||
func safeRunUiautomator() { | ||
if runtime.GOOS == "windows" { | ||
return | ||
} | ||
retry := 5 | ||
for retry > 0 { | ||
retry-- | ||
start := time.Now() | ||
if err := runUiautomator(); err != nil { | ||
log.Printf("uiautomator quit: %v", err) | ||
} | ||
if time.Since(start) > 1*time.Minute { | ||
retry = 5 | ||
} | ||
time.Sleep(2 * time.Second) | ||
} | ||
log.Println("uiautomator can not started") | ||
} | ||
|
||
func runUiautomator() error { | ||
c := exec.Command("am", "instrument", "-w", "-r", | ||
"-e", "debug", "false", | ||
"-e", "class", "com.github.uiautomator.stub.Stub", | ||
"com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner") | ||
c.Stdout = os.Stdout | ||
c.Stderr = os.Stderr | ||
return c.Run() | ||
} |