mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +08:00
fix: tap offset
This commit is contained in:
@@ -90,9 +90,11 @@
|
|||||||
{
|
{
|
||||||
"method": "tap_ocr",
|
"method": "tap_ocr",
|
||||||
"params": "推荐",
|
"params": "推荐",
|
||||||
"options": {
|
"identifier": "点击推荐",
|
||||||
"identifier": "点击推荐"
|
"offset": [
|
||||||
}
|
0,
|
||||||
|
-1
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "sleep",
|
"method": "sleep",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
hrp "github.com/httprunner/httprunner/v5"
|
hrp "github.com/httprunner/httprunner/v5"
|
||||||
|
"github.com/httprunner/httprunner/v5/uixt/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoadTestCases(t *testing.T) {
|
func TestLoadTestCases(t *testing.T) {
|
||||||
@@ -63,3 +64,17 @@ func TestLoadCase(t *testing.T) {
|
|||||||
assert.Equal(t, tcJSON.Steps[1].StepName, tcYAML.Steps[1].StepName)
|
assert.Equal(t, tcJSON.Steps[1].StepName, tcYAML.Steps[1].StepName)
|
||||||
assert.Equal(t, tcJSON.Steps[1].Request, tcJSON.Steps[1].Request)
|
assert.Equal(t, tcJSON.Steps[1].Request, tcJSON.Steps[1].Request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoadCaseWithTapOffset(t *testing.T) {
|
||||||
|
// Load the android_swipe_tap_loadmore.json test case
|
||||||
|
testCasePath := "../examples/uitest/demo_ios_wda_log.json"
|
||||||
|
tc := &hrp.TestCaseDef{}
|
||||||
|
err := hrp.LoadFileObject(testCasePath, tc)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
|
||||||
|
action := tc.Steps[3].IOS.Actions[0]
|
||||||
|
assert.Equal(t, option.ACTION_TapByOCR, action.Method)
|
||||||
|
assert.Equal(t, "推荐", action.Params)
|
||||||
|
assert.Equal(t, "点击推荐", action.ActionOptions.Identifier)
|
||||||
|
assert.Equal(t, []int{0, -1}, action.ActionOptions.ScreenFilterOptions.TapOffset)
|
||||||
|
}
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ type ScreenFilterOptions struct {
|
|||||||
AbsScope AbsScope `json:"abs_scope,omitempty" yaml:"abs_scope,omitempty"`
|
AbsScope AbsScope `json:"abs_scope,omitempty" yaml:"abs_scope,omitempty"`
|
||||||
|
|
||||||
Regex bool `json:"regex,omitempty" yaml:"regex,omitempty"` // use regex to match text
|
Regex bool `json:"regex,omitempty" yaml:"regex,omitempty"` // use regex to match text
|
||||||
TapOffset []int `json:"tap_offset,omitempty" yaml:"tap_offset,omitempty"` // tap with absolute point offset
|
TapOffset []int `json:"offset,omitempty" yaml:"offset,omitempty"` // tap with absolute point offset
|
||||||
TapRandomRect bool `json:"tap_random_rect,omitempty" yaml:"tap_random_rect,omitempty"` // tap random point in text/image rectangle
|
TapRandomRect bool `json:"tap_random_rect,omitempty" yaml:"tap_random_rect,omitempty"` // tap random point in text/image rectangle
|
||||||
SwipeOffset []int `json:"swipe_offset,omitempty" yaml:"swipe_offset,omitempty"` // swipe with direction offset
|
SwipeOffset []int `json:"swipe_offset,omitempty" yaml:"swipe_offset,omitempty"` // swipe with direction offset
|
||||||
OffsetRandomRange []int `json:"offset_random_range,omitempty" yaml:"offset_random_range,omitempty"` // set random range [min, max] for tap/swipe points
|
OffsetRandomRange []int `json:"offset_random_range,omitempty" yaml:"offset_random_range,omitempty"` // set random range [min, max] for tap/swipe points
|
||||||
|
|||||||
Reference in New Issue
Block a user