Skip to content

Commit 6da4d4f

Browse files
authored
Merge pull request #16 from ColdBox/claude/bx-playwright-research-plan-ddfqpm
Browser testing skills: TestBox BrowserSpec and ColdBox BrowserTestCase
2 parents 96342f6 + eb7685c commit 6da4d4f

13 files changed

Lines changed: 836 additions & 20 deletions

File tree

‎.claude-plugin/marketplace.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"metadata": {
88
"description": "ColdBox skills for Claude Code — handlers, routing, REST APIs, interceptors, testing, security, ORM, WireBox DI, CacheBox, and LogBox",
9-
"version": "1.0.0",
9+
"version": "1.1.0",
1010
"pluginRoot": "."
1111
},
1212
"plugins": [
@@ -17,7 +17,7 @@
1717
"repo": "ColdBox/skills"
1818
},
1919
"description": "ColdBox skills for Claude Code — handlers, routing, REST APIs, interceptors, testing, security, ORM, WireBox DI, CacheBox, and LogBox",
20-
"version": "1.0.0",
20+
"version": "1.1.0",
2121
"author": {
2222
"name": "Ortus Solutions",
2323
"email": "info@ortussolutions.com"

‎.claude-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coldbox-agent-skills",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "ColdBox skills for Claude Code — handlers, routing, REST APIs, interceptors, testing, security, ORM, WireBox DI, CacheBox, LogBox, and ContentBox CMS",
55
"author": {
66
"name": "Ortus Solutions",

‎.cursor-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "coldbox-agent-skills",
33
"displayName": "ColdBox Skills",
44
"description": "ColdBox skills for Cursor — handlers, routing, REST APIs, interceptors, testing, security, ORM, WireBox DI, CacheBox, LogBox, and ContentBox CMS.",
5-
"version": "1.0.0",
5+
"version": "1.1.0",
66
"author": {
77
"name": "Ortus Solutions",
88
"url": "https://www.ortussolutions.com"

‎.grok-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coldbox-agent-skills",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "ColdBox skills for Grok — handlers, routing, REST APIs, interceptors, testing, security, ORM, WireBox DI, CacheBox, LogBox, and ContentBox CMS.",
55
"author": {
66
"name": "Ortus Solutions",

‎README.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,28 +112,30 @@ The [`.claude-plugin/plugin.json`](./.claude-plugin/plugin.json) registers these
112112

113113
| Skill | What It Covers |
114114
|---|---|
115-
| [`testing-base-classes`](./coldbox/testing-base-classes/SKILL.md) | Testing class hierarchy, annotations (appMapping, configMapping, unloadColdBox), test harness setup, when to use each base class |
115+
| [`testing-base-classes`](./coldbox/testing-base-classes/SKILL.md) | Testing class hierarchy, annotations (appMapping, configMapping, unloadColdBox), test harness setup, when to use each base class, including `BrowserTestCase` |
116116
| [`testing-handler`](./coldbox/testing-handler/SKILL.md) | Handler testing with `execute()`, rc/prc assertions, view selection, renderData, relocations, mock injection, BaseHandlerTest isolation |
117117
| [`testing-integration`](./coldbox/testing-integration/SKILL.md) | Full virtual-app integration tests, lifecycle management, route testing, database rollback, custom matchers |
118118
| [`testing-http-methods`](./coldbox/testing-http-methods/SKILL.md) | `get()`, `post()`, `put()`, `patch()`, `delete()`, `request()` simulation, headers, JSON bodies, `toHaveStatus()`, `toHaveInvalidData()` |
119119
| [`testing-model`](./coldbox/testing-model/SKILL.md) | BaseModelTest, the `model` variable, mockLogger/mockLogBox/mockCacheBox/mockWireBox, mocking collaborators, init() patterns |
120120
| [`testing-interceptor`](./coldbox/testing-interceptor/SKILL.md) | BaseInterceptorTest, the `interceptor` variable, mockController/mockRequestService/mockFlash, configProperties, announce point testing |
121+
| [`testing-browser`](./coldbox/testing-browser/SKILL.md) | `BrowserTestCase` browser tests (BoxLang + bx-playwright): `browse()`, `routeURL()`/`visitRoute()`/`assertRouteIs()`, `loginAs()`/`logout()` with the BrowserTesting module and its security model, app server setup, CI |
121122

122123
### `testbox` — Comprehensive TestBox Skills
123124

124125
| Skill | What It Covers |
125126
|---|---|
126-
| [`bdd`](./testbox/bdd/SKILL.md) | BDD suites with describe/it, Gherkin-style given/when/then, lifecycle hooks, focused/skipped specs, nested suites, labels |
127-
| [`unit`](./testbox/unit/SKILL.md) | xUnit-style tests (testXxx), setup/teardown, `$assert` object, Arrange-Act-Assert pattern |
127+
| [`bdd`](./testbox/bdd/SKILL.md) | BDD suites with describe/it, Gherkin-style given/when/then, lifecycle hooks, focused/skipped specs, nested suites, labels, spec `retries`, `attach()` |
128+
| [`unit`](./testbox/unit/SKILL.md) | xUnit-style tests (testXxx), setup/teardown, `$assert` object, Arrange-Act-Assert pattern, `retries` method annotation |
128129
| [`assertions`](./testbox/assertions/SKILL.md) | `$assert` object, isTrue/isEqual/includes/isEmpty/throws/between/match, custom assertion functions, BoxLang dynamic assertion methods |
129-
| [`expectations`](./testbox/expectations/SKILL.md) | Fluent `expect()`, all matchers (toBe/toBeTrue/toHaveKey/toThrow/toMatch), `not` operator, `expectAll()` over collections, custom matchers |
130+
| [`expectations`](./testbox/expectations/SKILL.md) | Fluent `expect()`, all matchers (toBe/toBeTrue/toHaveKey/toThrow/toMatch), `not` operator, `expectAll()` over collections, custom matchers, browser matchers pointer |
130131
| [`mockbox`](./testbox/mockbox/SKILL.md) | MockBox mocks/stubs/spies, `$()` stubbing, `$args/$results/$throws`, call-count verification, `$callLog`, `querySim`, `$spy` |
131132
| [`cbmockdata`](./testbox/cbmockdata/SKILL.md) | Generating fake data (age, email, name, uuid, lorem, etc.), arrays of objects, nested objects, custom supplier closures |
132-
| [`runners`](./testbox/runners/SKILL.md) | CommandBox CLI runner, BoxLang CLI, HTML runner, programmatic TestBox, watcher mode, streaming runner, all CLI flags |
133-
| [`reporters`](./testbox/reporters/SKILL.md) | ANTJunit/Console/Doc/JSON/JUnit/Min/Simple/Text/XML reporters, reporter options, custom IReporter implementations |
133+
| [`runners`](./testbox/runners/SKILL.md) | CommandBox CLI runner, BoxLang CLI, HTML runner, programmatic TestBox, watcher mode, streaming runner, all CLI flags including `--retries`, `--failed` and `--web-server` |
134+
| [`reporters`](./testbox/reporters/SKILL.md) | ANTJunit/Console/Doc/JSON/JUnit/Min/Simple/Text/XML reporters, reporter options, spec attachments and attempts, custom IReporter implementations |
134135
| [`listeners`](./testbox/listeners/SKILL.md) | Run listeners (onBundleStart/End, onSuiteStart/End, onSpecStart/End), progress indicators, custom loggers, live dashboards |
135136
| [`testing-fixtures`](./testbox/testing-fixtures/SKILL.md) | Fixture factories, test data builders, shared fixture files, cbMockData integration, setup/teardown strategies |
136137
| [`testing-coverage`](./testbox/testing-coverage/SKILL.md) | Code coverage setup, coverage reporting, CI integration, TestBox coverage options, improving coverage of untested paths |
138+
| [`browser-testing`](./testbox/browser-testing/SKILL.md) | `BrowserSpec` browser tests on BoxLang with bx-playwright: `browse()`, annotations, the 9 browser matchers, automatic attachments, `attach()`, retries, `--failed`, `--web-server`, CI, debugging traces |
137139

138140
### `security` — Security and Authentication Skills
139141

@@ -270,7 +272,7 @@ The bundled [`.mcp.json`](./.mcp.json) includes Ortus documentation MCP endpoint
270272
| Path | Purpose |
271273
|---|---|
272274
| [`coldbox/`](./coldbox/) | Core ColdBox framework skills, testing patterns, and database migration workflows |
273-
| [`testbox/`](./testbox/) | Comprehensive TestBox skills (BDD, xUnit, MockBox, runners, reporters) |
275+
| [`testbox/`](./testbox/) | Comprehensive TestBox skills (BDD, xUnit, MockBox, runners, reporters, browser testing) |
274276
| [`security/`](./security/) | Authentication, authorization, CSRF, SSO, passkeys |
275277
| [`wirebox/`](./wirebox/) | WireBox dependency injection |
276278
| [`cachebox/`](./cachebox/) | CacheBox standalone caching |

‎coldbox/testing-base-classes/SKILL.md‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: coldbox-testing-base-classes
3-
description: "Use this skill to understand which ColdBox testing base class to extend for a given test type, configure test bundle annotations (appMapping, configMapping, unloadColdBox, loadColdBox, coldboxAppKey), set up the tests/ harness (Application.cfc, folder structure), or choose between integration testing (BaseTestCase), isolated handler testing (BaseHandlerTest), model unit testing (BaseModelTest), and interceptor unit testing (BaseInterceptorTest)."
3+
description: "Use this skill to understand which ColdBox testing base class to extend for a given test type, configure test bundle annotations (appMapping, configMapping, unloadColdBox, loadColdBox, coldboxAppKey), set up the tests/ harness (Application.cfc, folder structure), or choose between integration testing (BaseTestCase), isolated handler testing (BaseHandlerTest), model unit testing (BaseModelTest), interceptor unit testing (BaseInterceptorTest), and real-browser testing of the running app (BrowserTestCase, BoxLang + bx-playwright)."
44
applyTo: "**/*.{bx,bxm,cfc,cfm,cfml}"
55
---
66

@@ -13,7 +13,8 @@ testbox.system.BaseSpec
1313
└── coldbox.system.testing.BaseTestCase
1414
├── coldbox.system.testing.BaseHandlerTest
1515
├── coldbox.system.testing.BaseModelTest
16-
└── coldbox.system.testing.BaseInterceptorTest
16+
├── coldbox.system.testing.BaseInterceptorTest
17+
└── coldbox.system.testing.BrowserTestCase (BoxLang only, ColdBox 8.3+)
1718
```
1819

1920
---
@@ -26,6 +27,7 @@ testbox.system.BaseSpec
2627
| Handler CFC in complete isolation (no app load) | `BaseHandlerTest` |
2728
| A model/service/ORM entity in isolation | `BaseModelTest` |
2829
| An interceptor CFC in isolation | `BaseInterceptorTest` |
30+
| User journeys in a real browser against the running app (forms, JavaScript, sessions, named routes, `loginAs()`) | `BrowserTestCase` (see `coldbox-testing-browser`) |
2931
| Any CFML/BX component with no ColdBox app | `BaseSpec` (TestBox) |
3032

3133
---
@@ -237,6 +239,27 @@ class extends="coldbox.system.testing.BaseInterceptorTest"
237239

238240
---
239241

242+
## BrowserTestCase (Real Browser)
243+
244+
`BrowserTestCase` (BoxLang only, needs bx-playwright and TestBox 7.2+) still loads the app virtually like `BaseTestCase`, and drives a real browser against your **running** server. Extra annotations: `baseURL` (the running app) and `browserProfile` (bx-playwright profiles). It adds `browse()`, the TestBox browser matchers, and the ColdBox helpers `routeURL()`, `visitRoute()`, `assertRouteIs()`, `loginAs()` and `logout()`. Without bx-playwright its browser specs are skipped, not failed. Full guide: the [`coldbox-testing-browser`](../testing-browser/SKILL.md) skill.
245+
246+
```boxlang
247+
class extends="coldbox.system.testing.BrowserTestCase" appMapping="/root" baseURL="http://127.0.0.1:8080" {
248+
function run() {
249+
describe( "Users", () => {
250+
it( "shows a user", () => {
251+
browse( ( page ) => {
252+
visitRoute( page, "users.show", { id : 5 } )
253+
expect( page ).toSee( "User 5" )
254+
} )
255+
} )
256+
} )
257+
}
258+
}
259+
```
260+
261+
---
262+
240263
## Custom TestBox Matchers (ColdBox adds)
241264

242265
| Matcher | Used on | Description |

0 commit comments

Comments
 (0)