mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 06:23:52 +08:00
refactor: move android options to pkg/uixt/options
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
hrp "github.com/httprunner/httprunner/v5"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
)
|
||||
|
||||
func TestAndroidDouyinE2E(t *testing.T) {
|
||||
@@ -14,7 +15,9 @@ func TestAndroidDouyinE2E(t *testing.T) {
|
||||
"device": "${ENV(SerialNumber)}",
|
||||
"ups": "${ENV(LIVEUPLIST)}",
|
||||
}).
|
||||
SetAndroid(uixt.WithSerialNumber("$device"), uixt.WithAdbLogOn(true)),
|
||||
SetAndroid(
|
||||
options.WithSerialNumber("$device"),
|
||||
options.WithAdbLogOn(true)),
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.NewStep("启动抖音").
|
||||
Android().
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -28,7 +29,7 @@ func init() {
|
||||
}
|
||||
|
||||
func launchAppDriver(pkgName string) (driver *uixt.DriverExt, err error) {
|
||||
device, _ := uixt.NewAndroidDevice(uixt.WithSerialNumber(serial))
|
||||
device, _ := uixt.NewAndroidDevice(options.WithSerialNumber(serial))
|
||||
driver, err = device.NewDriver()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
hrp "github.com/httprunner/httprunner/v5"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
)
|
||||
|
||||
func TestAndroidDouyinFeedTest(t *testing.T) {
|
||||
@@ -15,7 +16,7 @@ func TestAndroidDouyinFeedTest(t *testing.T) {
|
||||
WithVariables(map[string]interface{}{
|
||||
"device": "${ENV(SerialNumber)}",
|
||||
}).
|
||||
SetAndroid(uixt.WithSerialNumber("$device")),
|
||||
SetAndroid(options.WithSerialNumber("$device")),
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.NewStep("启动抖音").
|
||||
Android().
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
hrp "github.com/httprunner/httprunner/v5"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
)
|
||||
|
||||
func TestAndroidLiveSwipeTest(t *testing.T) {
|
||||
@@ -15,7 +16,7 @@ func TestAndroidLiveSwipeTest(t *testing.T) {
|
||||
WithVariables(map[string]interface{}{
|
||||
"device": "${ENV(SerialNumber)}",
|
||||
}).
|
||||
SetAndroid(uixt.WithSerialNumber("$device")),
|
||||
SetAndroid(options.WithSerialNumber("$device")),
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.NewStep("启动抖音").
|
||||
Android().
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
hrp "github.com/httprunner/httprunner/v5"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
)
|
||||
|
||||
func TestHamonyDouyinFeedTest(t *testing.T) {
|
||||
@@ -16,7 +16,7 @@ func TestHamonyDouyinFeedTest(t *testing.T) {
|
||||
"device": "a38c2c5c",
|
||||
"query": "${ENV(query)}",
|
||||
}).
|
||||
SetAndroid(uixt.WithSerialNumber("$device")),
|
||||
SetAndroid(options.WithSerialNumber("$device")),
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.NewStep("启动抖音").
|
||||
Android().
|
||||
|
||||
@@ -18,9 +18,9 @@ func TestAndroidExpertTest(t *testing.T) {
|
||||
"app_name": "抖音",
|
||||
}).
|
||||
SetAndroid(
|
||||
uixt.WithSerialNumber("$device"),
|
||||
uixt.WithAdbLogOn(true),
|
||||
uixt.WithUIA2(true),
|
||||
options.WithSerialNumber("$device"),
|
||||
options.WithAdbLogOn(true),
|
||||
options.WithUIA2(true),
|
||||
),
|
||||
TestSteps: []hrp.IStep{
|
||||
// 温启动
|
||||
|
||||
@@ -51,7 +51,7 @@ func initIOSDevice(uuid string) uixt.IDevice {
|
||||
}
|
||||
|
||||
func initAndroidDevice(uuid string) uixt.IDevice {
|
||||
device, err := uixt.NewAndroidDevice(uixt.WithSerialNumber(uuid))
|
||||
device, err := uixt.NewAndroidDevice(options.WithSerialNumber(uuid))
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("failed to init android device")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user