mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-27 11:10:31 +08:00
fix: remove unused files
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
v5.4.0
|
|
||||||
@@ -47,10 +47,6 @@ func escapeQuotes(s string) string {
|
|||||||
return quoteEscaper.Replace(s)
|
return quoteEscaper.Replace(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
}
|
|
||||||
|
|
||||||
func random_range(a, b float64) float64 {
|
func random_range(a, b float64) float64 {
|
||||||
return a + rand.Float64()*(b-a)
|
return a + rand.Float64()*(b-a)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,7 +356,6 @@ func ConvertToStringSlice(val interface{}) ([]string, error) {
|
|||||||
func GetFreePort() (int, error) {
|
func GetFreePort() (int, error) {
|
||||||
minPort := 20000
|
minPort := 20000
|
||||||
maxPort := 50000
|
maxPort := 50000
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
port := rand.Intn(maxPort-minPort+1) + minPort
|
port := rand.Intn(maxPort-minPort+1) + minPort
|
||||||
addr := fmt.Sprintf("0.0.0.0:%d", port)
|
addr := fmt.Sprintf("0.0.0.0:%d", port)
|
||||||
@@ -366,7 +365,7 @@ func GetFreePort() (int, error) {
|
|||||||
return port, nil
|
return port, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0, errors.New("failed to find available port in range")
|
return 0, errors.New("failed to get available port")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetCurrentDay() string {
|
func GetCurrentDay() string {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v5.0.0+2503032034
|
v5.0.0+2503032054
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB |
@@ -67,7 +67,6 @@ func CreateBrowser(timeout int) (browserInfo *BrowserInfo, err error) {
|
|||||||
Timeout: 30 * time.Second, // 设置超时时间为5秒
|
Timeout: 30 * time.Second, // 设置超时时间为5秒
|
||||||
}
|
}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -135,7 +134,6 @@ func (wd *BrowserWebDriver) AppLaunch(packageName string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) DeleteSession() (err error) {
|
func (wd *BrowserWebDriver) DeleteSession() (err error) {
|
||||||
|
|
||||||
url := wd.concatURL("context", wd.sessionId)
|
url := wd.concatURL("context", wd.sessionId)
|
||||||
|
|
||||||
req, err := http.NewRequest("DELETE", url, nil)
|
req, err := http.NewRequest("DELETE", url, nil)
|
||||||
@@ -146,7 +144,6 @@ func (wd *BrowserWebDriver) DeleteSession() (err error) {
|
|||||||
Timeout: 60 * time.Second, // 设置超时时间为5秒
|
Timeout: 60 * time.Second, // 设置超时时间为5秒
|
||||||
}
|
}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -301,13 +298,11 @@ func (wd *BrowserWebDriver) Input(text string, option ...option.ActionOption) (e
|
|||||||
// Source Return application elements tree
|
// Source Return application elements tree
|
||||||
func (wd *BrowserWebDriver) Source(srcOpt ...option.SourceOption) (string, error) {
|
func (wd *BrowserWebDriver) Source(srcOpt ...option.SourceOption) (string, error) {
|
||||||
resp, err := wd.HttpGet(http.MethodGet, wd.sessionId, "stub/source")
|
resp, err := wd.HttpGet(http.MethodGet, wd.sessionId, "stub/source")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonData, err := json.Marshal(resp.Data)
|
jsonData, err := json.Marshal(resp.Data)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -340,7 +335,6 @@ func (wd *BrowserWebDriver) HttpPOST(data interface{}, pathElem ...string) (resp
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) HttpGet(data interface{}, pathElem ...string) (response *WebAgentResponse, err error) {
|
func (wd *BrowserWebDriver) HttpGet(data interface{}, pathElem ...string) (response *WebAgentResponse, err error) {
|
||||||
|
|
||||||
return wd.httpRequest(http.MethodGet, wd.concatURL(pathElem...), nil)
|
return wd.httpRequest(http.MethodGet, wd.concatURL(pathElem...), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +358,6 @@ func (wd *BrowserWebDriver) httpRequest(method string, rawURL string, rawBody []
|
|||||||
Timeout: 60 * time.Second, // 设置超时时间为5秒
|
Timeout: 60 * time.Second, // 设置超时时间为5秒
|
||||||
}
|
}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -424,6 +417,7 @@ func (wd *BrowserWebDriver) WindowSize() (types.Size, error) {
|
|||||||
func (wd *BrowserWebDriver) Screen() (Screen, error) {
|
func (wd *BrowserWebDriver) Screen() (Screen, error) {
|
||||||
return Screen{}, errors.New("not support")
|
return Screen{}, errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) Scale() (float64, error) {
|
func (wd *BrowserWebDriver) Scale() (float64, error) {
|
||||||
return 0, errors.New("not support")
|
return 0, errors.New("not support")
|
||||||
}
|
}
|
||||||
@@ -460,6 +454,7 @@ func (wd *BrowserWebDriver) Back() error {
|
|||||||
func (wd *BrowserWebDriver) AppClear(packageName string) error {
|
func (wd *BrowserWebDriver) AppClear(packageName string) error {
|
||||||
return errors.New("not support")
|
return errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) ClearImages() error {
|
func (wd *BrowserWebDriver) ClearImages() error {
|
||||||
return errors.New("not support")
|
return errors.New("not support")
|
||||||
}
|
}
|
||||||
@@ -502,6 +497,7 @@ func (wd *BrowserWebDriver) DoubleTap(x, y float64, options ...option.ActionOpti
|
|||||||
_, err := wd.HttpPOST(data, wd.sessionId, "ui/double_tap")
|
_, err := wd.HttpPOST(data, wd.sessionId, "ui/double_tap")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) UploadFile(x, y float64, FileUrl, FileFormat string) (err error) {
|
func (wd *BrowserWebDriver) UploadFile(x, y float64, FileUrl, FileFormat string) (err error) {
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"x": x,
|
"x": x,
|
||||||
@@ -543,6 +539,7 @@ func (wd *BrowserWebDriver) SendKeys(text string, options ...option.ActionOption
|
|||||||
func (wd *BrowserWebDriver) Clear(packageName string) error {
|
func (wd *BrowserWebDriver) Clear(packageName string) error {
|
||||||
return errors.New("not support")
|
return errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) Setup() error {
|
func (wd *BrowserWebDriver) Setup() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -590,9 +587,11 @@ func (wd *BrowserWebDriver) AccessibleSource() (string, error) {
|
|||||||
func (wd *BrowserWebDriver) HealthCheck() error {
|
func (wd *BrowserWebDriver) HealthCheck() error {
|
||||||
return errors.New("not support")
|
return errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) GetAppiumSettings() (map[string]interface{}, error) {
|
func (wd *BrowserWebDriver) GetAppiumSettings() (map[string]interface{}, error) {
|
||||||
return nil, errors.New("not support")
|
return nil, errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) SetAppiumSettings(settings map[string]interface{}) (map[string]interface{}, error) {
|
func (wd *BrowserWebDriver) SetAppiumSettings(settings map[string]interface{}) (map[string]interface{}, error) {
|
||||||
return nil, errors.New("not support")
|
return nil, errors.New("not support")
|
||||||
}
|
}
|
||||||
@@ -605,9 +604,11 @@ func (wd *BrowserWebDriver) IsHealthy() (bool, error) {
|
|||||||
func (wd *BrowserWebDriver) StartCaptureLog(identifier ...string) (err error) {
|
func (wd *BrowserWebDriver) StartCaptureLog(identifier ...string) (err error) {
|
||||||
return errors.New("not support")
|
return errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) StopCaptureLog() (result interface{}, err error) {
|
func (wd *BrowserWebDriver) StopCaptureLog() (result interface{}, err error) {
|
||||||
return nil, errors.New("not support")
|
return nil, errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *BrowserWebDriver) RecordScreen(folderPath string, duration time.Duration) (videoPath string, err error) {
|
func (wd *BrowserWebDriver) RecordScreen(folderPath string, duration time.Duration) (videoPath string, err error) {
|
||||||
return "", errors.New("not support")
|
return "", errors.New("not support")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,5 +118,6 @@ type IBrowserWebDriver interface {
|
|||||||
Hover(x, y float64) (err error)
|
Hover(x, y float64) (err error)
|
||||||
RightClick(x, y float64) (err error)
|
RightClick(x, y float64) (err error)
|
||||||
Scroll(delta int) (err error)
|
Scroll(delta int) (err error)
|
||||||
|
// TODO: move x,y parameters to option
|
||||||
UploadFile(x, y float64, FileUrl, FileFormat string) (err error)
|
UploadFile(x, y float64, FileUrl, FileFormat string) (err error)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user