mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
revert(runner): drop per-tick HTML capture
Removes captureHTML helper and its three call sites; HTMLAvailable flag no longer set on Step.
This commit is contained in:
1 parent
18c2458783
commit
ced6b5db7f
1 file changed
-41
@@ -73,7 +73,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
|||||||
var hierarchyErr error
|
var hierarchyErr error
|
||||||
var metrics *trace.Metrics
|
var metrics *trace.Metrics
|
||||||
var logs []verifier.LogEntry
|
var logs []verifier.LogEntry
|
||||||
var htmlCaptured bool
|
|
||||||
|
|
||||||
g, _ := errgroup.WithContext(ctx)
|
g, _ := errgroup.WithContext(ctx)
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
@@ -92,10 +91,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
|||||||
})
|
})
|
||||||
var v8Overrides map[int]json.RawMessage
|
var v8Overrides map[int]json.RawMessage
|
||||||
if web, ok := options.Driver.(driver.WebDriver); ok {
|
if web, ok := options.Driver.(driver.WebDriver); ok {
|
||||||
g.Go(func() error {
|
|
||||||
htmlCaptured = captureHTML(ctx, web, options.TraceWriter, logger, si, false)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
overrides, err := web.EvaluateExtractors(ctx)
|
overrides, err := web.EvaluateExtractors(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -112,12 +107,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
|||||||
captureScreenshot(ctx, options, logger, postStep, true)
|
captureScreenshot(ctx, options, logger, postStep, true)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if web, ok := options.Driver.(driver.WebDriver); ok {
|
|
||||||
g.Go(func() error {
|
|
||||||
captureHTML(ctx, web, options.TraceWriter, logger, postStep, true)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
pendingPostScreenshot = false
|
pendingPostScreenshot = false
|
||||||
}
|
}
|
||||||
g.Wait()
|
g.Wait()
|
||||||
@@ -188,7 +177,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
|||||||
Hierarchy: tree,
|
Hierarchy: tree,
|
||||||
Residuals: residuals,
|
Residuals: residuals,
|
||||||
Metrics: metrics,
|
Metrics: metrics,
|
||||||
HTMLAvailable: htmlCaptured,
|
|
||||||
}
|
}
|
||||||
if err := options.TraceWriter.WriteStep(step); err != nil {
|
if err := options.TraceWriter.WriteStep(step); err != nil {
|
||||||
return summary, fmt.Errorf("step %d trace: %w", stepIndex, err)
|
return summary, fmt.Errorf("step %d trace: %w", stepIndex, err)
|
||||||
@@ -229,9 +217,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
|||||||
|
|
||||||
if pendingPostScreenshot {
|
if pendingPostScreenshot {
|
||||||
captureScreenshot(ctx, options, logger, pendingPostScreenshotStep, true)
|
captureScreenshot(ctx, options, logger, pendingPostScreenshotStep, true)
|
||||||
if web, ok := options.Driver.(driver.WebDriver); ok {
|
|
||||||
captureHTML(ctx, web, options.TraceWriter, logger, pendingPostScreenshotStep, true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
summary.EndTime = time.Now()
|
summary.EndTime = time.Now()
|
||||||
@@ -489,32 +474,6 @@ func nextActionFromV8(ctx context.Context, web driver.WebDriver) (verifier.Actio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// captureHTML pulls the current document HTML from a WebDriver-capable
|
|
||||||
// driver and stamps it into the trace under html/. Returns true on a
|
|
||||||
// successful non-empty write so the Step.HTMLAvailable flag advertises the
|
|
||||||
// payload to the inspect UI.
|
|
||||||
func captureHTML(ctx context.Context, web driver.WebDriver, writer *trace.Writer, logger *slog.Logger, stepIndex int, after bool) bool {
|
|
||||||
html, err := web.Document(ctx)
|
|
||||||
if err != nil {
|
|
||||||
logger.Warn("html capture failed", "step", stepIndex, "after", after, "err", err)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if html == "" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
var writeErr error
|
|
||||||
if after {
|
|
||||||
writeErr = writer.WriteHTMLAfter(stepIndex, []byte(html))
|
|
||||||
} else {
|
|
||||||
writeErr = writer.WriteHTML(stepIndex, []byte(html))
|
|
||||||
}
|
|
||||||
if writeErr != nil {
|
|
||||||
logger.Warn("html write failed", "step", stepIndex, "after", after, "err", writeErr)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func captureScreenshot(ctx context.Context, options Options, logger *slog.Logger, stepIndex int, after bool) {
|
func captureScreenshot(ctx context.Context, options Options, logger *slog.Logger, stepIndex int, after bool) {
|
||||||
image, err := options.Driver.Screenshot(ctx)
|
image, err := options.Driver.Screenshot(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user