mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
change: remove xpath validation
This commit is contained in:
@@ -288,36 +288,6 @@ func (s *StepIOSValidation) AssertNameNotExists(expectedName string, msg ...stri
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *StepIOSValidation) AssertXpathExists(expectedXpath string, msg ...string) *StepIOSValidation {
|
||||
v := Validator{
|
||||
Check: uiSelectorXpath,
|
||||
Assert: assertionExists,
|
||||
Expect: expectedXpath,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
v.Message = msg[0]
|
||||
} else {
|
||||
v.Message = fmt.Sprintf("xpath [%s] not found", expectedXpath)
|
||||
}
|
||||
s.step.Validators = append(s.step.Validators, v)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *StepIOSValidation) AssertXpathNotExists(expectedXpath string, msg ...string) *StepIOSValidation {
|
||||
v := Validator{
|
||||
Check: uiSelectorXpath,
|
||||
Assert: assertionNotExists,
|
||||
Expect: expectedXpath,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
v.Message = msg[0]
|
||||
} else {
|
||||
v.Message = fmt.Sprintf("xpath [%s] should not exist", expectedXpath)
|
||||
}
|
||||
s.step.Validators = append(s.step.Validators, v)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *StepIOSValidation) Name() string {
|
||||
return s.step.Name
|
||||
}
|
||||
@@ -628,8 +598,6 @@ func (w *wdaClient) doValidation(iValidators []interface{}) (validateResults []*
|
||||
switch validator.Check {
|
||||
case uiSelectorName:
|
||||
result = w.assertName(expected, exists)
|
||||
case uiSelectorXpath:
|
||||
result = w.assertXpath(expected, exists)
|
||||
}
|
||||
|
||||
if result {
|
||||
@@ -659,11 +627,3 @@ func (w *wdaClient) assertName(name string, exists bool) bool {
|
||||
_, err := w.DriverExt.FindElement(selector)
|
||||
return exists == (err == nil)
|
||||
}
|
||||
|
||||
func (w *wdaClient) assertXpath(xpath string, exists bool) bool {
|
||||
selector := gwda.BySelector{
|
||||
XPath: xpath,
|
||||
}
|
||||
_, err := w.DriverExt.FindElement(selector)
|
||||
return exists == (err == nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user