mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
refactor(runner): drop hardcoded per-app selectors from step log (#10)
interestingTags hardcoded selectors from a specific app (etMobileNumber, customer_row_, supplier_row_, etc.) inside the generic runner. None of these selectors exist in the checked-in sample spec. Debug log now just reports screen + hierarchy size; specs that want richer visibility can log from state.ax.find themselves.
This commit is contained in:
1 file changed
+2
-29
@@ -79,8 +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 tags=%v\n",
|
||||
stepIndex, screenFromSnapshot(snapshot.Snapshots), treeSize, interestingTags(tree))
|
||||
fmt.Printf("step %d: screen=%q hierarchy=%d nodes\n",
|
||||
stepIndex, screenFromSnapshot(snapshot.Snapshots), treeSize)
|
||||
verdicts := options.Verifier.EvaluateProperties()
|
||||
violations := violationNames(verdicts)
|
||||
|
||||
@@ -231,33 +231,6 @@ 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