mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
chore(runner): log screen + tag hits per step for debuggability
This commit is contained in:
1 parent
cefb398437
commit
4b43b9a22a
1 file changed
+29
-1
@@ -79,7 +79,8 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
||||
if err := options.Verifier.PushSnapshot(verifier.Snapshots(snapshot.Snapshots), tree); err != nil {
|
||||
return summary, fmt.Errorf("step %d push: %w", stepIndex, err)
|
||||
}
|
||||
fmt.Printf("step %d: screen=%q hierarchy=%d nodes\n", stepIndex, screenFromSnapshot(snapshot.Snapshots), treeSize)
|
||||
fmt.Printf("step %d: screen=%q hierarchy=%d nodes tags=%v\n",
|
||||
stepIndex, screenFromSnapshot(snapshot.Snapshots), treeSize, interestingTags(tree))
|
||||
verdicts := options.Verifier.EvaluateProperties()
|
||||
violations := violationNames(verdicts)
|
||||
|
||||
@@ -230,6 +231,33 @@ func fetchHierarchy(ctx context.Context, drv driver.Driver) (*hierarchy.Tree, er
|
||||
return hierarchy.Parse(xmlText)
|
||||
}
|
||||
|
||||
// interestingTags collects a short summary of which selectors the current
|
||||
// spec cares about are present, so we can read the log and see which
|
||||
// generator gates will fire.
|
||||
func interestingTags(tree *hierarchy.Tree) []string {
|
||||
if tree == nil {
|
||||
return nil
|
||||
}
|
||||
selectors := []string{
|
||||
"id:select_language",
|
||||
"id:etMobileNumber",
|
||||
"id:otp",
|
||||
"text:Sign Out Other Devices",
|
||||
"text:Sign Out",
|
||||
"text:Cancel",
|
||||
"text:Skip",
|
||||
"descPrefix:customer_row_",
|
||||
"descPrefix:supplier_row_",
|
||||
}
|
||||
var hits []string
|
||||
for _, selector := range selectors {
|
||||
if elements := tree.FindAll(selector); len(elements) > 0 {
|
||||
hits = append(hits, fmt.Sprintf("%s=%d", selector, len(elements)))
|
||||
}
|
||||
}
|
||||
return hits
|
||||
}
|
||||
|
||||
func traceActionFor(action verifier.Action) *trace.Action {
|
||||
traceAction := &trace.Action{Kind: string(action.Kind)}
|
||||
switch action.Kind {
|
||||
|
||||
Reference in new issue
Block a user