Skip to main content
skill CX Codex

geb-skill — Claude Code skill: Groovy browser testing with Geb

This skill generates browser automation tests in Groovy using Geb and Spock. It provides page object patterns and jQuery-like selectors for e2e testing.

MIT 211 installs ★ 393 updated 2026-10-13

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add LambdaTest/agent-skills --skill geb-skill -a claude-code
Open on GitHub

What geb-skill does

geb-skill automates browser test generation in Groovy, combining Geb with the Spock test framework. The skill works through page objects—reusable classes that encapsulate selectors and actions. Geb's navigator API lets you write expressive code like $("css-selector").click() or element.value("text"), keeping tests readable and maintainable.

Built-in patterns cover login flows, error validation, selector queries, and cloud execution on TestMu AI. For cloud runs, set environment variables LT_USERNAME and LT_ACCESS_KEY; GebConfig.groovy handles RemoteWebDriver setup automatically. Tests run locally with ./gradlew test, or in the cloud via -Dgeb.env=lambdatest. The skill supports async waits, frame and window handling, and file uploads.

What it helps with

  • write e2e browser tests in Groovy with page object pattern
  • test form interactions and validate page state after actions
  • run tests in the cloud with video recording and logs
  • create reusable page components for consistent test structure
  • handle asynchronous operations and JavaScript execution

Example prompts for the agent

  • Write a login test that verifies the error message for invalid credentials
  • Create a page object for a dashboard with selectors and methods
  • Configure cloud test execution on TestMu AI with Chrome on Windows 11

How to install geb-skill

1Skills CLI (Vercel)

npx skills add LambdaTest/agent-skills --skill geb-skill -a claude-code

2Manually: put the files in place

~/.claude/skills/geb-skill/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/geb-skill/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about geb-skill

How do I install geb-skill in Claude Code?

Run npx skills add LambdaTest/agent-skills --skill geb-skill -a claude-code, then verify by checking ~/.claude/skills/geb-skill/SKILL.md.

What does geb-skill do?

The skill generates browser tests in Groovy with Geb and Spock, including page object support, navigator API, and cloud testing integration via TestMu AI.

What dependencies are required?

You need Gradle, geb-spock, and selenium-support. For cloud execution, set LT_USERNAME and LT_ACCESS_KEY environment variables.

Source text

SKILL.md · MIT
---
name: geb-skill
description: >
  Generates Geb browser automation tests in Groovy with Spock integration.
  jQuery-like content DSL and page object pattern. Use when user mentions "Geb",
  "Groovy test", "GebSpec", "Browser.drive". Triggers on: "Geb", "GebSpec",
  "Groovy browser test", "Browser.drive".
languages:
  - Groovy
category: e2e-testing
license: MIT
metadata:
  author: TestMu AI
  version: "1.0"
---

# Geb Automation Skill

For TestMu AI cloud execution, see [reference/cloud-integration.md](reference/cloud-integration.md) and [shared/testmu-cloud-reference.md](../shared/testmu-cloud-reference.md).

## Core Patterns

### Basic Test (Spock)

```groovy
import geb.spock.GebSpec

class LoginSpec extends GebSpec {
    def "login with valid credentials"() {
        when:
        to LoginPage
        emailInput.value("[email protected]")
        passwordInput.value("password123")
        loginButton.click()

        then:
        at DashboardPage
        welcomeMessage.text().contains("Welcome")
    }

    def "login shows error for invalid credentials"() {
        when:
        to LoginPage
        emailInput.value("[email protected]")
        passwordInput.value("wrong")
        loginButton.click()

        then:
        at LoginPage
        errorMessage.displayed
        errorMessage.text().contains("Invalid")
    }
}
```

### Page Objects

```groovy
class LoginPage extends geb.Page {
    static url = "/login"
    static at = { title == "Login" }
    static content = {
        emailInput { $("#email") }
        passwordInput { $("#password") }
        loginButton { $("button[type='submit']") }
        errorMessage(required: false) { $(".error") }
    }
}

class DashboardPage extends geb.Page {
    static url = "/dashboard"
    static at = { $(".dashboard").displayed }
    static content = {
        welcomeMessage { $(".welcome") }
        userName { $(".user-name") }
    }
}
```

### Navigator API

```groovy
$("css-selector")
$("div", class: "active")
$("input", name: "email")
$("div.items li", 0)        // First match
$("div.items li").size()     // Count

// Actions
element.click()
element.value("text")
element << "text"            // Append text
element.text()
element.displayed
element.@href                // Attribute
```

### Cloud: `driver = new RemoteWebDriver(new URL(gridUrl), caps)`

## Setup: Gradle with `geb-spock` and `selenium-support` dependencies

### Cloud Execution on TestMu AI

Set environment variables: `LT_USERNAME`, `LT_ACCESS_KEY`

```groovy
// GebConfig.groovy
environments {
    lambdatest {
        driver = {
            def ltOptions = [
                user: System.getenv("LT_USERNAME"),
                accessKey: System.getenv("LT_ACCESS_KEY"),
                build: "Geb Build",
                name: "Geb Test",
                platformName: "Windows 11",
                video: true,
                console: true,
                network: true,
            ]
            def caps = new ChromeOptions()
            caps.setCapability("LT:Options", ltOptions)
            new RemoteWebDriver(
                new URL("https://hub.lambdatest.com/wd/hub"), caps)
        }
    }
}
```

Run: `./gradlew test -Dgeb.env=lambdatest`
## Run: `./gradlew test`

## Deep Patterns

See `reference/playbook.md` for production-grade patterns:

| Section | What You Get |
|---------|-------------|
| §1 Project Setup | build.gradle, GebConfig.groovy, environments, waiting config |
| §2 Page Objects | Content DSL, at checks, modules for reusable components |
| §3 Spec Tests | Spock integration, data-driven with @Unroll, @Stepwise flows |
| §4 Waiting & Async | Waiting presets, JavaScript interaction, alerts/confirms |
| §5 Advanced Patterns | File upload/download, windows, frames, custom extensions |
| §6 API Testing | REST API specs with Groovy JsonSlurper |
| §7 CI/CD Integration | GitHub Actions with headless Chrome, Gradle caching |
| §8 Debugging Table | 12 common problems with causes and fixes |
| §9 Best Practices | 14-item Geb testing checklist |

© TestMu AI · MIT · LambdaTest/agent-skills

Similar skills

All skills for Testing and QA →

From the same set47

The whole set →

Project sponsors

Companies that keep this analytics open