change: go fmt

This commit is contained in:
lilong.129
2023-07-21 10:32:48 +08:00
parent 17b6d95b3b
commit 11f017c082
5 changed files with 59 additions and 43 deletions
+10 -2
View File
@@ -27,8 +27,10 @@ const (
/* /*
[ [
{"username": "test1", "password": "111111"}, {"username": "test1", "password": "111111"},
{"username": "test2", "password": "222222"}, {"username": "test2", "password": "222222"},
] ]
*/ */
type Parameters []map[string]interface{} type Parameters []map[string]interface{}
@@ -205,9 +207,11 @@ func genCartesianProduct(multiParameters []Parameters) Parameters {
return cartesianProduct return cartesianProduct
} }
/* loadParameters loads parameters from multiple sources. /*
loadParameters loads parameters from multiple sources.
parameter value may be in three types: parameter value may be in three types:
(1) data list, e.g. ["iOS/10.1", "iOS/10.2", "iOS/10.3"] (1) data list, e.g. ["iOS/10.1", "iOS/10.2", "iOS/10.3"]
(2) call built-in parameterize function, "${parameterize(account.csv)}" (2) call built-in parameterize function, "${parameterize(account.csv)}"
(3) call custom function in debugtalk.py, "${gen_app_version()}" (3) call custom function in debugtalk.py, "${gen_app_version()}"
@@ -296,19 +300,23 @@ func (p *Parser) loadParameters(configParameters map[string]interface{}, variabl
return parsedParameters, nil return parsedParameters, nil
} }
/* convert parameters to standard format /*
convert parameters to standard format
key and parametersRawList may be in three types: key and parametersRawList may be in three types:
case 1: case 1:
key = "user_agent" key = "user_agent"
parametersRawList = ["iOS/10.1", "iOS/10.2"] parametersRawList = ["iOS/10.1", "iOS/10.2"]
case 2: case 2:
key = "username-password" key = "username-password"
parametersRawList = [{"username": "test1", "password": "111111"}, {"username": "test2", "password": "222222"}] parametersRawList = [{"username": "test1", "password": "111111"}, {"username": "test2", "password": "222222"}]
case 3: case 3:
key = "username-password" key = "username-password"
parametersRawList = [["test1", "111111"], ["test2", "222222"]] parametersRawList = [["test1", "111111"], ["test2", "222222"]]
*/ */
+1
View File
@@ -555,6 +555,7 @@ func (s UiSelectorHelper) Index(index int) UiSelectorHelper {
// 2, the `className(String)` matches the image // 2, the `className(String)` matches the image
// widget class, and `enabled(boolean)` is true. // widget class, and `enabled(boolean)` is true.
// The code would look like this: // The code would look like this:
//
// `new UiSelector().className("android.widget.ImageView") // `new UiSelector().className("android.widget.ImageView")
// .enabled(true).instance(2);` // .enabled(true).instance(2);`
func (s UiSelectorHelper) Instance(instance int) UiSelectorHelper { func (s UiSelectorHelper) Instance(instance int) UiSelectorHelper {
+1
View File
@@ -263,6 +263,7 @@ func (ud *uiaDriver) DragFloat(fromX, fromY, toX, toY float64, options ...Action
// Swipe performs a swipe from one coordinate to another using the number of steps // Swipe performs a swipe from one coordinate to another using the number of steps
// to determine smoothness and speed. Each step execution is throttled to 5ms // to determine smoothness and speed. Each step execution is throttled to 5ms
// per step. So for a 100 steps, the swipe will take about 1/2 second to complete. // per step. So for a 100 steps, the swipe will take about 1/2 second to complete.
//
// `steps` is the number of move steps sent to the system // `steps` is the number of move steps sent to the system
func (ud *uiaDriver) Swipe(fromX, fromY, toX, toY int, options ...ActionOption) error { func (ud *uiaDriver) Swipe(fromX, fromY, toX, toY int, options ...ActionOption) error {
return ud.SwipeFloat(float64(fromX), float64(fromY), float64(toX), float64(toY), options...) return ud.SwipeFloat(float64(fromX), float64(fromY), float64(toX), float64(toY), options...)
+9
View File
@@ -31,6 +31,7 @@ func (caps Capabilities) WithDefaultAlertAction(alertAction AlertAction) Capabil
} }
// WithMaxTypingFrequency // WithMaxTypingFrequency
//
// Defaults to `60`. // Defaults to `60`.
func (caps Capabilities) WithMaxTypingFrequency(n int) Capabilities { func (caps Capabilities) WithMaxTypingFrequency(n int) Capabilities {
if n <= 0 { if n <= 0 {
@@ -41,6 +42,7 @@ func (caps Capabilities) WithMaxTypingFrequency(n int) Capabilities {
} }
// WithWaitForIdleTimeout // WithWaitForIdleTimeout
//
// Defaults to `10` // Defaults to `10`
func (caps Capabilities) WithWaitForIdleTimeout(second float64) Capabilities { func (caps Capabilities) WithWaitForIdleTimeout(second float64) Capabilities {
caps["waitForIdleTimeout"] = second caps["waitForIdleTimeout"] = second
@@ -48,6 +50,7 @@ func (caps Capabilities) WithWaitForIdleTimeout(second float64) Capabilities {
} }
// WithShouldUseTestManagerForVisibilityDetection If set to YES will ask TestManagerDaemon for element visibility // WithShouldUseTestManagerForVisibilityDetection If set to YES will ask TestManagerDaemon for element visibility
//
// Defaults to `false` // Defaults to `false`
func (caps Capabilities) WithShouldUseTestManagerForVisibilityDetection(b bool) Capabilities { func (caps Capabilities) WithShouldUseTestManagerForVisibilityDetection(b bool) Capabilities {
caps["shouldUseTestManagerForVisibilityDetection"] = b caps["shouldUseTestManagerForVisibilityDetection"] = b
@@ -55,6 +58,7 @@ func (caps Capabilities) WithShouldUseTestManagerForVisibilityDetection(b bool)
} }
// WithShouldUseCompactResponses If set to YES will use compact (standards-compliant) & faster responses // WithShouldUseCompactResponses If set to YES will use compact (standards-compliant) & faster responses
//
// Defaults to `true` // Defaults to `true`
func (caps Capabilities) WithShouldUseCompactResponses(b bool) Capabilities { func (caps Capabilities) WithShouldUseCompactResponses(b bool) Capabilities {
caps["shouldUseCompactResponses"] = b caps["shouldUseCompactResponses"] = b
@@ -63,6 +67,7 @@ func (caps Capabilities) WithShouldUseCompactResponses(b bool) Capabilities {
// WithElementResponseAttributes If shouldUseCompactResponses == NO, // WithElementResponseAttributes If shouldUseCompactResponses == NO,
// is the comma-separated list of fields to return with each element. // is the comma-separated list of fields to return with each element.
//
// Defaults to `type,label`. // Defaults to `type,label`.
func (caps Capabilities) WithElementResponseAttributes(s string) Capabilities { func (caps Capabilities) WithElementResponseAttributes(s string) Capabilities {
caps["elementResponseAttributes"] = s caps["elementResponseAttributes"] = s
@@ -70,6 +75,7 @@ func (caps Capabilities) WithElementResponseAttributes(s string) Capabilities {
} }
// WithShouldUseSingletonTestManager // WithShouldUseSingletonTestManager
//
// Defaults to `true` // Defaults to `true`
func (caps Capabilities) WithShouldUseSingletonTestManager(b bool) Capabilities { func (caps Capabilities) WithShouldUseSingletonTestManager(b bool) Capabilities {
caps["shouldUseSingletonTestManager"] = b caps["shouldUseSingletonTestManager"] = b
@@ -77,6 +83,7 @@ func (caps Capabilities) WithShouldUseSingletonTestManager(b bool) Capabilities
} }
// WithDisableAutomaticScreenshots // WithDisableAutomaticScreenshots
//
// Defaults to `true` // Defaults to `true`
func (caps Capabilities) WithDisableAutomaticScreenshots(b bool) Capabilities { func (caps Capabilities) WithDisableAutomaticScreenshots(b bool) Capabilities {
caps["disableAutomaticScreenshots"] = b caps["disableAutomaticScreenshots"] = b
@@ -84,6 +91,7 @@ func (caps Capabilities) WithDisableAutomaticScreenshots(b bool) Capabilities {
} }
// WithShouldTerminateApp // WithShouldTerminateApp
//
// Defaults to `true` // Defaults to `true`
func (caps Capabilities) WithShouldTerminateApp(b bool) Capabilities { func (caps Capabilities) WithShouldTerminateApp(b bool) Capabilities {
caps["shouldTerminateApp"] = b caps["shouldTerminateApp"] = b
@@ -376,6 +384,7 @@ func (opt SourceOption) WithFormatAsDescription() SourceOption {
} }
// WithScope Allows to provide XML scope. // WithScope Allows to provide XML scope.
//
// only `xml` is supported. // only `xml` is supported.
func (opt SourceOption) WithScope(scope string) SourceOption { func (opt SourceOption) WithScope(scope string) SourceOption {
if vFormat, ok := opt["format"]; ok && vFormat != "xml" { if vFormat, ok := opt["format"]; ok && vFormat != "xml" {
+1 -4
View File
@@ -176,6 +176,7 @@ func newVEDEMImageService(actions ...string) (*veDEMImageService, error) {
// veDEMImageService implements IImageService interface // veDEMImageService implements IImageService interface
// actions: // actions:
//
// ocr - get ocr texts // ocr - get ocr texts
// upload - get image uploaded url // upload - get image uploaded url
// liveType - get live type // liveType - get live type
@@ -230,10 +231,6 @@ func (s *veDEMImageService) GetImage(imageBuf *bytes.Buffer) (
req.Header.Add("Agw-Auth-Content", signToken) req.Header.Add("Agw-Auth-Content", signToken)
req.Header.Add("Content-Type", bodyWriter.FormDataContentType()) req.Header.Add("Content-Type", bodyWriter.FormDataContentType())
// ppe
// req.Header.Add("x-use-ppe", "1")
// req.Header.Add("x-tt-env", "ppe_vedem_algorithm")
var resp *http.Response var resp *http.Response
// retry 3 times // retry 3 times
for i := 1; i <= 3; i++ { for i := 1; i <= 3; i++ {