refactor ios: replace gidevice with go-ios

This commit is contained in:
lilong.129
2024-11-23 14:12:07 +08:00
parent 8aac2181be
commit ef37d88e0b
118 changed files with 2202 additions and 11764 deletions

View File

@@ -37,33 +37,11 @@ func convertTimeToSeconds(timeStr string) (int, error) {
}
func initIOSDevice(uuid string) uixt.IDevice {
perfOptions := []uixt.IOSPerfOption{}
for _, p := range perf {
switch p {
case "sys_cpu":
perfOptions = append(perfOptions, uixt.WithIOSPerfSystemCPU(true))
case "sys_mem":
perfOptions = append(perfOptions, uixt.WithIOSPerfSystemMem(true))
case "sys_net":
perfOptions = append(perfOptions, uixt.WithIOSPerfSystemNetwork(true))
case "sys_disk":
perfOptions = append(perfOptions, uixt.WithIOSPerfSystemDisk(true))
case "network":
perfOptions = append(perfOptions, uixt.WithIOSPerfNetwork(true))
case "fps":
perfOptions = append(perfOptions, uixt.WithIOSPerfFPS(true))
case "gpu":
perfOptions = append(perfOptions, uixt.WithIOSPerfGPU(true))
}
}
perfOptions = append(perfOptions, uixt.WithIOSPerfOutputInterval(interval*1000))
device, err := uixt.NewIOSDevice(
uixt.WithUDID(uuid),
uixt.WithWDAPort(8700), uixt.WithWDAMjpegPort(8800),
uixt.WithResetHomeOnStartup(false), // not reset home on startup
uixt.WithIOSPerfOptions(perfOptions...),
uixt.WithXCTest("com.gtf.wda.runner.xctrunner"),
)
if err != nil {
log.Fatal().Err(err).Msg("failed to init ios device")
@@ -267,7 +245,6 @@ func (wc *WorldCupLive) dumpResult() error {
encoder.SetEscapeHTML(false)
encoder.SetIndent("", " ")
wc.PerfFile = wc.driver.Device.StopPerf()
err := encoder.Encode(wc)
if err != nil {
log.Error().Err(err).Msg("encode json failed")

View File

@@ -59,17 +59,6 @@ func TestIOSDouyinWorldCupLive(t *testing.T) {
uixt.WithWDALogOn(true),
uixt.WithWDAPort(8700),
uixt.WithWDAMjpegPort(8800),
uixt.WithXCTest("com.gtf.wda.runner.xctrunner"),
uixt.WithIOSPerfOptions(
uixt.WithIOSPerfNetwork(true),
// uixt.WithIOSPerfBundleID("com.ss.iphone.ugc.Aweme"),
),
uixt.WithIOSPcapOptions(
// uixt.WithIOSPcapAll(true),
// uixt.WithIOSPcapPID(1234),
// uixt.WithIOSPcapProcName("Awe"),
uixt.WithIOSPcapBundleID("com.ss.iphone.ugc.Aweme"),
),
),
TestSteps: []hrp.IStep{
hrp.NewStep("启动抖音").