mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 15:37:35 +08:00
Merge branch 'v5-feat' into 'v5'
V5 feat See merge request iesqa/httprunner!69
This commit is contained in:
@@ -28,7 +28,7 @@ jobs:
|
|||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
goos: ${{ matrix.goos }}
|
goos: ${{ matrix.goos }}
|
||||||
goarch: ${{ matrix.goarch }}
|
goarch: ${{ matrix.goarch }}
|
||||||
project_path: "hrp/cmd/cli/" # go build hrp/cmd/cli/main.go
|
project_path: "cmd/cli/" # go build cmd/cli/main.go
|
||||||
binary_name: "hrp"
|
binary_name: "hrp"
|
||||||
ldflags: "-s -w"
|
ldflags: "-s -w"
|
||||||
extra_files: LICENSE README.md docs/CHANGELOG.md
|
extra_files: LICENSE README.md docs/CHANGELOG.md
|
||||||
|
|||||||
+25
-7
@@ -74,14 +74,32 @@ $ hrp -h
|
|||||||
██║ ██║ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║██║ ╚████║███████╗██║ ██║
|
██║ ██║ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║██║ ╚████║███████╗██║ ██║
|
||||||
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
|
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
|
||||||
|
|
||||||
HttpRunner is an open source API testing tool that supports HTTP(S)/HTTP2/WebSocket/RPC
|
HttpRunner: Enjoy your All-in-One Testing Solution ✨ 🚀 ✨
|
||||||
network protocols, covering API testing, performance testing and digital experience
|
|
||||||
monitoring (DEM) test types. Enjoy! ✨ 🚀 ✨
|
|
||||||
|
|
||||||
License: Apache-2.0
|
💡 Simple Yet Powerful
|
||||||
|
- Natural language driven test scenarios powered by LLM
|
||||||
|
- User-friendly SDK API with IDE auto-completion
|
||||||
|
- Intuitive GoTest/YAML/JSON/Text testcase format
|
||||||
|
|
||||||
|
📌 Comprehensive Testing Capabilities
|
||||||
|
- UI Automation: Android/iOS/Harmony/Browser
|
||||||
|
- API Testing: HTTP(S)/HTTP2/WebSocket/RPC
|
||||||
|
- Load Testing: run API testcase concurrently with boomer
|
||||||
|
|
||||||
|
🧩 High Scalability
|
||||||
|
- Plugin system for custom functions
|
||||||
|
- Distributed testing support
|
||||||
|
- Cross-platform: macOS/Linux/Windows
|
||||||
|
|
||||||
|
🛠 Easy Integration
|
||||||
|
- CI/CD friendly with JSON logs and HTML reports
|
||||||
|
- Rich ecosystem tools
|
||||||
|
|
||||||
|
Learn more:
|
||||||
Website: https://httprunner.com
|
Website: https://httprunner.com
|
||||||
Github: https://github.com/httprunner/httprunner
|
GitHub: https://github.com/httprunner/httprunner
|
||||||
Copyright 2017 debugtalk
|
|
||||||
|
Copyright © 2017-present debugtalk. Apache-2.0 License.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
hrp [command]
|
hrp [command]
|
||||||
@@ -101,7 +119,7 @@ Available Commands:
|
|||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-h, --help help for hrp
|
-h, --help help for hrp
|
||||||
--log-json set log to json format
|
--log-json set log to json format (default colorized console)
|
||||||
-l, --log-level string set log level (default "INFO")
|
-l, --log-level string set log level (default "INFO")
|
||||||
--venv string specify python3 venv path
|
--venv string specify python3 venv path
|
||||||
-v, --version version for hrp
|
-v, --version version for hrp
|
||||||
|
|||||||
@@ -65,14 +65,32 @@ $ hrp -h
|
|||||||
██║ ██║ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║██║ ╚████║███████╗██║ ██║
|
██║ ██║ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║██║ ╚████║███████╗██║ ██║
|
||||||
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
|
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
|
||||||
|
|
||||||
HttpRunner is an open source API testing tool that supports HTTP(S)/HTTP2/WebSocket/RPC
|
HttpRunner: Enjoy your All-in-One Testing Solution ✨ 🚀 ✨
|
||||||
network protocols, covering API testing, performance testing and digital experience
|
|
||||||
monitoring (DEM) test types. Enjoy! ✨ 🚀 ✨
|
|
||||||
|
|
||||||
License: Apache-2.0
|
💡 Simple Yet Powerful
|
||||||
|
- Natural language driven test scenarios powered by LLM
|
||||||
|
- User-friendly SDK API with IDE auto-completion
|
||||||
|
- Intuitive GoTest/YAML/JSON/Text testcase format
|
||||||
|
|
||||||
|
📌 Comprehensive Testing Capabilities
|
||||||
|
- UI Automation: Android/iOS/Harmony/Browser
|
||||||
|
- API Testing: HTTP(S)/HTTP2/WebSocket/RPC
|
||||||
|
- Load Testing: run API testcase concurrently with boomer
|
||||||
|
|
||||||
|
🧩 High Scalability
|
||||||
|
- Plugin system for custom functions
|
||||||
|
- Distributed testing support
|
||||||
|
- Cross-platform: macOS/Linux/Windows
|
||||||
|
|
||||||
|
🛠 Easy Integration
|
||||||
|
- CI/CD friendly with JSON logs and HTML reports
|
||||||
|
- Rich ecosystem tools
|
||||||
|
|
||||||
|
Learn more:
|
||||||
Website: https://httprunner.com
|
Website: https://httprunner.com
|
||||||
Github: https://github.com/httprunner/httprunner
|
GitHub: https://github.com/httprunner/httprunner
|
||||||
Copyright 2017 debugtalk
|
|
||||||
|
Copyright © 2017-present debugtalk. Apache-2.0 License.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
hrp [command]
|
hrp [command]
|
||||||
@@ -92,7 +110,7 @@ Available Commands:
|
|||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-h, --help help for hrp
|
-h, --help help for hrp
|
||||||
--log-json set log to json format
|
--log-json set log to json format (default colorized console)
|
||||||
-l, --log-level string set log level (default "INFO")
|
-l, --log-level string set log level (default "INFO")
|
||||||
--venv string specify python3 venv path
|
--venv string specify python3 venv path
|
||||||
-v, --version version for hrp
|
-v, --version version for hrp
|
||||||
|
|||||||
+17
-11
@@ -2,13 +2,14 @@ package ios
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/v5/internal/builtin"
|
|
||||||
"github.com/httprunner/httprunner/v5/internal/sdk"
|
"github.com/httprunner/httprunner/v5/internal/sdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,6 +32,14 @@ var mountCmd = &cobra.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if unmountDeveloperDiskImage {
|
||||||
|
err := device.UnmountImage()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unmount developer disk image failed: %v", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
images, errImage := device.ListImages()
|
images, errImage := device.ListImages()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("list device images failed: %v", err)
|
return fmt.Errorf("list device images failed: %v", err)
|
||||||
@@ -47,12 +56,6 @@ var mountCmd = &cobra.Command{
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info().Str("dir", developerDiskImageDir).Msg("start to mount ios developer image")
|
|
||||||
|
|
||||||
if !builtin.IsFolderPathExists(developerDiskImageDir) {
|
|
||||||
return fmt.Errorf("developer disk image directory not exist: %s", developerDiskImageDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = device.AutoMountImage(developerDiskImageDir); err != nil {
|
if err = device.AutoMountImage(developerDiskImageDir); err != nil {
|
||||||
return fmt.Errorf("mount developer disk image failed: %s", err)
|
return fmt.Errorf("mount developer disk image failed: %s", err)
|
||||||
}
|
}
|
||||||
@@ -62,15 +65,18 @@ var mountCmd = &cobra.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultDeveloperDiskImageDir = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/"
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
developerDiskImageDir string
|
developerDiskImageDir string
|
||||||
listDeveloperDiskImage bool
|
listDeveloperDiskImage bool
|
||||||
|
unmountDeveloperDiskImage bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
home, _ := os.UserHomeDir()
|
||||||
|
defaultDeveloperDiskImageDir := path.Join(home, ".devimages")
|
||||||
|
|
||||||
mountCmd.Flags().BoolVar(&listDeveloperDiskImage, "list", false, "list developer disk images")
|
mountCmd.Flags().BoolVar(&listDeveloperDiskImage, "list", false, "list developer disk images")
|
||||||
|
mountCmd.Flags().BoolVar(&unmountDeveloperDiskImage, "reset", false, "unmount developer disk images")
|
||||||
mountCmd.Flags().StringVarP(&developerDiskImageDir, "dir", "d", defaultDeveloperDiskImageDir, "specify developer disk image directory")
|
mountCmd.Flags().StringVarP(&developerDiskImageDir, "dir", "d", defaultDeveloperDiskImageDir, "specify developer disk image directory")
|
||||||
mountCmd.Flags().StringVarP(&udid, "udid", "u", "", "specify device by udid")
|
mountCmd.Flags().StringVarP(&udid, "udid", "u", "", "specify device by udid")
|
||||||
iosRootCmd.AddCommand(mountCmd)
|
iosRootCmd.AddCommand(mountCmd)
|
||||||
|
|||||||
+25
-7
@@ -13,7 +13,7 @@ import (
|
|||||||
// rootCmd represents the base command when called without any subcommands
|
// rootCmd represents the base command when called without any subcommands
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "hrp",
|
Use: "hrp",
|
||||||
Short: "Next-Generation API Testing Solution.",
|
Short: "All-in-One Testing Framework for API, UI and Performance",
|
||||||
Long: `
|
Long: `
|
||||||
██╗ ██╗████████╗████████╗██████╗ ██████╗ ██╗ ██╗███╗ ██╗███╗ ██╗███████╗██████╗
|
██╗ ██╗████████╗████████╗██████╗ ██████╗ ██╗ ██╗███╗ ██╗███╗ ██╗███████╗██████╗
|
||||||
██║ ██║╚══██╔══╝╚══██╔══╝██╔══██╗██╔══██╗██║ ██║████╗ ██║████╗ ██║██╔════╝██╔══██╗
|
██║ ██║╚══██╔══╝╚══██╔══╝██╔══██╗██╔══██╗██║ ██║████╗ ██║████╗ ██║██╔════╝██╔══██╗
|
||||||
@@ -22,14 +22,32 @@ var rootCmd = &cobra.Command{
|
|||||||
██║ ██║ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║██║ ╚████║███████╗██║ ██║
|
██║ ██║ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║██║ ╚████║███████╗██║ ██║
|
||||||
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
|
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
|
||||||
|
|
||||||
HttpRunner is an open source API testing tool that supports HTTP(S)/HTTP2/WebSocket/RPC
|
HttpRunner: Enjoy your All-in-One Testing Solution ✨ 🚀 ✨
|
||||||
network protocols, covering API testing, performance testing and digital experience
|
|
||||||
monitoring (DEM) test types. Enjoy! ✨ 🚀 ✨
|
|
||||||
|
|
||||||
License: Apache-2.0
|
💡 Simple Yet Powerful
|
||||||
|
- Natural language driven test scenarios powered by LLM
|
||||||
|
- User-friendly SDK API with IDE auto-completion
|
||||||
|
- Intuitive GoTest/YAML/JSON/Text testcase format
|
||||||
|
|
||||||
|
📌 Comprehensive Testing Capabilities
|
||||||
|
- UI Automation: Android/iOS/Harmony/Browser
|
||||||
|
- API Testing: HTTP(S)/HTTP2/WebSocket/RPC
|
||||||
|
- Load Testing: run API testcase concurrently with boomer
|
||||||
|
|
||||||
|
🧩 High Scalability
|
||||||
|
- Plugin system for custom functions
|
||||||
|
- Distributed testing support
|
||||||
|
- Cross-platform: macOS/Linux/Windows
|
||||||
|
|
||||||
|
🛠 Easy Integration
|
||||||
|
- CI/CD friendly with JSON logs and HTML reports
|
||||||
|
- Rich ecosystem tools
|
||||||
|
|
||||||
|
Learn more:
|
||||||
Website: https://httprunner.com
|
Website: https://httprunner.com
|
||||||
Github: https://github.com/httprunner/httprunner
|
GitHub: https://github.com/httprunner/httprunner
|
||||||
Copyright 2017 debugtalk`,
|
|
||||||
|
Copyright © 2017-present debugtalk. Apache-2.0 License.`,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||||
hrp.InitLogger(logLevel, logJSON)
|
hrp.InitLogger(logLevel, logJSON)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module github.com/httprunner/httprunner/v5
|
module github.com/httprunner/httprunner/v5
|
||||||
|
|
||||||
go 1.23.0
|
go 1.22.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Masterminds/semver v1.5.0
|
github.com/Masterminds/semver v1.5.0
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2503062216
|
v5.0.0-beta-2503080031
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ mkdir -p "output"
|
|||||||
bin_path="output/hrp"
|
bin_path="output/hrp"
|
||||||
|
|
||||||
# build
|
# build
|
||||||
go build -ldflags '-s -w' -o "$bin_path" hrp/cmd/cli/main.go
|
go build -ldflags '-s -w' -o "$bin_path" cmd/cli/main.go
|
||||||
|
|
||||||
# check output and version
|
# check output and version
|
||||||
ls -lh "$bin_path"
|
ls -lh "$bin_path"
|
||||||
|
|||||||
+9
-20
@@ -19,8 +19,12 @@ function echoWarn() {
|
|||||||
}
|
}
|
||||||
export -f echoError
|
export -f echoError
|
||||||
|
|
||||||
|
github_api_url="https://api.github.com/repos/httprunner/httprunner/releases/latest"
|
||||||
|
|
||||||
function get_latest_version() {
|
function get_latest_version() {
|
||||||
curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/VERSION
|
# get latest release version from GitHub API
|
||||||
|
version=$(curl -s $github_api_url | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
echo "$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_os() {
|
function get_os() {
|
||||||
@@ -59,28 +63,13 @@ function main() {
|
|||||||
pkg="hrp-$version-$os-$arch$pkg_suffix"
|
pkg="hrp-$version-$os-$arch$pkg_suffix"
|
||||||
echo "Download package: $pkg"
|
echo "Download package: $pkg"
|
||||||
|
|
||||||
# download from aliyun OSS or github packages
|
download_url=$(curl -s $github_api_url | grep "browser_download_url.*$pkg" | cut -d '"' -f 4)
|
||||||
aliyun_oss_url="https://httprunner.oss-cn-beijing.aliyuncs.com/$pkg"
|
echo "Download url: $download_url"
|
||||||
github_url="https://github.com/httprunner/httprunner/releases/download/$version/$pkg"
|
|
||||||
valid_flag=false
|
|
||||||
for url in "$aliyun_oss_url" "$github_url"; do
|
|
||||||
if curl --output /dev/null --silent --head --fail "$url"; then
|
|
||||||
valid_flag=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echoWarn "Invalid download url: $url"
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ "$valid_flag" == false ]]; then
|
|
||||||
echoError "No available download url found, exit!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Download url: $url"
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echoInfo "Downloading..."
|
echoInfo "Downloading..."
|
||||||
echo "$ curl -kL $url -o $pkg"
|
echo "$ curl -kL $download_url -o $pkg"
|
||||||
curl -kL $url -o "$pkg"
|
curl -kL $download_url -o "$pkg"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# for windows, only extract package to current directory
|
# for windows, only extract package to current directory
|
||||||
|
|||||||
@@ -925,6 +925,7 @@ func (ad *ADBDriver) PushImage(localPath string) error {
|
|||||||
if err := ad.Device.PushFile(localPath, remotePath); err != nil {
|
if err := ad.Device.PushFile(localPath, remotePath); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// refresh
|
||||||
_, _ = ad.Device.RunShellCommand("am", "broadcast",
|
_, _ = ad.Device.RunShellCommand("am", "broadcast",
|
||||||
"-a", "android.intent.action.MEDIA_SCANNER_SCAN_FILE",
|
"-a", "android.intent.action.MEDIA_SCANNER_SCAN_FILE",
|
||||||
"-d", fmt.Sprintf("file://%s", remotePath))
|
"-d", fmt.Sprintf("file://%s", remotePath))
|
||||||
|
|||||||
@@ -244,6 +244,22 @@ func TestDriver_ADB_ScreenRecord(t *testing.T) {
|
|||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDriver_ADB_PushImage(t *testing.T) {
|
||||||
|
driver := setupADBDriverExt(t)
|
||||||
|
|
||||||
|
screenshot, err := driver.ScreenShot()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
path, err := saveScreenShot(screenshot, "1234")
|
||||||
|
require.Nil(t, err)
|
||||||
|
defer os.Remove(path)
|
||||||
|
|
||||||
|
err = driver.PushImage(path)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
|
||||||
|
err = driver.ClearImages()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
func TestDriver_ADB_Backspace(t *testing.T) {
|
func TestDriver_ADB_Backspace(t *testing.T) {
|
||||||
driver := setupADBDriverExt(t)
|
driver := setupADBDriverExt(t)
|
||||||
err := driver.Backspace(1)
|
err := driver.Backspace(1)
|
||||||
|
|||||||
+17
-7
@@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/v5/code"
|
"github.com/httprunner/httprunner/v5/code"
|
||||||
|
"github.com/httprunner/httprunner/v5/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/v5/uixt/option"
|
"github.com/httprunner/httprunner/v5/uixt/option"
|
||||||
"github.com/httprunner/httprunner/v5/uixt/types"
|
"github.com/httprunner/httprunner/v5/uixt/types"
|
||||||
)
|
)
|
||||||
@@ -387,13 +388,7 @@ func (dev *IOSDevice) ListImages() (images []string, err error) {
|
|||||||
|
|
||||||
func (dev *IOSDevice) MountImage(imagePath string) (err error) {
|
func (dev *IOSDevice) MountImage(imagePath string) (err error) {
|
||||||
log.Info().Str("imagePath", imagePath).Msg("mount ios developer image")
|
log.Info().Str("imagePath", imagePath).Msg("mount ios developer image")
|
||||||
conn, err := imagemounter.NewImageMounter(dev.DeviceEntry)
|
err = imagemounter.MountImage(dev.DeviceEntry, imagePath)
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(code.DeviceConnectionError, err.Error())
|
|
||||||
}
|
|
||||||
defer conn.Close()
|
|
||||||
|
|
||||||
err = conn.MountImage(imagePath)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(code.DeviceConnectionError,
|
return errors.Wrapf(code.DeviceConnectionError,
|
||||||
"mount ios developer image failed: %v", err)
|
"mount ios developer image failed: %v", err)
|
||||||
@@ -402,8 +397,23 @@ func (dev *IOSDevice) MountImage(imagePath string) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (dev *IOSDevice) UnmountImage() (err error) {
|
||||||
|
log.Info().Msg("unmount ios developer image")
|
||||||
|
err = imagemounter.UnmountImage(dev.DeviceEntry)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrapf(code.DeviceConnectionError,
|
||||||
|
"unmount ios developer image failed: %v", err)
|
||||||
|
}
|
||||||
|
log.Info().Msg("unmount ios developer image success")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (dev *IOSDevice) AutoMountImage(baseDir string) (err error) {
|
func (dev *IOSDevice) AutoMountImage(baseDir string) (err error) {
|
||||||
log.Info().Str("baseDir", baseDir).Msg("auto mount ios developer image")
|
log.Info().Str("baseDir", baseDir).Msg("auto mount ios developer image")
|
||||||
|
if err := builtin.EnsureFolderExists(baseDir); err != nil {
|
||||||
|
return errors.Wrap(err, "create developer disk image directory failed")
|
||||||
|
}
|
||||||
|
|
||||||
imagePath, err := imagemounter.DownloadImageFor(dev.DeviceEntry, baseDir)
|
imagePath, err := imagemounter.DownloadImageFor(dev.DeviceEntry, baseDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(code.DeviceConnectionError,
|
return errors.Wrapf(code.DeviceConnectionError,
|
||||||
|
|||||||
@@ -312,3 +312,19 @@ func TestDriver_WDA_Backspace(t *testing.T) {
|
|||||||
err := driver.Backspace(3)
|
err := driver.Backspace(3)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDriver_WDA_PushImage(t *testing.T) {
|
||||||
|
driver := setupWDADriverExt(t)
|
||||||
|
|
||||||
|
screenshot, err := driver.ScreenShot()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
path, err := saveScreenShot(screenshot, "1234")
|
||||||
|
require.Nil(t, err)
|
||||||
|
defer os.Remove(path)
|
||||||
|
|
||||||
|
err = driver.PushImage(path)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
|
||||||
|
err = driver.ClearImages()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user