change: remove xpath validation

This commit is contained in:
debugtalk
2022-08-28 10:35:27 +08:00
parent 598ae509de
commit ad730b3542
4 changed files with 11 additions and 52 deletions
-40
View File
@@ -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)
}