[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ACHBZ9GZFW59BAJZ6S3SR3":3,"skill-same:01M6ACHBZ9GZFW59BAJZ6S3SR3":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":26,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":50,"ownerHtmlUrl":51,"ownerBlogUrl":52,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M6ACHBZ9GZFW59BAJZ6S3SR3","geb-spock",null,"Write Geb browser automation tests using the Spock framework with best practices. Use this skill whenever the user asks to write, generate, fix, or review Geb test specs, mentions Geb, GebSpec, GebReportingSpec, or asks about browser automation with Groovy\u002FSpock. Also trigger for requests involving Page Objects in a Groovy\u002FGradle project, `at` checkers, Geb content DSL, or `waitFor` usage. Even if the user just says \"write me a Geb test\" or \"help me test this page\", use this skill.","apache\u002Fgroovy-geb","apache","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47359?v=4","01M6AC83E6K4FDKK7HZ8WNMQKE","The Apache Software Foundation","01M6ACH958JG2071ABMB27A13H",1174,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fapache\u002Fgroovy-geb\u002Fblob\u002Fmaster\u002F.agents\u002Fskills\u002Fgeb-spock\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[27,28,29,30,31,32,33,34,35,36,37,38],"geb spock","review","browser automation","automation","test","generate","help","best practices","browser","framework","groovy","content","2026-11-10 10:12:30",false,"---\nname: geb-spock\ndescription: >\n  Write Geb browser automation tests using the Spock framework with best practices.\n  Use this skill whenever the user asks to write, generate, fix, or review Geb test specs,\n  mentions Geb, GebSpec, GebReportingSpec, or asks about browser automation with Groovy\u002FSpock.\n  Also trigger for requests involving Page Objects in a Groovy\u002FGradle project, `at` checkers,\n  Geb content DSL, or `waitFor` usage. Even if the user just says \"write me a Geb test\" or\n  \"help me test this page\", use this skill.\nlicense: Apache-2.0\n---\n\n\u003C!--\nSPDX-License-Identifier: Apache-2.0\n\nLicensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0.\n-->\n\n# Geb Testing Skill\n\nGenerates and reviews Geb + Spock browser automation specs following intermediate-level best practices.\n\nGeb documentation is at https:\u002F\u002Fgroovy.apache.org\u002Fgeb\u002Fmanual\u002Fcurrent\u002F.\n\n## Core Principles\n\n1. **Always use Page Objects** — never inline selectors in specs.\n2. **Use `at` checkers** — every Page Object must declare `static at`.\n3. **Prefer CSS selectors** over XPath; avoid brittle nth-child selectors.\n4. **Use `waitFor` explicitly** for dynamic content; never `Thread.sleep`.\n    1. Strongly prefer to put `waitFor` method calls into methods inside classes that extend `geb.Page`, `geb.Module`, or other shared test fixtures. If clicking or interacting with some object on a page requires waiting for some response, it's best to encapsulate that knowledge into a method on the pageObject (e.g. `deleteTableRow` or `submitForm`) that then waits for the signal that the operation is complete. That will make the knowledge of your page more reusable and avoid repeated `waitFor`.\n5. **Use `GebReportingSpec`** (not `GebSpec`) so screenshots are captured on failure.\n6. **Keep specs in `given\u002Fwhen\u002Fthen` blocks** — one behaviour per feature method.\n    1. Caveat: if a behaviour requires multiple steps, it's okay to have multiple `when\u002Fthen` block pairs within one test method, so long as each intermediary step is integral to the journey under test.\n7. **Use Modules** for repeated UI components (nav bars, modals, form rows).\n8. Avoid writing flaky tests by stress-testing your Geb spec before committing:\n    1. Try [introducing network latency](https:\u002F\u002Fgroovy.apache.org\u002Fgeb\u002Fmanual\u002Fcurrent\u002F#controlling-network-conditions) to verify that a test will pass on a slow network.\n    2. Try re-running tests many times in succession locally to ensure they aren't flaky\n\n---\n\n## Spec File Structure\n\n```groovy\npackage com.example.specs\n\nimport geb.spock.GebReportingSpec\nimport com.example.pages.LoginPage\nimport com.example.pages.DashboardPage\nimport spock.lang.Stepwise   \u002F\u002F only when steps truly depend on each other\n\n@Stepwise                    \u002F\u002F omit if steps are independent\nclass LoginSpec extends GebReportingSpec {\n\n    def \"successful login redirects to dashboard\"() {\n        given: \"user is on the login page\"\n        to LoginPage\n\n        when: \"valid credentials are submitted\"\n        loginForm.username = \"user@example.com\"\n        loginForm.password = \"secret\"\n        loginForm.submit()\n\n        then: \"the dashboard is displayed\"\n        at DashboardPage\n        welcomeMessage.text() == \"Welcome, user@example.com\"\n    }\n\n    def \"login fails with invalid credentials\"() {\n        given:\n        to LoginPage\n\n        when:\n        loginForm.username = \"bad@example.com\"\n        loginForm.password = \"wrong\"\n        loginForm.submit()\n\n        then:\n        at LoginPage\n        errorMessage.displayed\n        errorMessage.text().contains(\"Invalid credentials\")\n    }\n}\n```\n\n---\n\n## Page Object Structure\n\n```groovy\npackage com.example.pages\n\nimport geb.Page\nimport com.example.modules.LoginFormModule\n\nclass LoginPage extends Page {\n\n    \u002F\u002F `at` checker — verified when `to` or `at` is called\n    static at = { title == \"Login | MyApp\" }\n\n    \u002F\u002F URL for `to LoginPage`\n    static url = \"\u002Flogin\"\n\n    static content = {\n        \u002F\u002F Lazy by default; set required: false for optional elements\n        loginForm    { module(LoginFormModule) }\n        errorMessage(required: false) { $(\".alert-error\") }\n    }\n}\n```\n\n```groovy\nclass DashboardPage extends Page {\n    static at = { $(\"h1.dashboard-title\").displayed }\n    static url = \"\u002Fdashboard\"\n\n    static content = {\n        welcomeMessage { $(\".welcome-msg\") }\n        navBar         { module(NavBarModule) }\n    }\n}\n```\n\n---\n\n## Module Structure\n\nUse modules for components that repeat across pages (nav, modal, form row, table row).\n\n```groovy\npackage com.example.modules\n\nimport geb.Module\n\nclass LoginFormModule extends Module {\n\n    static content = {\n        username { $(\"input[name='username']\") }\n        password { $(\"input[name='password']\") }\n        submitBtn { $(\"button[type='submit']\") }\n    }\n\n    void submit() {\n        submitBtn.click()\n    }\n}\n```\n\n---\n\n## `waitFor` Patterns\n\n```groovy\n\u002F\u002F Wait for element to appear (default timeout from GebConfig)\nwaitFor { $(\".spinner\").not(\".active\") }\n\n\u002F\u002F Wait with custom timeout (seconds)\nwaitFor(10) { successBanner.displayed }\n\n\u002F\u002F Wait and return the element\ndef result = waitFor { $(\".result-row\") }\n\n\u002F\u002F Use in content DSL for elements that load dynamically\nstatic content = {\n    \u002F\u002F Wait for this element every time it's accessed\n    asyncTable(wait: true) { $(\"table.results\") }\n}\n```\n\n> **Never use `Thread.sleep`**. If `waitFor` keeps timing out, make sure your assertion is actually eventually true (you may be relying on an unreliable side effect), ensure that your page is completing its work as quickly as it can, or increase the timeout in `GebConfig.groovy` rather than sleeping.\n\n---\n\n## Selector Best Practices\n\n| ✅ Prefer                      | ❌ Avoid                                          |\n|-------------------------------|--------------------------------------------------|\n| `$(\"input[name='email']\")`    | `$(\"div > div:nth-child(2) > input\")`            |\n| `$(\".submit-btn\")`            | `$(\"button\", text: \"Submit\")` (fragile for i18n) |\n| `$(\"table.results tbody tr\")` | XPath selectors                                  |\n| `data-testid` attributes      | Position-based selectors                         |\n\nIf the app doesn't have `data-testid` attrs, use stable semantic selectors: `name`, `id`, `aria-label`, `role`.\n\n---\n\n## Common Patterns\n\n### Checking a list of items\n```groovy\ndef rows = \nrows.size() == 3\nrows[0].find(\"td.name\").text() == \"Alice\"\n```\n\n### Filling a form\n```groovy\n$(\"input[name='firstName']\").value(\"Jane\")\n$(\"select[name='country']\").value(\"US\")\n$(\"input[type='checkbox'][name='agree']\").value(true)\n```\n\n### Interacting with dropdowns (non-native)\n```groovy\n\u002F\u002F For custom JS dropdowns (not \u003Cselect>)\n$(\".dropdown-trigger\").click()\nwaitFor { $(\".dropdown-menu\").displayed }\n$(\".dropdown-menu li\", text: \"Option B\").click()\n```\n\n### Asserting navigation\n```groovy\n\u002F\u002F Checks URL and `at` checker\nat ConfirmationPage\ncurrentUrl.contains(\"\u002Fconfirmation\")\n```\n\n---\n\n## Anti-Patterns to Avoid\n\n- **`@Stepwise` overuse** — only use when steps share state (e.g., a multi-step wizard). Independent scenarios should be separate specs or use `setup()`\u002F`cleanup()`.\n- **Assertions inside `when:` blocks** — lines after `then:` or `expect:` are automatically asserted - no need to even supply the `assert` keyword!\n- **`sleep()`** anywhere in test code.\n- **Hard-coded absolute URLs** — use relative paths; base URL lives in `GebConfig.groovy`.\n- **Accessing the DOM directly in specs** — all `$()` calls belong in Page Objects or Modules.\n- **Overusing `required: false`** on optional content - the only time you really want to mark a page element as `required: false` is when your spec *needs* to try to interact with it when it's absent (for example, to assert that it isn't present, `!page.buttons.sometimesThereButton`). If the button may or may not be there, but you never test the case where it isn't there, you should just leave it as required. Remember, throwing an exception when something _exceptional_ happens is okay, especially in tests!\n\n### Avoiding creating flaky tests\n\nBrowser testing frameworks like Geb sometimes get a bad reputation for being flaky, but with some diligence you can keep your Geb tests more reliable!\n\n#### Introduce Network latency\nAdding even a small amount of [network latency](https:\u002F\u002Fgroovy.apache.org\u002Fgeb\u002Fmanual\u002Fcurrent\u002F#controlling-network-conditions) to your test can expose places where you probably want to add a `waitFor` statement to your page object. Drop some code like this in your test's `setup()` method and run it a few times to make sure it consistently works:\n```groovy\ndef networkLatency = java.time.Duration.ofMillis(500)\nbrowser.networkLatency = networkLatency\n```\n\n#### Introduce reruns\nWhile developing your tests, try doing a pass of re-running the test locally to make sure it consistently passes. If each of your tests only fails 1 time out of a hundred, but you have ten tests, your build pipelines are going to be flakier than your team can tolerate.\n\nIf you're using `geb-spock`, use the [RepeatUntilFailure](https:\u002F\u002Fspockframework.org\u002Fspock\u002Fdocs\u002F2.4\u002Fall_in_one.html#_repeat_until_failure) annotation with a `maxAttempts` value to run the test locally. You probably won't want to **commit** that annotation in most cases, but it's a good tool to verify your test is consistent before making it a blocker for someone else's PR.\n","\u003C!--\nSPDX-License-Identifier: Apache-2.0\n\nLicensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0.\n-->\n\n# Geb Testing Skill\n\nGenerates and reviews Geb + Spock browser automation specs following intermediate-level best practices.\n\nGeb documentation is at https:\u002F\u002Fgroovy.apache.org\u002Fgeb\u002Fmanual\u002Fcurrent\u002F.\n\n## Core Principles\n\n1. **Always use Page Objects** — never inline selectors in specs.\n2. **Use `at` checkers** — every Page Object must declare `static at`.\n3. **Prefer CSS selectors** over XPath; avoid brittle nth-child selectors.\n4. **Use `waitFor` explicitly** for dynamic content; never `Thread.sleep`.\n    1. Strongly prefer to put `waitFor` method calls into methods inside classes that extend `geb.Page`, `geb.Module`, or other shared test fixtures. If clicking or interacting with some object on a page requires waiting for some response, it's best to encapsulate that knowledge into a method on the pageObject (e.g. `deleteTableRow` or `submitForm`) that then waits for the signal that the operation is complete. That will make the knowledge of your page more reusable and avoid repeated `waitFor`.\n5. **Use `GebReportingSpec`** (not `GebSpec`) so screenshots are captured on failure.\n6. **Keep specs in `given\u002Fwhen\u002Fthen` blocks** — one behaviour per feature method.\n    1. Caveat: if a behaviour requires multiple steps, it's okay to have multiple `when\u002Fthen` block pairs within one test method, so long as each intermediary step is integral to the journey under test.\n7. **Use Modules** for repeated UI components (nav bars, modals, form rows).\n8. Avoid writing flaky tests by stress-testing your Geb spec before committing:\n    1. Try [introducing network latency](https:\u002F\u002Fgroovy.apache.org\u002Fgeb\u002Fmanual\u002Fcurrent\u002F#controlling-network-conditions) to verify that a test will pass on a slow network.\n    2. Try re-running tests many times in succession locally to ensure they aren't flaky\n\n---\n\n## Spec File Structure\n\n```groovy\npackage com.example.specs\n\nimport geb.spock.GebReportingSpec\nimport com.example.pages.LoginPage\nimport com.example.pages.DashboardPage\nimport spock.lang.Stepwise   \u002F\u002F only when steps truly depend on each other\n\n@Stepwise                    \u002F\u002F omit if steps are independent\nclass LoginSpec extends GebReportingSpec {\n\n    def \"successful login redirects to dashboard\"() {\n        given: \"user is on the login page\"\n        to LoginPage\n\n        when: \"valid credentials are submitted\"\n        loginForm.username = \"user@example.com\"\n        loginForm.password = \"secret\"\n        loginForm.submit()\n\n        then: \"the dashboard is displayed\"\n        at DashboardPage\n        welcomeMessage.text() == \"Welcome, user@example.com\"\n    }\n\n    def \"login fails with invalid credentials\"() {\n        given:\n        to LoginPage\n\n        when:\n        loginForm.username = \"bad@example.com\"\n        loginForm.password = \"wrong\"\n        loginForm.submit()\n\n        then:\n        at LoginPage\n        errorMessage.displayed\n        errorMessage.text().contains(\"Invalid credentials\")\n    }\n}\n```\n\n---\n\n## Page Object Structure\n\n```groovy\npackage com.example.pages\n\nimport geb.Page\nimport com.example.modules.LoginFormModule\n\nclass LoginPage extends Page {\n\n    \u002F\u002F `at` checker — verified when `to` or `at` is called\n    static at = { title == \"Login | MyApp\" }\n\n    \u002F\u002F URL for `to LoginPage`\n    static url = \"\u002Flogin\"\n\n    static content = {\n        \u002F\u002F Lazy by default; set required: false for optional elements\n        loginForm    { module(LoginFormModule) }\n        errorMessage(required: false) { $(\".alert-error\") }\n    }\n}\n```\n\n```groovy\nclass DashboardPage extends Page {\n    static at = { $(\"h1.dashboard-title\").displayed }\n    static url = \"\u002Fdashboard\"\n\n    static content = {\n        welcomeMessage { $(\".welcome-msg\") }\n        navBar         { module(NavBarModule) }\n    }\n}\n```\n\n---\n\n## Module Structure\n\nUse modules for components that repeat across pages (nav, modal, form row, table row).\n\n```groovy\npackage com.example.modules\n\nimport geb.Module\n\nclass LoginFormModule extends Module {\n\n    static content = {\n        username { $(\"input[name='username']\") }\n        password { $(\"input[name='password']\") }\n        submitBtn { $(\"button[type='submit']\") }\n    }\n\n    void submit() {\n        submitBtn.click()\n    }\n}\n```\n\n---\n\n## `waitFor` Patterns\n\n```groovy\n\u002F\u002F Wait for element to appear (default timeout from GebConfig)\nwaitFor { $(\".spinner\").not(\".active\") }\n\n\u002F\u002F Wait with custom timeout (seconds)\nwaitFor(10) { successBanner.displayed }\n\n\u002F\u002F Wait and return the element\ndef result = waitFor { $(\".result-row\") }\n\n\u002F\u002F Use in content DSL for elements that load dynamically\nstatic content = {\n    \u002F\u002F Wait for this element every time it's accessed\n    asyncTable(wait: true) { $(\"table.results\") }\n}\n```\n\n> **Never use `Thread.sleep`**. If `waitFor` keeps timing out, make sure your assertion is actually eventually true (you may be relying on an unreliable side effect), ensure that your page is completing its work as quickly as it can, or increase the timeout in `GebConfig.groovy` rather than sleeping.\n\n---\n\n## Selector Best Practices\n\n| ✅ Prefer                      | ❌ Avoid                                          |\n|-------------------------------|--------------------------------------------------|\n| `$(\"input[name='email']\")`    | `$(\"div > div:nth-child(2) > input\")`            |\n| `$(\".submit-btn\")`            | `$(\"button\", text: \"Submit\")` (fragile for i18n) |\n| `$(\"table.results tbody tr\")` | XPath selectors                                  |\n| `data-testid` attributes      | Position-based selectors                         |\n\nIf the app doesn't have `data-testid` attrs, use stable semantic selectors: `name`, `id`, `aria-label`, `role`.\n\n---\n\n## Common Patterns\n\n### Checking a list of items\n```groovy\ndef rows = \nrows.size() == 3\nrows[0].find(\"td.name\").text() == \"Alice\"\n```\n\n### Filling a form\n```groovy\n$(\"input[name='firstName']\").value(\"Jane\")\n$(\"select[name='country']\").value(\"US\")\n$(\"input[type='checkbox'][name='agree']\").value(true)\n```\n\n### Interacting with dropdowns (non-native)\n```groovy\n\u002F\u002F For custom JS dropdowns (not \u003Cselect>)\n$(\".dropdown-trigger\").click()\nwaitFor { $(\".dropdown-menu\").displayed }\n$(\".dropdown-menu li\", text: \"Option B\").click()\n```\n\n### Asserting navigation\n```groovy\n\u002F\u002F Checks URL and `at` checker\nat ConfirmationPage\ncurrentUrl.contains(\"\u002Fconfirmation\")\n```\n\n---\n\n## Anti-Patterns to Avoid\n\n- **`@Stepwise` overuse** — only use when steps share state (e.g., a multi-step wizard). Independent scenarios should be separate specs or use `setup()`\u002F`cleanup()`.\n- **Assertions inside `when:` blocks** — lines after `then:` or `expect:` are automatically asserted - no need to even supply the `assert` keyword!\n- **`sleep()`** anywhere in test code.\n- **Hard-coded absolute URLs** — use relative paths; base URL lives in `GebConfig.groovy`.\n- **Accessing the DOM directly in specs** — all `$()` calls belong in Page Objects or Modules.\n- **Overusing `required: false`** on optional content - the only time you really want to mark a page element as `required: false` is when your spec *needs* to try to interact with it when it's absent (for example, to assert that it isn't present, `!page.buttons.sometimesThereButton`). If the button may or may not be there, but you never test the case where it isn't there, you should just leave it as required. Remember, throwing an exception when something _exceptional_ happens is okay, especially in tests!\n\n### Avoiding creating flaky tests\n\nBrowser testing frameworks like Geb sometimes get a bad reputation for being flaky, but with some diligence you can keep your Geb tests more reliable!\n\n#### Introduce Network latency\nAdding even a small amount of [network latency](https:\u002F\u002Fgroovy.apache.org\u002Fgeb\u002Fmanual\u002Fcurrent\u002F#controlling-network-conditions) to your test can expose places where you probably want to add a `waitFor` statement to your page object. Drop some code like this in your test's `setup()` method and run it a few times to make sure it consistently works:\n```groovy\ndef networkLatency = java.time.Duration.ofMillis(500)\nbrowser.networkLatency = networkLatency\n```\n\n#### Introduce reruns\nWhile developing your tests, try doing a pass of re-running the test locally to make sure it consistently passes. If each of your tests only fails 1 time out of a hundred, but you have ten tests, your build pipelines are going to be flakier than your team can tolerate.\n\nIf you're using `geb-spock`, use the [RepeatUntilFailure](https:\u002F\u002Fspockframework.org\u002Fspock\u002Fdocs\u002F2.4\u002Fall_in_one.html#_repeat_until_failure) annotation with a `maxAttempts` value to run the test locally. You probably won't want to **commit** that annotation in most cases, but it's a good tool to verify your test is consistent before making it a blocker for someone else's PR.\n",{"name":5,"license":15,"description":44},"Write Geb browser automation tests using the Spock framework with best practices. Use this skill whenever the user asks to write, generate, fix, or review Geb test specs, mentions Geb, GebSpec, GebReportingSpec, or asks about browser automation with Groovy\u002FSpock. Also trigger for requests involving Page Objects in a Groovy\u002FGradle project, `at` checkers, Geb content DSL, or `waitFor` usage. Even if the user just says \"write me a Geb test\" or \"help me test this page\", use this skill.\n","master","c46a5be20c9ab18cc1391c0c1e97b804d66ea7bb",".agents\u002Fskills\u002Fgeb-spock",236,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fgroovy-geb","https:\u002F\u002Fgroovy.apache.org\u002Fgeb","https:\u002F\u002Fgithub.com\u002Fapache","https:\u002F\u002Fwww.apache.org\u002F","2026-11-14 05:48:48",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add apache\u002Fgroovy-geb --skill geb-spock",{"tool":60,"command":61},"bunx","bunx skills add apache\u002Fgroovy-geb --skill geb-spock",{"tool":63,"command":64},"pnpm","pnpm dlx skills add apache\u002Fgroovy-geb --skill geb-spock","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fapache\u002Fgroovy-geb\u002Fblob\u002Fmaster\u002F.agents\u002Fskills\u002Fgeb-spock\u002FSKILL.md",true,[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"scripts\u002Fsessions.py","SCRIPT","脚本",11118,"https:\u002F\u002Fgithub.com\u002Fdrn\u002Fdots\u002Fblob\u002Fmaster\u002Fagents\u002Fskills\u002Fdream\u002Fscripts\u002Fsessions.py",[]]