mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 03:30:01 +08:00
change: remove unused methods
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2502111347
|
v5.0.0+2502111501
|
||||||
|
|||||||
@@ -183,61 +183,6 @@ func (ad *ADBDriver) PressBack(opts ...option.ActionOption) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *ADBDriver) StartCamera() (err error) {
|
|
||||||
if _, err = ad.runShellCommand("rm", "-r", "/sdcard/DCIM/Camera"); err != nil {
|
|
||||||
return errors.Wrap(err, "remove /sdcard/DCIM/Camera failed")
|
|
||||||
}
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
var version string
|
|
||||||
if version, err = ad.runShellCommand("getprop", "ro.build.version.release"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if version == "11" || version == "12" {
|
|
||||||
if _, err = ad.runShellCommand("am", "start", "-a", "android.media.action.STILL_IMAGE_CAMERA"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
if _, err = ad.runShellCommand("input", "swipe", "750", "1000", "250", "1000"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
if _, err = ad.runShellCommand("input", "keyevent", fmt.Sprintf("%d", KCCamera)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
if _, err = ad.runShellCommand("am", "start", "-a", "android.media.action.VIDEO_CAPTURE"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
if _, err = ad.runShellCommand("input", "keyevent", fmt.Sprintf("%d", KCCamera)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) StopCamera() (err error) {
|
|
||||||
err = ad.PressBack()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ad.Homescreen()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// kill samsung shell command
|
|
||||||
if _, err = ad.AppTerminate("com.sec.android.app.camera"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// kill other camera (huawei mi)
|
|
||||||
if _, err = ad.AppTerminate("com.android.camera2"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) Orientation() (orientation types.Orientation, err error) {
|
func (ad *ADBDriver) Orientation() (orientation types.Orientation, err error) {
|
||||||
output, err := ad.runShellCommand("dumpsys", "input", "|", "grep", "'SurfaceOrientation'")
|
output, err := ad.runShellCommand("dumpsys", "input", "|", "grep", "'SurfaceOrientation'")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -471,16 +416,6 @@ func (ad *ADBDriver) ForceTouchFloat(x, y, pressure float64, second ...float64)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *ADBDriver) SetPasteboard(contentType types.PasteboardType, content string) (err error) {
|
|
||||||
err = types.ErrDriverNotImplemented
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) GetPasteboard(contentType types.PasteboardType) (raw *bytes.Buffer, err error) {
|
|
||||||
err = types.ErrDriverNotImplemented
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) SendKeys(text string, opts ...option.ActionOption) (err error) {
|
func (ad *ADBDriver) SendKeys(text string, opts ...option.ActionOption) (err error) {
|
||||||
err = ad.SendUnicodeKeys(text, opts...)
|
err = ad.SendUnicodeKeys(text, opts...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -590,7 +525,7 @@ func (ad *ADBDriver) Input(text string, opts ...option.ActionOption) (err error)
|
|||||||
return ad.SendKeys(text, opts...)
|
return ad.SendKeys(text, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *ADBDriver) Clear(packageName string) error {
|
func (ad *ADBDriver) AppClear(packageName string) error {
|
||||||
if _, err := ad.runShellCommand("pm", "clear", packageName); err != nil {
|
if _, err := ad.runShellCommand("pm", "clear", packageName); err != nil {
|
||||||
log.Error().Str("packageName", packageName).Err(err).Msg("failed to clear package cache")
|
log.Error().Str("packageName", packageName).Err(err).Msg("failed to clear package cache")
|
||||||
return err
|
return err
|
||||||
@@ -721,31 +656,6 @@ func (ad *ADBDriver) searchNodes(nodes []Layout, text string, opts ...option.Act
|
|||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *ADBDriver) AccessibleSource() (source string, err error) {
|
|
||||||
err = types.ErrDriverNotImplemented
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) HealthCheck() (err error) {
|
|
||||||
err = types.ErrDriverNotImplemented
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) GetAppiumSettings() (settings map[string]interface{}, err error) {
|
|
||||||
err = types.ErrDriverNotImplemented
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) SetAppiumSettings(settings map[string]interface{}) (ret map[string]interface{}, err error) {
|
|
||||||
err = types.ErrDriverNotImplemented
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) IsHealthy() (healthy bool, err error) {
|
|
||||||
err = types.ErrDriverNotImplemented
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *ADBDriver) StartCaptureLog(identifier ...string) (err error) {
|
func (ad *ADBDriver) StartCaptureLog(identifier ...string) (err error) {
|
||||||
log.Info().Msg("start adb log recording")
|
log.Info().Msg("start adb log recording")
|
||||||
// start logcat
|
// start logcat
|
||||||
|
|||||||
@@ -121,18 +121,6 @@ func TestDriver_BatteryInfo(t *testing.T) {
|
|||||||
t.Log(batteryInfo)
|
t.Log(batteryInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDriver_GetAppiumSettings(t *testing.T) {
|
|
||||||
appiumSettings, err := driver.GetAppiumSettings()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for k := range appiumSettings {
|
|
||||||
t.Logf("key: %s\tvalue: %v", k, appiumSettings[k])
|
|
||||||
}
|
|
||||||
// t.Log(appiumSettings)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDriver_DeviceInfo(t *testing.T) {
|
func TestDriver_DeviceInfo(t *testing.T) {
|
||||||
devInfo, err := driver.DeviceInfo()
|
devInfo, err := driver.DeviceInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+21
-76
@@ -42,98 +42,43 @@ type IDriver interface {
|
|||||||
WindowSize() (types.Size, error)
|
WindowSize() (types.Size, error)
|
||||||
Screen() (ai.Screen, error)
|
Screen() (ai.Screen, error)
|
||||||
Scale() (float64, error)
|
Scale() (float64, error)
|
||||||
|
Screenshot() (*bytes.Buffer, error)
|
||||||
|
Source(srcOpt ...option.SourceOption) (string, error)
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
Homescreen() error
|
Homescreen() error
|
||||||
Unlock() (err error)
|
Unlock() (err error)
|
||||||
|
// tap
|
||||||
|
Tap(x, y float64, opts ...option.ActionOption) error
|
||||||
|
DoubleTap(x, y float64, opts ...option.ActionOption) error
|
||||||
|
TapByText(text string, opts ...option.ActionOption) error // TODO: remove
|
||||||
|
TapByTexts(actions ...TapTextAction) error // TODO: remove
|
||||||
|
// swipe
|
||||||
|
Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error
|
||||||
|
Swipe(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error
|
||||||
|
TouchAndHold(x, y float64, opts ...option.ActionOption) error
|
||||||
|
// input
|
||||||
|
SendKeys(text string, opts ...option.ActionOption) error
|
||||||
|
Input(text string, opts ...option.ActionOption) error
|
||||||
|
// press key
|
||||||
|
PressButton(devBtn types.DeviceButton) error
|
||||||
|
PressBack(opts ...option.ActionOption) error
|
||||||
|
PressKeyCode(keyCode KeyCode) (err error)
|
||||||
|
Backspace(count int, opts ...option.ActionOption) (err error)
|
||||||
|
|
||||||
// AppLaunch Launch an application with given bundle identifier in scope of current session.
|
// app related
|
||||||
// !This method is only available since Xcode9 SDK
|
|
||||||
AppLaunch(packageName string) error
|
AppLaunch(packageName string) error
|
||||||
// AppTerminate Terminate an application with the given package name.
|
|
||||||
// Either `true` if the app has been successfully terminated or `false` if it was not running
|
|
||||||
AppTerminate(packageName string) (bool, error)
|
AppTerminate(packageName string) (bool, error)
|
||||||
// GetForegroundApp returns current foreground app package name and activity name
|
|
||||||
GetForegroundApp() (app types.AppInfo, err error)
|
GetForegroundApp() (app types.AppInfo, err error)
|
||||||
// AssertForegroundApp returns nil if the given package and activity are in foreground
|
|
||||||
AssertForegroundApp(packageName string, activityType ...string) error
|
AssertForegroundApp(packageName string, activityType ...string) error
|
||||||
|
AppClear(packageName string) error
|
||||||
// StartCamera Starts a new camera for recording
|
|
||||||
StartCamera() error
|
|
||||||
// StopCamera Stops the camera for recording
|
|
||||||
StopCamera() error
|
|
||||||
|
|
||||||
Orientation() (orientation types.Orientation, err error)
|
Orientation() (orientation types.Orientation, err error)
|
||||||
|
|
||||||
SetRotation(rotation types.Rotation) (err error)
|
SetRotation(rotation types.Rotation) (err error)
|
||||||
Rotation() (rotation types.Rotation, err error)
|
Rotation() (rotation types.Rotation, err error)
|
||||||
|
|
||||||
// Tap Sends a tap event at the coordinate.
|
|
||||||
Tap(x, y float64, opts ...option.ActionOption) error
|
|
||||||
|
|
||||||
// DoubleTap Sends a double tap event at the coordinate.
|
|
||||||
DoubleTap(x, y float64, opts ...option.ActionOption) error
|
|
||||||
|
|
||||||
// TouchAndHold Initiates a long-press gesture at the coordinate, holding for the specified duration.
|
|
||||||
// second: The default value is 1
|
|
||||||
TouchAndHold(x, y float64, opts ...option.ActionOption) error
|
|
||||||
|
|
||||||
// Drag Initiates a press-and-hold gesture at the coordinate, then drags to another coordinate.
|
|
||||||
// WithPressDurationOption option can be used to set pressForDuration (default to 1 second).
|
|
||||||
Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error
|
|
||||||
|
|
||||||
// Swipe works like Drag, but `pressForDuration` value is 0
|
|
||||||
Swipe(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error
|
|
||||||
|
|
||||||
// SetPasteboard Sets data to the general pasteboard
|
|
||||||
SetPasteboard(contentType types.PasteboardType, content string) error
|
|
||||||
// GetPasteboard Gets the data contained in the general pasteboard.
|
|
||||||
// It worked when `WDA` was foreground. https://github.com/appium/WebDriverAgent/issues/330
|
|
||||||
GetPasteboard(contentType types.PasteboardType) (raw *bytes.Buffer, err error)
|
|
||||||
|
|
||||||
SetIme(ime string) error
|
SetIme(ime string) error
|
||||||
|
|
||||||
// SendKeys Types a string into active element. There must be element with keyboard focus,
|
|
||||||
// otherwise an error is raised.
|
|
||||||
// WithFrequency option can be used to set frequency of typing (letters per sec). The default value is 60
|
|
||||||
SendKeys(text string, opts ...option.ActionOption) error
|
|
||||||
|
|
||||||
// Input works like SendKeys
|
|
||||||
Input(text string, opts ...option.ActionOption) error
|
|
||||||
|
|
||||||
Clear(packageName string) error
|
|
||||||
|
|
||||||
// PressButton Presses the corresponding hardware button on the device
|
|
||||||
PressButton(devBtn types.DeviceButton) error
|
|
||||||
|
|
||||||
// PressBack Presses the back button
|
|
||||||
PressBack(opts ...option.ActionOption) error
|
|
||||||
|
|
||||||
PressKeyCode(keyCode KeyCode) (err error)
|
|
||||||
|
|
||||||
Backspace(count int, opts ...option.ActionOption) (err error)
|
|
||||||
|
|
||||||
Screenshot() (*bytes.Buffer, error)
|
|
||||||
|
|
||||||
// Source Return application elements tree
|
|
||||||
Source(srcOpt ...option.SourceOption) (string, error)
|
|
||||||
|
|
||||||
TapByText(text string, opts ...option.ActionOption) error
|
|
||||||
TapByTexts(actions ...TapTextAction) error
|
|
||||||
|
|
||||||
// AccessibleSource Return application elements accessibility tree
|
|
||||||
AccessibleSource() (string, error)
|
|
||||||
|
|
||||||
// HealthCheck Health check might modify simulator state so it should only be called in-between testing sessions
|
|
||||||
// Checks health of XCTest by:
|
|
||||||
// 1) Querying application for some elements,
|
|
||||||
// 2) Triggering some device events.
|
|
||||||
HealthCheck() error
|
|
||||||
GetAppiumSettings() (map[string]interface{}, error)
|
|
||||||
SetAppiumSettings(settings map[string]interface{}) (map[string]interface{}, error)
|
|
||||||
|
|
||||||
IsHealthy() (bool, error)
|
|
||||||
|
|
||||||
// triggers the log capture and returns the log entries
|
// triggers the log capture and returns the log entries
|
||||||
StartCaptureLog(identifier ...string) (err error)
|
StartCaptureLog(identifier ...string) (err error)
|
||||||
StopCaptureLog() (result interface{}, err error)
|
StopCaptureLog() (result interface{}, err error)
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import (
|
|||||||
"github.com/httprunner/httprunner/v5/code"
|
"github.com/httprunner/httprunner/v5/code"
|
||||||
"github.com/httprunner/httprunner/v5/internal/builtin"
|
"github.com/httprunner/httprunner/v5/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/v5/pkg/uixt/option"
|
"github.com/httprunner/httprunner/v5/pkg/uixt/option"
|
||||||
"github.com/httprunner/httprunner/v5/pkg/uixt/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ActionMethod string
|
type ActionMethod string
|
||||||
@@ -31,10 +30,6 @@ const (
|
|||||||
ACTION_Sleep ActionMethod = "sleep"
|
ACTION_Sleep ActionMethod = "sleep"
|
||||||
ACTION_SleepMS ActionMethod = "sleep_ms"
|
ACTION_SleepMS ActionMethod = "sleep_ms"
|
||||||
ACTION_SleepRandom ActionMethod = "sleep_random"
|
ACTION_SleepRandom ActionMethod = "sleep_random"
|
||||||
ACTION_StartCamera ActionMethod = "camera_start" // alias for app_launch camera
|
|
||||||
ACTION_StopCamera ActionMethod = "camera_stop" // alias for app_terminate camera
|
|
||||||
ACTION_SetClipboard ActionMethod = "set_clipboard"
|
|
||||||
ACTION_GetClipboard ActionMethod = "get_clipboard"
|
|
||||||
ACTION_SetIme ActionMethod = "set_ime"
|
ACTION_SetIme ActionMethod = "set_ime"
|
||||||
ACTION_GetSource ActionMethod = "get_source"
|
ACTION_GetSource ActionMethod = "get_source"
|
||||||
ACTION_GetForegroundApp ActionMethod = "get_foreground_app"
|
ACTION_GetForegroundApp ActionMethod = "get_foreground_app"
|
||||||
@@ -158,7 +153,7 @@ func (dExt *XTDriver) DoAction(action MobileAction) (err error) {
|
|||||||
}
|
}
|
||||||
case ACTION_AppClear:
|
case ACTION_AppClear:
|
||||||
if packageName, ok := action.Params.(string); ok {
|
if packageName, ok := action.Params.(string); ok {
|
||||||
if err = dExt.Driver.Clear(packageName); err != nil {
|
if err = dExt.Driver.AppClear(packageName); err != nil {
|
||||||
return errors.Wrap(err, "failed to clear app")
|
return errors.Wrap(err, "failed to clear app")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,15 +195,6 @@ func (dExt *XTDriver) DoAction(action MobileAction) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("app_terminate params should be bundleId(string), got %v", action.Params)
|
return fmt.Errorf("app_terminate params should be bundleId(string), got %v", action.Params)
|
||||||
case ACTION_SetClipboard:
|
|
||||||
if text, ok := action.Params.(string); ok {
|
|
||||||
err := dExt.Driver.SetPasteboard(types.PasteboardTypePlaintext, text)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "failed to set clipboard")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return fmt.Errorf("set_clioboard params should be text(string), got %v", action.Params)
|
|
||||||
case ACTION_Home:
|
case ACTION_Home:
|
||||||
return dExt.Driver.Homescreen()
|
return dExt.Driver.Homescreen()
|
||||||
case ACTION_SetIme:
|
case ACTION_SetIme:
|
||||||
@@ -331,10 +317,6 @@ func (dExt *XTDriver) DoAction(action MobileAction) (err error) {
|
|||||||
log.Info().Msg("take screenshot for current screen")
|
log.Info().Msg("take screenshot for current screen")
|
||||||
_, err := dExt.GetScreenResult(action.GetScreenOptions()...)
|
_, err := dExt.GetScreenResult(action.GetScreenOptions()...)
|
||||||
return err
|
return err
|
||||||
case ACTION_StartCamera:
|
|
||||||
return dExt.Driver.StartCamera()
|
|
||||||
case ACTION_StopCamera:
|
|
||||||
return dExt.Driver.StopCamera()
|
|
||||||
case ACTION_ClosePopups:
|
case ACTION_ClosePopups:
|
||||||
return dExt.ClosePopupsHandler()
|
return dExt.ClosePopupsHandler()
|
||||||
case ACTION_CallFunction:
|
case ACTION_CallFunction:
|
||||||
|
|||||||
@@ -192,24 +192,6 @@ func (s *ShootsIOSDriver) GetForegroundApp() (app types.AppInfo, err error) {
|
|||||||
return s.WDADriver.GetForegroundApp()
|
return s.WDADriver.GetForegroundApp()
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartCamera Starts a new camera for recording
|
|
||||||
func (s *ShootsIOSDriver) StartCamera() error {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return s.WDADriver.StartCamera()
|
|
||||||
}
|
|
||||||
|
|
||||||
// StopCamera Stops the camera for recording
|
|
||||||
func (s *ShootsIOSDriver) StopCamera() error {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return s.WDADriver.StopCamera()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ShootsIOSDriver) Orientation() (orientation types.Orientation, err error) {
|
func (s *ShootsIOSDriver) Orientation() (orientation types.Orientation, err error) {
|
||||||
err = s.setUpWda()
|
err = s.setUpWda()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -257,26 +239,6 @@ func (s *ShootsIOSDriver) Drag(fromX, fromY, toX, toY float64, opts ...option.Ac
|
|||||||
return s.WDADriver.Drag(fromX, fromY, toX, toY, opts...)
|
return s.WDADriver.Drag(fromX, fromY, toX, toY, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPasteboard Sets data to the general pasteboard
|
|
||||||
func (s *ShootsIOSDriver) SetPasteboard(contentType types.PasteboardType, content string) error {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return s.WDADriver.SetPasteboard(contentType, content)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPasteboard Gets the data contained in the general pasteboard.
|
|
||||||
//
|
|
||||||
// It worked when `WDA` was foreground. https://github.com/appium/WebDriverAgent/issues/330
|
|
||||||
func (s *ShootsIOSDriver) GetPasteboard(contentType types.PasteboardType) (raw *bytes.Buffer, err error) {
|
|
||||||
err = s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return s.WDADriver.GetPasteboard(contentType)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ShootsIOSDriver) SetIme(ime string) error {
|
func (s *ShootsIOSDriver) SetIme(ime string) error {
|
||||||
err := s.setUpWda()
|
err := s.setUpWda()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -305,12 +267,12 @@ func (s *ShootsIOSDriver) Input(text string, opts ...option.ActionOption) error
|
|||||||
return s.WDADriver.Input(text, opts...)
|
return s.WDADriver.Input(text, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShootsIOSDriver) Clear(packageName string) error {
|
func (s *ShootsIOSDriver) AppClear(packageName string) error {
|
||||||
err := s.setUpWda()
|
err := s.setUpWda()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return s.WDADriver.Clear(packageName)
|
return s.WDADriver.AppClear(packageName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PressButton Presses the corresponding hardware button on the device
|
// PressButton Presses the corresponding hardware button on the device
|
||||||
@@ -376,52 +338,6 @@ func (s *ShootsIOSDriver) TapByTexts(actions ...uixt.TapTextAction) error {
|
|||||||
return s.WDADriver.TapByTexts(actions...)
|
return s.WDADriver.TapByTexts(actions...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccessibleSource Return application elements accessibility tree
|
|
||||||
func (s *ShootsIOSDriver) AccessibleSource() (string, error) {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return s.WDADriver.AccessibleSource()
|
|
||||||
}
|
|
||||||
|
|
||||||
// HealthCheck Health check might modify simulator state so it should only be called in-between testing sessions
|
|
||||||
//
|
|
||||||
// Checks health of XCTest by:
|
|
||||||
// 1) Querying application for some elements,
|
|
||||||
// 2) Triggering some device events.
|
|
||||||
func (s *ShootsIOSDriver) HealthCheck() error {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return s.WDADriver.HealthCheck()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ShootsIOSDriver) GetAppiumSettings() (map[string]interface{}, error) {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return s.WDADriver.GetAppiumSettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ShootsIOSDriver) SetAppiumSettings(settings map[string]interface{}) (map[string]interface{}, error) {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return s.WDADriver.SetAppiumSettings(settings)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ShootsIOSDriver) IsHealthy() (bool, error) {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
return s.WDADriver.IsHealthy()
|
|
||||||
}
|
|
||||||
|
|
||||||
// triggers the log capture and returns the log entries
|
// triggers the log capture and returns the log entries
|
||||||
func (s *ShootsIOSDriver) StartCaptureLog(identifier ...string) (err error) {
|
func (s *ShootsIOSDriver) StartCaptureLog(identifier ...string) (err error) {
|
||||||
err = s.setUpWda()
|
err = s.setUpWda()
|
||||||
|
|||||||
@@ -147,14 +147,6 @@ func (hd *HDCDriver) AssertForegroundApp(packageName string, activityType ...str
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hd *HDCDriver) StartCamera() error {
|
|
||||||
return types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) StopCamera() error {
|
|
||||||
return types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) Orientation() (orientation types.Orientation, err error) {
|
func (hd *HDCDriver) Orientation() (orientation types.Orientation, err error) {
|
||||||
return types.OrientationPortrait, nil
|
return types.OrientationPortrait, nil
|
||||||
}
|
}
|
||||||
@@ -213,14 +205,6 @@ func (hd *HDCDriver) Swipe(fromX, fromY, toX, toY float64, opts ...option.Action
|
|||||||
return hd.uiDriver.InjectGesture(ghdc.NewGesture().Start(ghdc.Point{X: int(fromX), Y: int(fromY)}).MoveTo(ghdc.Point{X: int(toX), Y: int(toY)}, duration))
|
return hd.uiDriver.InjectGesture(ghdc.NewGesture().Start(ghdc.Point{X: int(fromX), Y: int(fromY)}).MoveTo(ghdc.Point{X: int(toX), Y: int(toY)}, duration))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hd *HDCDriver) SetPasteboard(contentType types.PasteboardType, content string) error {
|
|
||||||
return types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) GetPasteboard(contentType types.PasteboardType) (raw *bytes.Buffer, err error) {
|
|
||||||
return nil, types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) SetIme(ime string) error {
|
func (hd *HDCDriver) SetIme(ime string) error {
|
||||||
return types.ErrDriverNotImplemented
|
return types.ErrDriverNotImplemented
|
||||||
}
|
}
|
||||||
@@ -233,7 +217,7 @@ func (hd *HDCDriver) Input(text string, opts ...option.ActionOption) error {
|
|||||||
return hd.uiDriver.InputText(text)
|
return hd.uiDriver.InputText(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hd *HDCDriver) Clear(packageName string) error {
|
func (hd *HDCDriver) AppClear(packageName string) error {
|
||||||
return types.ErrDriverNotImplemented
|
return types.ErrDriverNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,26 +273,6 @@ func (hd *HDCDriver) TapByTexts(actions ...TapTextAction) error {
|
|||||||
return types.ErrDriverNotImplemented
|
return types.ErrDriverNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hd *HDCDriver) AccessibleSource() (string, error) {
|
|
||||||
return "", types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) HealthCheck() error {
|
|
||||||
return types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) GetAppiumSettings() (map[string]interface{}, error) {
|
|
||||||
return nil, types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) SetAppiumSettings(settings map[string]interface{}) (map[string]interface{}, error) {
|
|
||||||
return nil, types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) IsHealthy() (bool, error) {
|
|
||||||
return false, types.ErrDriverNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *HDCDriver) StartCaptureLog(identifier ...string) (err error) {
|
func (hd *HDCDriver) StartCaptureLog(identifier ...string) (err error) {
|
||||||
return types.ErrDriverNotImplemented
|
return types.ErrDriverNotImplemented
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,11 +203,11 @@ func (dev *IOSDevice) getAppInfo(packageName string) (appInfo types.AppInfo, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (dev *IOSDevice) NewDriver() (driver IDriver, err error) {
|
func (dev *IOSDevice) NewDriver() (driver IDriver, err error) {
|
||||||
driver, err = NewWDADriver(dev)
|
wdaDriver, err := NewWDADriver(dev)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to init WDA driver")
|
return nil, errors.Wrap(err, "failed to init WDA driver")
|
||||||
}
|
}
|
||||||
settings, err := driver.SetAppiumSettings(map[string]interface{}{
|
settings, err := wdaDriver.SetAppiumSettings(map[string]interface{}{
|
||||||
"snapshotMaxDepth": dev.Options.SnapshotMaxDepth,
|
"snapshotMaxDepth": dev.Options.SnapshotMaxDepth,
|
||||||
"acceptAlertButtonSelector": dev.Options.AcceptAlertButtonSelector,
|
"acceptAlertButtonSelector": dev.Options.AcceptAlertButtonSelector,
|
||||||
})
|
})
|
||||||
@@ -218,22 +218,22 @@ func (dev *IOSDevice) NewDriver() (driver IDriver, err error) {
|
|||||||
|
|
||||||
if dev.Options.ResetHomeOnStartup {
|
if dev.Options.ResetHomeOnStartup {
|
||||||
log.Info().Msg("go back to home screen")
|
log.Info().Msg("go back to home screen")
|
||||||
if err = driver.Homescreen(); err != nil {
|
if err = wdaDriver.Homescreen(); err != nil {
|
||||||
return nil, errors.Wrap(code.MobileUIDriverError,
|
return nil, errors.Wrap(code.MobileUIDriverError,
|
||||||
fmt.Sprintf("go back to home screen failed: %v", err))
|
fmt.Sprintf("go back to home screen failed: %v", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if dev.Options.LogOn {
|
if dev.Options.LogOn {
|
||||||
err = driver.StartCaptureLog("hrp_wda_log")
|
err = wdaDriver.StartCaptureLog("hrp_wda_log")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// setup driver
|
// setup driver
|
||||||
if err := driver.Setup(); err != nil {
|
if err := wdaDriver.Setup(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return driver, nil
|
return wdaDriver, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dev *IOSDevice) Install(appPath string, opts ...option.InstallOption) (err error) {
|
func (dev *IOSDevice) Install(appPath string, opts ...option.InstallOption) (err error) {
|
||||||
|
|||||||
+12
-29
@@ -674,7 +674,7 @@ func (wd *WDADriver) Input(text string, opts ...option.ActionOption) (err error)
|
|||||||
return wd.SendKeys(text, opts...)
|
return wd.SendKeys(text, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *WDADriver) Clear(packageName string) error {
|
func (wd *WDADriver) AppClear(packageName string) error {
|
||||||
return types.ErrDriverNotImplemented
|
return types.ErrDriverNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,23 +722,6 @@ func (wd *WDADriver) PressButton(devBtn types.DeviceButton) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *WDADriver) StartCamera() (err error) {
|
|
||||||
// start camera, alias for app_launch com.apple.camera
|
|
||||||
return wd.AppLaunch("com.apple.camera")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (wd *WDADriver) StopCamera() (err error) {
|
|
||||||
// stop camera, alias for app_terminate com.apple.camera
|
|
||||||
success, err := wd.AppTerminate("com.apple.camera")
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "failed to terminate camera")
|
|
||||||
}
|
|
||||||
if !success {
|
|
||||||
log.Warn().Msg("camera was not running")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (wd *WDADriver) Orientation() (orientation types.Orientation, err error) {
|
func (wd *WDADriver) Orientation() (orientation types.Orientation, err error) {
|
||||||
// [[FBRoute GET:@"/orientation"] respondWithTarget:self action:@selector(handleGetOrientation:)]
|
// [[FBRoute GET:@"/orientation"] respondWithTarget:self action:@selector(handleGetOrientation:)]
|
||||||
var rawResp DriverRawResponse
|
var rawResp DriverRawResponse
|
||||||
@@ -859,6 +842,17 @@ func (wd *WDADriver) HealthCheck() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (wd *WDADriver) IsHealthy() (healthy bool, err error) {
|
||||||
|
var rawResp DriverRawResponse
|
||||||
|
if rawResp, err = wd.httpGET("/health"); err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if string(rawResp) != "I-AM-ALIVE" {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (wd *WDADriver) GetAppiumSettings() (settings map[string]interface{}, err error) {
|
func (wd *WDADriver) GetAppiumSettings() (settings map[string]interface{}, err error) {
|
||||||
// [[FBRoute GET:@"/appium/settings"] respondWithTarget:self action:@selector(handleGetSettings:)]
|
// [[FBRoute GET:@"/appium/settings"] respondWithTarget:self action:@selector(handleGetSettings:)]
|
||||||
var rawResp DriverRawResponse
|
var rawResp DriverRawResponse
|
||||||
@@ -888,17 +882,6 @@ func (wd *WDADriver) SetAppiumSettings(settings map[string]interface{}) (ret map
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *WDADriver) IsHealthy() (healthy bool, err error) {
|
|
||||||
var rawResp DriverRawResponse
|
|
||||||
if rawResp, err = wd.httpGET("/health"); err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
if string(rawResp) != "I-AM-ALIVE" {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (wd *WDADriver) WdaShutdown() (err error) {
|
func (wd *WDADriver) WdaShutdown() (err error) {
|
||||||
_, err = wd.httpGET("/wda/shutdown")
|
_, err = wd.httpGET("/wda/shutdown")
|
||||||
return
|
return
|
||||||
|
|||||||
+5
-42
@@ -3,7 +3,6 @@
|
|||||||
package uixt
|
package uixt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@@ -128,7 +127,7 @@ func Test_remoteWD_DeleteSession(t *testing.T) {
|
|||||||
func Test_remoteWD_HealthCheck(t *testing.T) {
|
func Test_remoteWD_HealthCheck(t *testing.T) {
|
||||||
setup(t)
|
setup(t)
|
||||||
|
|
||||||
err := driver.HealthCheck()
|
err := driver.(*WDADriver).HealthCheck()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -137,7 +136,7 @@ func Test_remoteWD_HealthCheck(t *testing.T) {
|
|||||||
func Test_remoteWD_GetAppiumSettings(t *testing.T) {
|
func Test_remoteWD_GetAppiumSettings(t *testing.T) {
|
||||||
setup(t)
|
setup(t)
|
||||||
|
|
||||||
settings, err := driver.GetAppiumSettings()
|
settings, err := driver.(*WDADriver).GetAppiumSettings()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -154,7 +153,7 @@ func Test_remoteWD_SetAppiumSettings(t *testing.T) {
|
|||||||
value := _acceptAlertButtonSelector
|
value := _acceptAlertButtonSelector
|
||||||
|
|
||||||
// settings, err := driver.SetAppiumSettings(map[string]interface{}{"dismissAlertButtonSelector": "暂不"})
|
// settings, err := driver.SetAppiumSettings(map[string]interface{}{"dismissAlertButtonSelector": "暂不"})
|
||||||
settings, err := driver.SetAppiumSettings(map[string]interface{}{key: value})
|
settings, err := driver.(*WDADriver).SetAppiumSettings(map[string]interface{}{key: value})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -166,7 +165,7 @@ func Test_remoteWD_SetAppiumSettings(t *testing.T) {
|
|||||||
func Test_remoteWD_IsWdaHealthy(t *testing.T) {
|
func Test_remoteWD_IsWdaHealthy(t *testing.T) {
|
||||||
setup(t)
|
setup(t)
|
||||||
|
|
||||||
healthy, err := driver.IsHealthy()
|
healthy, err := driver.(*WDADriver).IsHealthy()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -315,42 +314,6 @@ func Test_Relative_Drag(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_remoteWD_SetPasteboard(t *testing.T) {
|
|
||||||
setup(t)
|
|
||||||
|
|
||||||
// err := driver.SetPasteboard(PasteboardTypePlaintext, "gwda")
|
|
||||||
err := driver.SetPasteboard(types.PasteboardTypeUrl, "Clock-stopwatch://")
|
|
||||||
// userHomeDir, _ := os.UserHomeDir()
|
|
||||||
// bytesImg, _ := ioutil.ReadFile(userHomeDir + "/Pictures/IMG_0806.jpg")
|
|
||||||
// err := driver.SetPasteboard(PasteboardTypeImage, string(bytesImg))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_remoteWD_GetPasteboard(t *testing.T) {
|
|
||||||
setup(t)
|
|
||||||
|
|
||||||
var buffer *bytes.Buffer
|
|
||||||
var err error
|
|
||||||
|
|
||||||
buffer, err = driver.GetPasteboard(types.PasteboardTypePlaintext)
|
|
||||||
// buffer, err = driver.GetPasteboard(PasteboardTypeUrl)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
t.Log(buffer.String())
|
|
||||||
|
|
||||||
// buffer, err = driver.GetPasteboard(PasteboardTypeImage)
|
|
||||||
// if err != nil {
|
|
||||||
// t.Fatal(err)
|
|
||||||
// }
|
|
||||||
// userHomeDir, _ := os.UserHomeDir()
|
|
||||||
// if err = ioutil.WriteFile(userHomeDir+"/Desktop/p1.png", buffer.Bytes(), 0600); err != nil {
|
|
||||||
// t.Error(err)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_remoteWD_SendKeys(t *testing.T) {
|
func Test_remoteWD_SendKeys(t *testing.T) {
|
||||||
setup(t)
|
setup(t)
|
||||||
// driver.StartCaptureLog("hrp_wda_log")
|
// driver.StartCaptureLog("hrp_wda_log")
|
||||||
@@ -460,7 +423,7 @@ func TestGetForegroundApp(t *testing.T) {
|
|||||||
func Test_remoteWD_AccessibleSource(t *testing.T) {
|
func Test_remoteWD_AccessibleSource(t *testing.T) {
|
||||||
setup(t)
|
setup(t)
|
||||||
|
|
||||||
source, err := driver.AccessibleSource()
|
source, err := driver.(*WDADriver).AccessibleSource()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ func (r *HRPRunner) Run(testcases ...ITestCase) (err error) {
|
|||||||
// release UI driver session
|
// release UI driver session
|
||||||
defer func() {
|
defer func() {
|
||||||
for _, client := range caseRunner.uixtDrivers {
|
for _, client := range caseRunner.uixtDrivers {
|
||||||
client.GetDriver().DeleteSession()
|
client.Driver.DeleteSession()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ func clearAppHandler(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dExt.GetDriver().Clear(appClearReq.PackageName)
|
err = dExt.Driver.AppClear(appClearReq.PackageName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Err(err).Msg(fmt.Sprintf("[%s]: failed to unlick screen", c.HandlerName()))
|
log.Err(err).Msg(fmt.Sprintf("[%s]: failed to unlick screen", c.HandlerName()))
|
||||||
c.JSON(http.StatusInternalServerError,
|
c.JSON(http.StatusInternalServerError,
|
||||||
|
|||||||
@@ -370,24 +370,6 @@ func (s *StepMobile) ScreenShot(opts ...option.ActionOption) *StepMobile {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepMobile) StartCamera() *StepMobile {
|
|
||||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
|
||||||
Method: uixt.ACTION_StartCamera,
|
|
||||||
Params: nil,
|
|
||||||
Options: nil,
|
|
||||||
})
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StepMobile) StopCamera() *StepMobile {
|
|
||||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
|
||||||
Method: uixt.ACTION_StopCamera,
|
|
||||||
Params: nil,
|
|
||||||
Options: nil,
|
|
||||||
})
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StepMobile) DisableAutoPopupHandler() *StepMobile {
|
func (s *StepMobile) DisableAutoPopupHandler() *StepMobile {
|
||||||
s.IgnorePopup = true
|
s.IgnorePopup = true
|
||||||
return s
|
return s
|
||||||
|
|||||||
@@ -68,54 +68,6 @@ func TestIOSAppLaunch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIOSCameraPhotoCapture(t *testing.T) {
|
|
||||||
testCase := &TestCase{
|
|
||||||
Config: NewConfig("ios camera photo capture"),
|
|
||||||
TestSteps: []IStep{
|
|
||||||
NewStep("launch camera").
|
|
||||||
IOS().Home().
|
|
||||||
StopCamera().
|
|
||||||
StartCamera().
|
|
||||||
Validate().
|
|
||||||
AssertLabelExists("PhotoCapture", "拍照按钮不存在"),
|
|
||||||
NewStep("start recording").
|
|
||||||
IOS().Tap("PhotoCapture"),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
err := NewRunner(t).Run(testCase)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestIOSCameraVideoCapture(t *testing.T) {
|
|
||||||
testCase := &TestCase{
|
|
||||||
Config: NewConfig("ios camera video capture"),
|
|
||||||
TestSteps: []IStep{
|
|
||||||
NewStep("launch camera").
|
|
||||||
IOS().Home().
|
|
||||||
StopCamera().
|
|
||||||
StartCamera().
|
|
||||||
Validate().
|
|
||||||
AssertLabelExists("PhotoCapture", "录像按钮不存在"),
|
|
||||||
NewStep("switch to video capture").
|
|
||||||
IOS().
|
|
||||||
SwipeRight().
|
|
||||||
Validate().
|
|
||||||
AssertLabelExists("VideoCapture", "拍摄按钮不存在"),
|
|
||||||
NewStep("start recording").
|
|
||||||
IOS().
|
|
||||||
Tap("VideoCapture"). // 开始录像
|
|
||||||
Sleep(5).
|
|
||||||
Tap("VideoCapture"), // 停止录像
|
|
||||||
},
|
|
||||||
}
|
|
||||||
err := NewRunner(t).Run(testCase)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestIOSDouyinAction(t *testing.T) {
|
func TestIOSDouyinAction(t *testing.T) {
|
||||||
testCase := &TestCase{
|
testCase := &TestCase{
|
||||||
Config: NewConfig("ios ui action on 抖音"),
|
Config: NewConfig("ios ui action on 抖音"),
|
||||||
|
|||||||
Reference in New Issue
Block a user