mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-27 11:20:08 +08:00
test: add unittest for adb PushImage/ClearImages
This commit is contained in:
@@ -925,6 +925,7 @@ func (ad *ADBDriver) PushImage(localPath string) error {
|
||||
if err := ad.Device.PushFile(localPath, remotePath); err != nil {
|
||||
return err
|
||||
}
|
||||
// refresh
|
||||
_, _ = ad.Device.RunShellCommand("am", "broadcast",
|
||||
"-a", "android.intent.action.MEDIA_SCANNER_SCAN_FILE",
|
||||
"-d", fmt.Sprintf("file://%s", remotePath))
|
||||
|
||||
@@ -244,6 +244,22 @@ func TestDriver_ADB_ScreenRecord(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestDriver_ADB_PushImage(t *testing.T) {
|
||||
driver := setupADBDriverExt(t)
|
||||
|
||||
screenshot, err := driver.ScreenShot()
|
||||
assert.Nil(t, err)
|
||||
path, err := saveScreenShot(screenshot, "1234")
|
||||
require.Nil(t, err)
|
||||
defer os.Remove(path)
|
||||
|
||||
err = driver.PushImage(path)
|
||||
assert.Nil(t, err)
|
||||
|
||||
err = driver.ClearImages()
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestDriver_ADB_Backspace(t *testing.T) {
|
||||
driver := setupADBDriverExt(t)
|
||||
err := driver.Backspace(1)
|
||||
|
||||
Reference in New Issue
Block a user