Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

594 B
Raw Blame
package handlers

import (
	"errors"
	"fmt"
	"testing"
)

func TestStatusForElementErr(t *testing.T) {
	if got := selectorFailureStatus(fmt.Errorf("%w: %q", ErrElementNotFound, "#missing")); got != 404 {
		t.Fatalf("selector-not-found should map to 404, got %d", got)
	}
	if got := selectorFailureStatus(fmt.Errorf("wrapped: %w", ErrElementNotFound)); got != 404 {
		t.Fatalf("wrapped not-found should still map to 404, got %d", got)
	}
	if got := selectorFailureStatus(errors.New("cdp transport failure")); got != 500 {
		t.Fatalf("a genuine internal error should stay 500, got %d", got)
	}
}