mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 15:37:35 +08:00
feat: support to reset session automatically when crashed
This commit is contained in:
+46
-47
@@ -45,13 +45,12 @@ func (wd *wdaDriver) NewSession(capabilities Capabilities) (sessionInfo SessionI
|
||||
}
|
||||
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpPOST(data, "/session"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpPOST(data, "/session"); err != nil {
|
||||
return SessionInfo{}, err
|
||||
}
|
||||
if sessionInfo, err = rawResp.valueConvertToSessionInfo(); err != nil {
|
||||
return SessionInfo{}, err
|
||||
}
|
||||
wd.sessionId = sessionInfo.SessionId
|
||||
return
|
||||
}
|
||||
|
||||
@@ -71,14 +70,14 @@ func (wd *wdaDriver) DeleteSession() (err error) {
|
||||
}
|
||||
|
||||
// [[FBRoute DELETE:@""] respondWithTarget:self action:@selector(handleDeleteSession:)]
|
||||
_, err = wd.httpDELETE("/session", wd.sessionId)
|
||||
_, err = wd.wdaHttpDELETE("/session", wd.sessionId)
|
||||
return
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) Status() (deviceStatus DeviceStatus, err error) {
|
||||
// [[FBRoute GET:@"/status"].withoutSession respondWithTarget:self action:@selector(handleGetStatus:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/status"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/status"); err != nil {
|
||||
return DeviceStatus{}, err
|
||||
}
|
||||
reply := new(struct{ Value struct{ DeviceStatus } })
|
||||
@@ -93,7 +92,7 @@ func (wd *wdaDriver) DeviceInfo() (deviceInfo DeviceInfo, err error) {
|
||||
// [[FBRoute GET:@"/wda/device/info"] respondWithTarget:self action:@selector(handleGetDeviceInfo:)]
|
||||
// [[FBRoute GET:@"/wda/device/info"].withoutSession
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/device/info"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/device/info"); err != nil {
|
||||
return DeviceInfo{}, err
|
||||
}
|
||||
reply := new(struct{ Value struct{ DeviceInfo } })
|
||||
@@ -108,7 +107,7 @@ func (wd *wdaDriver) Location() (location Location, err error) {
|
||||
// [[FBRoute GET:@"/wda/device/location"] respondWithTarget:self action:@selector(handleGetLocation:)]
|
||||
// [[FBRoute GET:@"/wda/device/location"].withoutSession
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/device/location"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/device/location"); err != nil {
|
||||
return Location{}, err
|
||||
}
|
||||
reply := new(struct{ Value struct{ Location } })
|
||||
@@ -122,7 +121,7 @@ func (wd *wdaDriver) Location() (location Location, err error) {
|
||||
func (wd *wdaDriver) BatteryInfo() (batteryInfo BatteryInfo, err error) {
|
||||
// [[FBRoute GET:@"/wda/batteryInfo"] respondWithTarget:self action:@selector(handleGetBatteryInfo:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/batteryInfo"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/batteryInfo"); err != nil {
|
||||
return BatteryInfo{}, err
|
||||
}
|
||||
reply := new(struct{ Value struct{ BatteryInfo } })
|
||||
@@ -136,7 +135,7 @@ func (wd *wdaDriver) BatteryInfo() (batteryInfo BatteryInfo, err error) {
|
||||
func (wd *wdaDriver) WindowSize() (size Size, err error) {
|
||||
// [[FBRoute GET:@"/window/size"] respondWithTarget:self action:@selector(handleGetWindowSize:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/window/size"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/window/size"); err != nil {
|
||||
return Size{}, errors.Wrap(err, "get window size failed with wda")
|
||||
}
|
||||
reply := new(struct{ Value struct{ Size } })
|
||||
@@ -150,7 +149,7 @@ func (wd *wdaDriver) WindowSize() (size Size, err error) {
|
||||
func (wd *wdaDriver) Screen() (screen Screen, err error) {
|
||||
// [[FBRoute GET:@"/wda/screen"] respondWithTarget:self action:@selector(handleGetScreen:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/screen"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/screen"); err != nil {
|
||||
return Screen{}, err
|
||||
}
|
||||
reply := new(struct{ Value struct{ Screen } })
|
||||
@@ -183,7 +182,7 @@ func (wd *wdaDriver) ActiveAppInfo() (info AppInfo, err error) {
|
||||
// [[FBRoute GET:@"/wda/activeAppInfo"] respondWithTarget:self action:@selector(handleActiveAppInfo:)]
|
||||
// [[FBRoute GET:@"/wda/activeAppInfo"].withoutSession
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/activeAppInfo"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/activeAppInfo"); err != nil {
|
||||
return AppInfo{}, err
|
||||
}
|
||||
reply := new(struct{ Value struct{ AppInfo } })
|
||||
@@ -197,7 +196,7 @@ func (wd *wdaDriver) ActiveAppInfo() (info AppInfo, err error) {
|
||||
func (wd *wdaDriver) ActiveAppsList() (appsList []AppBaseInfo, err error) {
|
||||
// [[FBRoute GET:@"/wda/apps/list"] respondWithTarget:self action:@selector(handleGetActiveAppsList:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/apps/list"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/apps/list"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reply := new(struct{ Value []AppBaseInfo })
|
||||
@@ -212,7 +211,7 @@ func (wd *wdaDriver) AppState(bundleId string) (runState AppState, err error) {
|
||||
// [[FBRoute POST:@"/wda/apps/state"] respondWithTarget:self action:@selector(handleSessionAppState:)]
|
||||
data := map[string]interface{}{"bundleId": bundleId}
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/apps/state"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/apps/state"); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
reply := new(struct{ Value AppState })
|
||||
@@ -228,7 +227,7 @@ func (wd *wdaDriver) IsLocked() (locked bool, err error) {
|
||||
// [[FBRoute GET:@"/wda/locked"] respondWithTarget:self action:@selector(handleIsLocked:)]
|
||||
// [[FBRoute GET:@"/wda/locked"].withoutSession
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/locked"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/locked"); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if locked, err = rawResp.valueConvertToBool(); err != nil {
|
||||
@@ -240,20 +239,20 @@ func (wd *wdaDriver) IsLocked() (locked bool, err error) {
|
||||
func (wd *wdaDriver) Unlock() (err error) {
|
||||
// [[FBRoute POST:@"/wda/unlock"] respondWithTarget:self action:@selector(handleUnlock:)]
|
||||
// [[FBRoute POST:@"/wda/unlock"].withoutSession
|
||||
_, err = wd.httpPOST(nil, "/session", wd.sessionId, "/wda/unlock")
|
||||
_, err = wd.wdaHttpPOST(nil, "/session", wd.sessionId, "/wda/unlock")
|
||||
return
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) Lock() (err error) {
|
||||
// [[FBRoute POST:@"/wda/lock"] respondWithTarget:self action:@selector(handleLock:)]
|
||||
// [[FBRoute POST:@"/wda/lock"].withoutSession
|
||||
_, err = wd.httpPOST(nil, "/session", wd.sessionId, "/wda/lock")
|
||||
_, err = wd.wdaHttpPOST(nil, "/session", wd.sessionId, "/wda/lock")
|
||||
return
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) Homescreen() (err error) {
|
||||
// [[FBRoute POST:@"/wda/homescreen"].withoutSession respondWithTarget:self action:@selector(handleHomescreenCommand:)]
|
||||
_, err = wd.httpPOST(nil, "/wda/homescreen")
|
||||
_, err = wd.wdaHttpPOST(nil, "/wda/homescreen")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -261,7 +260,7 @@ func (wd *wdaDriver) AlertText() (text string, err error) {
|
||||
// [[FBRoute GET:@"/alert/text"] respondWithTarget:self action:@selector(handleAlertGetTextCommand:)]
|
||||
// [[FBRoute GET:@"/alert/text"].withoutSession
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/alert/text"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/alert/text"); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if text, err = rawResp.valueConvertToString(); err != nil {
|
||||
@@ -273,7 +272,7 @@ func (wd *wdaDriver) AlertText() (text string, err error) {
|
||||
func (wd *wdaDriver) AlertButtons() (btnLabels []string, err error) {
|
||||
// [[FBRoute GET:@"/wda/alert/buttons"] respondWithTarget:self action:@selector(handleGetAlertButtonsCommand:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/alert/buttons"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/alert/buttons"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reply := new(struct{ Value []string })
|
||||
@@ -291,7 +290,7 @@ func (wd *wdaDriver) AlertAccept(label ...string) (err error) {
|
||||
if len(label) != 0 && label[0] != "" {
|
||||
data["name"] = label[0]
|
||||
}
|
||||
_, err = wd.httpPOST(data, "/alert/accept")
|
||||
_, err = wd.wdaHttpPOST(data, "/alert/accept")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -302,14 +301,14 @@ func (wd *wdaDriver) AlertDismiss(label ...string) (err error) {
|
||||
if len(label) != 0 && label[0] != "" {
|
||||
data["name"] = label[0]
|
||||
}
|
||||
_, err = wd.httpPOST(data, "/alert/dismiss")
|
||||
_, err = wd.wdaHttpPOST(data, "/alert/dismiss")
|
||||
return
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) AlertSendKeys(text string) (err error) {
|
||||
// [[FBRoute POST:@"/alert/text"] respondWithTarget:self action:@selector(handleAlertSetTextCommand:)]
|
||||
data := map[string]interface{}{"value": strings.Split(text, "")}
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/alert/text")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/alert/text")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -317,7 +316,7 @@ func (wd *wdaDriver) AppLaunch(bundleId string) (err error) {
|
||||
// [[FBRoute POST:@"/wda/apps/launch"] respondWithTarget:self action:@selector(handleSessionAppLaunch:)]
|
||||
data := make(map[string]interface{})
|
||||
data["bundleId"] = bundleId
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/apps/launch")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/apps/launch")
|
||||
if err != nil {
|
||||
return errors.Wrap(code.MobileUILaunchAppError,
|
||||
fmt.Sprintf("wda launch failed: %v", err))
|
||||
@@ -328,7 +327,7 @@ func (wd *wdaDriver) AppLaunch(bundleId string) (err error) {
|
||||
func (wd *wdaDriver) AppLaunchUnattached(bundleId string) (err error) {
|
||||
// [[FBRoute POST:@"/wda/apps/launchUnattached"].withoutSession respondWithTarget:self action:@selector(handleLaunchUnattachedApp:)]
|
||||
data := map[string]interface{}{"bundleId": bundleId}
|
||||
_, err = wd.httpPOST(data, "/wda/apps/launchUnattached")
|
||||
_, err = wd.wdaHttpPOST(data, "/wda/apps/launchUnattached")
|
||||
if err != nil {
|
||||
return errors.Wrap(code.MobileUILaunchAppError,
|
||||
fmt.Sprintf("wda launchUnattached failed: %v", err))
|
||||
@@ -340,7 +339,7 @@ func (wd *wdaDriver) AppTerminate(bundleId string) (successful bool, err error)
|
||||
// [[FBRoute POST:@"/wda/apps/terminate"] respondWithTarget:self action:@selector(handleSessionAppTerminate:)]
|
||||
data := map[string]interface{}{"bundleId": bundleId}
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/apps/terminate"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/apps/terminate"); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if successful, err = rawResp.valueConvertToBool(); err != nil {
|
||||
@@ -352,7 +351,7 @@ func (wd *wdaDriver) AppTerminate(bundleId string) (successful bool, err error)
|
||||
func (wd *wdaDriver) AppActivate(bundleId string) (err error) {
|
||||
// [[FBRoute POST:@"/wda/apps/activate"] respondWithTarget:self action:@selector(handleSessionAppActivate:)]
|
||||
data := map[string]interface{}{"bundleId": bundleId}
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/apps/activate")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/apps/activate")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -362,7 +361,7 @@ func (wd *wdaDriver) AppDeactivate(second float64) (err error) {
|
||||
second = 3.0
|
||||
}
|
||||
data := map[string]interface{}{"duration": second}
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/deactivateApp")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/deactivateApp")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -402,7 +401,7 @@ func (wd *wdaDriver) TapFloat(x, y float64, options ...ActionOption) (err error)
|
||||
// new data options in post data for extra WDA configurations
|
||||
newData := mergeDataWithOptions(data, options...)
|
||||
|
||||
_, err = wd.httpPOST(newData, "/session", wd.sessionId, "/wda/tap/0")
|
||||
_, err = wd.wdaHttpPOST(newData, "/session", wd.sessionId, "/wda/tap/0")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -416,7 +415,7 @@ func (wd *wdaDriver) DoubleTapFloat(x, y float64) (err error) {
|
||||
"x": wd.toScale(x),
|
||||
"y": wd.toScale(y),
|
||||
}
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/doubleTap")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/doubleTap")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -434,7 +433,7 @@ func (wd *wdaDriver) TouchAndHoldFloat(x, y float64, second ...float64) (err err
|
||||
second = []float64{1.0}
|
||||
}
|
||||
data["duration"] = second[0]
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/touchAndHold")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/touchAndHold")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -454,7 +453,7 @@ func (wd *wdaDriver) DragFloat(fromX, fromY, toX, toY float64, options ...Action
|
||||
// new data options in post data for extra WDA configurations
|
||||
newData := mergeDataWithOptions(data, options...)
|
||||
|
||||
_, err = wd.httpPOST(newData, "/session", wd.sessionId, "/wda/dragfromtoforduration")
|
||||
_, err = wd.wdaHttpPOST(newData, "/session", wd.sessionId, "/wda/dragfromtoforduration")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -472,7 +471,7 @@ func (wd *wdaDriver) SetPasteboard(contentType PasteboardType, content string) (
|
||||
"contentType": contentType,
|
||||
"content": base64.StdEncoding.EncodeToString([]byte(content)),
|
||||
}
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/setPasteboard")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/setPasteboard")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -480,7 +479,7 @@ func (wd *wdaDriver) GetPasteboard(contentType PasteboardType) (raw *bytes.Buffe
|
||||
// [[FBRoute POST:@"/wda/getPasteboard"] respondWithTarget:self action:@selector(handleGetPasteboard:)]
|
||||
data := map[string]interface{}{"contentType": contentType}
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/getPasteboard"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/getPasteboard"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if raw, err = rawResp.valueDecodeAsBase64(); err != nil {
|
||||
@@ -496,7 +495,7 @@ func (wd *wdaDriver) SendKeys(text string, options ...ActionOption) (err error)
|
||||
// new data options in post data for extra WDA configurations
|
||||
newData := mergeDataWithOptions(data, options...)
|
||||
|
||||
_, err = wd.httpPOST(newData, "/session", wd.sessionId, "/wda/keys")
|
||||
_, err = wd.wdaHttpPOST(newData, "/session", wd.sessionId, "/wda/keys")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -521,14 +520,14 @@ func (wd *wdaDriver) PressBack(options ...ActionOption) (err error) {
|
||||
// new data options in post data for extra WDA configurations
|
||||
newData := mergeDataWithOptions(data, options...)
|
||||
|
||||
_, err = wd.httpPOST(newData, "/session", wd.sessionId, "/wda/dragfromtoforduration")
|
||||
_, err = wd.wdaHttpPOST(newData, "/session", wd.sessionId, "/wda/dragfromtoforduration")
|
||||
return
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) PressButton(devBtn DeviceButton) (err error) {
|
||||
// [[FBRoute POST:@"/wda/pressButton"] respondWithTarget:self action:@selector(handlePressButtonCommand:)]
|
||||
data := map[string]interface{}{"name": devBtn}
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/wda/pressButton")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/wda/pressButton")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -552,7 +551,7 @@ func (wd *wdaDriver) StopCamera() (err error) {
|
||||
func (wd *wdaDriver) Orientation() (orientation Orientation, err error) {
|
||||
// [[FBRoute GET:@"/orientation"] respondWithTarget:self action:@selector(handleGetOrientation:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/orientation"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/orientation"); err != nil {
|
||||
return "", err
|
||||
}
|
||||
reply := new(struct{ Value Orientation })
|
||||
@@ -566,14 +565,14 @@ func (wd *wdaDriver) Orientation() (orientation Orientation, err error) {
|
||||
func (wd *wdaDriver) SetOrientation(orientation Orientation) (err error) {
|
||||
// [[FBRoute POST:@"/orientation"] respondWithTarget:self action:@selector(handleSetOrientation:)]
|
||||
data := map[string]interface{}{"orientation": orientation}
|
||||
_, err = wd.httpPOST(data, "/session", wd.sessionId, "/orientation")
|
||||
_, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/orientation")
|
||||
return
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) Rotation() (rotation Rotation, err error) {
|
||||
// [[FBRoute GET:@"/rotation"] respondWithTarget:self action:@selector(handleGetRotation:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/rotation"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/rotation"); err != nil {
|
||||
return Rotation{}, err
|
||||
}
|
||||
reply := new(struct{ Value Rotation })
|
||||
@@ -586,7 +585,7 @@ func (wd *wdaDriver) Rotation() (rotation Rotation, err error) {
|
||||
|
||||
func (wd *wdaDriver) SetRotation(rotation Rotation) (err error) {
|
||||
// [[FBRoute POST:@"/rotation"] respondWithTarget:self action:@selector(handleSetRotation:)]
|
||||
_, err = wd.httpPOST(rotation, "/session", wd.sessionId, "/rotation")
|
||||
_, err = wd.wdaHttpPOST(rotation, "/session", wd.sessionId, "/rotation")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -594,7 +593,7 @@ func (wd *wdaDriver) Screenshot() (raw *bytes.Buffer, err error) {
|
||||
// [[FBRoute GET:@"/screenshot"] respondWithTarget:self action:@selector(handleGetScreenshot:)]
|
||||
// [[FBRoute GET:@"/screenshot"].withoutSession respondWithTarget:self action:@selector(handleGetScreenshot:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/screenshot"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/screenshot"); err != nil {
|
||||
return nil, errors.Wrap(code.IOSScreenShotError,
|
||||
fmt.Sprintf("get WDA screenshot data failed: %v", err))
|
||||
}
|
||||
@@ -644,7 +643,7 @@ func (wd *wdaDriver) AccessibleSource() (source string, err error) {
|
||||
// [[FBRoute GET:@"/wda/accessibleSource"] respondWithTarget:self action:@selector(handleGetAccessibleSourceCommand:)]
|
||||
// [[FBRoute GET:@"/wda/accessibleSource"].withoutSession
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/wda/accessibleSource"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/wda/accessibleSource"); err != nil {
|
||||
return "", err
|
||||
}
|
||||
var jr builtinJSON.RawMessage
|
||||
@@ -657,14 +656,14 @@ func (wd *wdaDriver) AccessibleSource() (source string, err error) {
|
||||
|
||||
func (wd *wdaDriver) HealthCheck() (err error) {
|
||||
// [[FBRoute GET:@"/wda/healthcheck"].withoutSession respondWithTarget:self action:@selector(handleGetHealthCheck:)]
|
||||
_, err = wd.httpGET("/wda/healthcheck")
|
||||
_, err = wd.wdaHttpGET("/wda/healthcheck")
|
||||
return
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) GetAppiumSettings() (settings map[string]interface{}, err error) {
|
||||
// [[FBRoute GET:@"/appium/settings"] respondWithTarget:self action:@selector(handleGetSettings:)]
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/session", wd.sessionId, "/appium/settings"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/session", wd.sessionId, "/appium/settings"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reply := new(struct{ Value map[string]interface{} })
|
||||
@@ -679,7 +678,7 @@ func (wd *wdaDriver) SetAppiumSettings(settings map[string]interface{}) (ret map
|
||||
// [[FBRoute POST:@"/appium/settings"] respondWithTarget:self action:@selector(handleSetSettings:)]
|
||||
data := map[string]interface{}{"settings": settings}
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpPOST(data, "/session", wd.sessionId, "/appium/settings"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpPOST(data, "/session", wd.sessionId, "/appium/settings"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reply := new(struct{ Value map[string]interface{} })
|
||||
@@ -692,7 +691,7 @@ func (wd *wdaDriver) SetAppiumSettings(settings map[string]interface{}) (ret map
|
||||
|
||||
func (wd *wdaDriver) IsHealthy() (healthy bool, err error) {
|
||||
var rawResp rawResponse
|
||||
if rawResp, err = wd.httpGET("/health"); err != nil {
|
||||
if rawResp, err = wd.wdaHttpGET("/health"); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if string(rawResp) != "I-AM-ALIVE" {
|
||||
@@ -702,13 +701,13 @@ func (wd *wdaDriver) IsHealthy() (healthy bool, err error) {
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) WdaShutdown() (err error) {
|
||||
_, err = wd.httpGET("/wda/shutdown")
|
||||
_, err = wd.wdaHttpGET("/wda/shutdown")
|
||||
return
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) triggerWDALog(data map[string]interface{}) (rawResp []byte, err error) {
|
||||
// [[FBRoute POST:@"/gtf/automation/log"].withoutSession respondWithTarget:self action:@selector(handleAutomationLog:)]
|
||||
return wd.httpPOST(data, "/gtf/automation/log")
|
||||
return wd.wdaHttpPOST(data, "/gtf/automation/log")
|
||||
}
|
||||
|
||||
func (wd *wdaDriver) StartCaptureLog(identifier ...string) error {
|
||||
|
||||
Reference in New Issue
Block a user