Skip to content

Commit

Permalink
Enhancements (#118)
Browse files Browse the repository at this point in the history
* No longer require go-ios binary to be present on system path, go-ios modules are used instead
* Add support for iOS 17.4+ on Windows/Linux
* Improvements on device provisioning stability
  • Loading branch information
shamanec authored Aug 10, 2024
1 parent ed660c9 commit 75453be
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 311 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ Supports Linux, macOS and Windows - notes below
- Appium test execution - each device has its Appium server proxied on a provider endpoint for easier access
- Optionally Selenium Grid 4 nodes can be registered for each device Appium server
- macOS
- Supports both Android and iOS
- Supports both Android / iOS
- Linux
- Supports both Android and iOS < 17
- Supports both Android / iOS < 17 && iOS >= 17.4
- Has some limitations to Appium execution with iOS devices due to actual Xcode tools being unavailable on Linux
- Windows 10
- Supports Android and iOS < 17
- Supports Android / iOS < 17 && ios >= 17.4
- Has some limitations to Appium execution with iOS devices due to actual Xcode tools being unavailable on Windows

Developed and tested on Ubuntu 18.04 LTS, Ubuntu 20.04 LTS, Windows 10, macOS Ventura 13.5.1
Expand Down
39 changes: 21 additions & 18 deletions common/models/config.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
package models

import "github.com/danielpaulus/go-ios/ios/tunnel"

type Provider struct {
OS string `json:"os" bson:"os"`
Nickname string `json:"nickname" bson:"nickname"`
HostAddress string `json:"host_address" bson:"host_address"`
Port int `json:"port" bson:"port"`
UseSeleniumGrid bool `json:"use_selenium_grid" bson:"use_selenium_grid"`
SeleniumGrid string `json:"selenium_grid" bson:"selenium_grid"`
ProvideAndroid bool `json:"provide_android" bson:"provide_android"`
ProvideIOS bool `json:"provide_ios" bson:"provide_ios"`
WdaBundleID string `json:"wda_bundle_id" bson:"wda_bundle_id"`
WdaRepoPath string `json:"wda_repo_path" bson:"wda_repo_path"`
SupervisionPassword string `json:"supervision_password" bson:"supervision_password"`
ProviderFolder string `json:"-" bson:"-"`
LastUpdatedTimestamp int64 `json:"last_updated" bson:"last_updated"`
ProvidedDevices []Device `json:"provided_devices" bson:"provided_devices"`
WebDriverBinary string `json:"-" bson:"-"`
UseGadsIosStream bool `json:"use_gads_ios_stream" bson:"use_gads_ios_stream"`
UseCustomWDA bool `json:"use_custom_wda" bson:"use_custom_wda"`
HubAddress string `json:"hub_address" bson:"-"`
OS string `json:"os" bson:"os"`
Nickname string `json:"nickname" bson:"nickname"`
HostAddress string `json:"host_address" bson:"host_address"`
Port int `json:"port" bson:"port"`
UseSeleniumGrid bool `json:"use_selenium_grid" bson:"use_selenium_grid"`
SeleniumGrid string `json:"selenium_grid" bson:"selenium_grid"`
ProvideAndroid bool `json:"provide_android" bson:"provide_android"`
ProvideIOS bool `json:"provide_ios" bson:"provide_ios"`
WdaBundleID string `json:"wda_bundle_id" bson:"wda_bundle_id"`
WdaRepoPath string `json:"wda_repo_path" bson:"wda_repo_path"`
SupervisionPassword string `json:"supervision_password" bson:"supervision_password"`
ProviderFolder string `json:"-" bson:"-"`
LastUpdatedTimestamp int64 `json:"last_updated" bson:"last_updated"`
ProvidedDevices []Device `json:"provided_devices" bson:"provided_devices"`
WebDriverBinary string `json:"-" bson:"-"`
UseGadsIosStream bool `json:"use_gads_ios_stream" bson:"use_gads_ios_stream"`
UseCustomWDA bool `json:"use_custom_wda" bson:"use_custom_wda"`
HubAddress string `json:"hub_address" bson:"-"`
GoIOSPairRecordManager tunnel.PairRecordManager `json:"-" bson:"-"`
}

type ProviderData struct {
Expand Down
5 changes: 5 additions & 0 deletions common/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"context"
"sync"

"github.com/Masterminds/semver"
"github.com/danielpaulus/go-ios/ios"
"github.com/danielpaulus/go-ios/ios/tunnel"
)

type CustomLogger interface {
Expand Down Expand Up @@ -70,6 +72,9 @@ type Device struct {
Logger CustomLogger `json:"-" bson:"-"` // CustomLogger object for the device
AppiumLogger AppiumLogger `json:"-" bson:"-"` // AppiumLogger object for logging appium actions
Mutex sync.Mutex `json:"-" bson:"-"` // Mutex to lock resources - especially on device reset
GoIOSTunnel tunnel.Tunnel `json:"-" bson:"-"` // Tunnel obj for go-ios handling of iOS 17.4+
SemVer *semver.Version `json:"-" bson:"-"` // Semantic version of device for checks around the provider
InitialSetupDone bool `json:"-" bson:"-"` // On provider startup some data is prepared for devices like logger, Mongo collection, etc. This is true if all is done
}

type LocalHubDevice struct {
Expand Down
11 changes: 0 additions & 11 deletions docs/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ Refer to the `--provider-folder` flag in [Running a provider instance](#running-
- Enable [USB Debugging](#usb-debugging) on each Android device

#### iOS
- Install [go-ios](#go-ios) if providing iOS devices
- Install [usbmuxd](#usbmuxd) if providing iOS devices
- Prepare [WebDriverAgent](#prepare-webdriveragent-on-macos)
- [Optional] [Supervise](#supervise-devices) your iOS devices

Expand All @@ -56,7 +54,6 @@ Refer to the `--provider-folder` flag in [Running a provider instance](#running-
- Enabled [USB Debugging](#usb-debugging) on each Android device

#### iOS
- Install [go-ios](#go-ios) if providing iOS devices
- Install [usbmuxd](#usbmuxd) if providing iOS devices
- Prepare [WebDriverAgent](#prepare-webdriveragent-file---linux-windows) file
- [Optional] [Supervise](#supervise-devices) your iOS devices
Expand All @@ -74,7 +71,6 @@ Refer to the `--provider-folder` flag in [Running a provider instance](#running-
- Enabled [USB Debugging](#usb-debugging) on each Android device

#### iOS
- Install [go-ios](#go-ios) if providing iOS devices
- Install [iTunes](#itunes) if providing iOS devices
- Prepare [WebDriverAgent](#prepare-webdriveragent-file---linux-windows) file
- [Optional] [Supervise](#supervise-devices) your iOS devices
Expand Down Expand Up @@ -107,13 +103,6 @@ Installation is pretty similar for all operating systems, you just have to find
`adb` (Android Debug Bridge) is mandatory when providing Android devices. You can skip installing it if no Android devices will be provided.
- Install `adb` in a valid way for the provider OS. It should be available in PATH so it can be directly accessed via terminal

#### go-ios
`go-ios` is mandatory when providing iOS devices on any host OS
- Download the latest release of [go-ios](https://github.com/danielpaulus/go-ios) for the provider host OS and unzip it
- On macOS - Add it to `/usr/local/bin` with `sudo cp ios /usr/local/bin` or to PATH
- On Linux - Add it to `/usr/local/bin` with `sudo cp ios /usr/local/bin` or to PATH
- On Windows - add it to system PATH so that it is available in terminal

#### iTunes
`iTunes` is needed only on Windows and mandatory when providing iOS devices. Install it through an installation package or Microsoft Store, shouldn't really matter

Expand Down
23 changes: 21 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module GADS

go 1.21
go 1.22.0

toolchain go1.22.6

require (
github.com/Masterminds/semver v1.5.0
github.com/danielpaulus/go-ios v1.0.123
github.com/danielpaulus/go-ios v1.0.135
github.com/gin-contrib/static v0.0.1
github.com/gin-gonic/gin v1.9.0
github.com/gobwas/ws v1.4.0
Expand All @@ -16,33 +18,50 @@ require (
require (
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobwas/httphead v0.1.0 // indirect
github.com/gobwas/pool v0.2.1 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/grandcat/zeroconf v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect
github.com/miekg/dns v1.1.61 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/onsi/ginkgo/v2 v2.9.5 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/quic-go/qtls-go1-20 v0.4.1 // indirect
github.com/quic-go/quic-go v0.40.1-0.20231203135336-87ef8ec48d55 // indirect
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tadglines/go-pkgs v0.0.0-20210623144937-b983b20f54f9 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect
go.uber.org/mock v0.3.0 // indirect
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gvisor.dev/gvisor v0.0.0-20240405191320-0878b34101b5 // indirect
howett.net/plist v1.0.1 // indirect
software.sslmate.com/src/go-pkcs12 v0.4.0 // indirect
)
Expand Down
Loading

0 comments on commit 75453be

Please sign in to comment.