mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
test: add unittest for adb PushImage/ClearImages
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2503062216
|
v5.0.0-beta-2503071138
|
||||||
|
|||||||
@@ -925,6 +925,7 @@ func (ad *ADBDriver) PushImage(localPath string) error {
|
|||||||
if err := ad.Device.PushFile(localPath, remotePath); err != nil {
|
if err := ad.Device.PushFile(localPath, remotePath); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// refresh
|
||||||
_, _ = ad.Device.RunShellCommand("am", "broadcast",
|
_, _ = ad.Device.RunShellCommand("am", "broadcast",
|
||||||
"-a", "android.intent.action.MEDIA_SCANNER_SCAN_FILE",
|
"-a", "android.intent.action.MEDIA_SCANNER_SCAN_FILE",
|
||||||
"-d", fmt.Sprintf("file://%s", remotePath))
|
"-d", fmt.Sprintf("file://%s", remotePath))
|
||||||
|
|||||||
@@ -244,6 +244,22 @@ func TestDriver_ADB_ScreenRecord(t *testing.T) {
|
|||||||
assert.Nil(t, err)
|
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) {
|
func TestDriver_ADB_Backspace(t *testing.T) {
|
||||||
driver := setupADBDriverExt(t)
|
driver := setupADBDriverExt(t)
|
||||||
err := driver.Backspace(1)
|
err := driver.Backspace(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user