agentleFS
bmcszkbmcszk/agent-skills/skills/go-browser-tests/SKILL.md

go-browser-tests

Skill1 starsChanged 2 months agoMITView on GitHub

Go browser testing with chromedp for HTMX applications, real browser automation. Use when testing HTMX frontend interactions, authentication flows, or any scenario requiring a real browser. Runs in test/e2e/browser/ with chromedp. Keywords: browser testing, chromedp, e2e browser, HTMX testing, frontend automation, real browser test.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Build Tags: DO NOT USE

    line 27
  2. Very specific:

    Request Lifecycle: Wait for .htmx-request to disappear

    line 93
  3. Distinctive:

    Authentication: Test JWT cookies in real browser

    line 94
  4. Very specific:

    UI Interaction: Use data-testid attributes

    line 95
  5. Distinctive:

    NEVER skip browser tests for frontend features

    line 113
  6. Distinctive:

    NEVER use HTTP tests for HTMX behavior

    line 114
  7. Distinctive:

    NEVER use build tags

    line 115

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

What I do

Browser testing with chromedp for HTMX applications.

When to use me

  • Testing HTMX applications
  • Testing frontend interactions
  • Testing authentication flows

Rules

Location

  • Directory: test/e2e/browser/
  • Package: package browser_test
  • Build Tags: DO NOT USE

Test Structure

func TestFrontend_Login(t *testing.T) {
    if testing.Short() {
        t.Skip("Skipping browser tests in short mode")
    }
    
    // given
    ctx, cancel := chromedp.NewContext(context.Background())
    defer cancel()
    
    var title string
    
    // when
    err := chromedp.Run(ctx,
        chromedp.Navigate(appURL+"/login"),
        chromedp.WaitVisible("#email"),
        chromedp.SendKeys("#email", "test@example.com"),
        chromedp.SendKeys("#password", "password"),
        chromedp.Click("#login-button"),
        chromedp.WaitVisible("#dashboard"),
        chromedp.Text("h1", &title),
    )
    
    // then
    require.NoError(t, err)
    assert.Equal(t, "Dashboard", title)
}

HTMX Lifecycle Testing

func WaitForHTMXComplete(selector string) chromedp.Action {
    return chromedp.Poll(`(selector) => {
        const el = document.querySelector(selector);
        return el && !el.classList.contains('htmx-request');
    }`, selector)
}

// Usage
chromedp.SendKeys("#search", "query"),
chromedp.WaitVisible(".htmx-request"),
WaitForHTMXComplete("#results"),

Login Helper

func loginToDashboard(ctx context.Context, email, password, appURL string) chromedp.Tasks {
    return chromedp.Tasks{
        chromedp.Navigate(appURL+"/login"),
        chromedp.WaitVisible("#email"),
        chromedp.SendKeys("#email", email),
        chromedp.SendKeys("#password", password),
        chromedp.Click("#login-button"),
        chromedp.WaitVisible("#dashboard"),
    }
}

Requirements

  1. Request Lifecycle: Wait for .htmx-request to disappear
  2. Authentication: Test JWT cookies in real browser
  3. UI Interaction: Use data-testid attributes

Commands

<runner> test-browser
<runner> test-e2e-up    # Start services first

# Use project's runner: make or just

Important

  • Browser tests are the ONLY tests that validate real user experience
  • HTTP tests DO NOT validate frontend functionality

Forbidden

  • NEVER skip browser tests for frontend features
  • NEVER use HTTP tests for HTMX behavior
  • NEVER use build tags

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.