refactor: DriverSession

This commit is contained in:
lilong.129
2025-02-17 17:08:24 +08:00
parent c8d776009c
commit 29c0e1cbef
16 changed files with 377 additions and 396 deletions

View File

@@ -90,6 +90,19 @@ func (dExt *XTDriver) Setup() error {
return nil
}
func (dExt *XTDriver) GetData(withReset bool) map[string]interface{} {
session := dExt.GetSession()
data := map[string]interface{}{
"requests": session.History(),
"screen_results": dExt.screenResults,
}
if withReset {
session.Reset()
dExt.screenResults = make([]*ScreenResult, 0)
}
return data
}
func (dExt *XTDriver) assertOCR(text, assert string) error {
var opts []option.ActionOption
opts = append(opts, option.WithScreenShotFileName(fmt.Sprintf("assert_ocr_%s", text)))