agents-cli-automation 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,6 +6,14 @@ argument-hint: "(no args)"
|
|
|
6
6
|
|
|
7
7
|
# Playwright + TypeScript (BDD-capable) — repo snapshot
|
|
8
8
|
|
|
9
|
+
**Current Setup (Feb 2026) — Always Latest**
|
|
10
|
+
- **@playwright/test**: latest
|
|
11
|
+
- **playwright-bdd**: latest (always pulls latest stable)
|
|
12
|
+
- **typescript**: latest
|
|
13
|
+
- **@types/node**: latest
|
|
14
|
+
|
|
15
|
+
This setup automatically picks the latest versions on each `npm install`.
|
|
16
|
+
|
|
9
17
|
This document explains the current Playwright + TypeScript scaffold and details the recommended layout for:
|
|
10
18
|
- Page Object Models using `@playwright/test`
|
|
11
19
|
- A small JSON data util
|
|
@@ -13,13 +21,14 @@ This document explains the current Playwright + TypeScript scaffold and details
|
|
|
13
21
|
- Step definitions that consume fixtures via `playwright-bdd`
|
|
14
22
|
|
|
15
23
|
**Key points (current state and recommended layout)**
|
|
16
|
-
- Playwright config
|
|
24
|
+
- Playwright config uses `defineBddConfig()` from `playwright-bdd` to export the BDD configuration: see [playwright.config.ts](playwright.config.ts). The config is version-agnostic and works seamlessly with latest package versions. The `bddConfig` includes `features`, `steps`, and `outputDir` patterns.
|
|
25
|
+
- The `ui` project has `testDir: '.features-gen'` and `testMatch: '**/*.feature.spec.{ts,js}'` to discover generated specs.
|
|
17
26
|
- Place Gherkin features in `tests/features/*.feature` (example: [tests/features/login.feature](tests/features/login.feature)).
|
|
18
27
|
- Page Objects: implement page classes under `tests/pages/` (example: `tests/pages/login.page.ts`) and import `Page` from `@playwright/test`.
|
|
19
28
|
- Test data util: add a JSON reader like `tests/utils/data.ts` that loads `tests/data/*.json` so tests/steps can read credentials and fixtures.
|
|
20
|
-
- Fixtures: create `tests/fixtures/base.fixture.ts` that extends `test` from `@playwright/test` and registers fixtures (for example `loginPage`)
|
|
29
|
+
- Fixtures: create `tests/fixtures/base.fixture.ts` that extends `test` from `playwright-bdd` (or `@playwright/test`) and registers fixtures (for example `loginPage`). Include the fixtures file in the `steps` pattern in `bddConfig` so the generator can discover them.
|
|
21
30
|
- Steps: implement step definitions under `tests/steps/*.ts`. Use `createBdd(test)` from `playwright-bdd` and register Given/When/Then handlers that accept fixtures (e.g., `loginPage`) and call page object methods.
|
|
22
|
-
- Generated specs: the generator writes Playwright specs into `.features-gen`
|
|
31
|
+
- Generated specs: the generator writes Playwright specs into `.features-gen` (configured via `outputDir` in `bddConfig`) when using `npx bddgen`. The generated files are `.feature.spec.js` (or `.ts`) and are discovered by the `ui` project via `testMatch: '**/*.feature.spec.{ts,js}'`.
|
|
23
32
|
|
|
24
33
|
Files to inspect or add quickly
|
|
25
34
|
- Playwright config: [playwright.config.ts](playwright.config.ts)
|
|
@@ -39,31 +48,36 @@ How the flow works here
|
|
|
39
48
|
- Write step definitions in `tests/steps/*.ts` using `playwright-bdd`'s `createBdd(test)` helper. Example pattern:
|
|
40
49
|
- import `createBdd` and your `test` fixture: `const { Given, When, Then } = createBdd(test)`
|
|
41
50
|
- register steps that accept fixtures: `Given('I open login page', async ({ loginPage }) => { await loginPage.goto(); })`.
|
|
42
|
-
- Option A — Generator flow: use `npx bddgen` to turn `.feature` files into Playwright specs in `.features-gen` (generator reads `bddConfig` in `playwright.config.ts`).
|
|
51
|
+
- Option A — Generator flow: use `npx bddgen` to turn `.feature` files into Playwright specs in `.features-gen` (generator reads `bddConfig` in `playwright.config.ts`). The `bddConfig` must include:
|
|
52
|
+
- `features`: glob pattern pointing to `.feature` files
|
|
53
|
+
- `steps`: glob patterns for step definitions **and fixtures** (e.g., `['tests/steps/**/*.ts', 'tests/fixtures/**/*.ts']`)
|
|
54
|
+
- `outputDir`: where generated specs are written (default `.features-gen`)
|
|
43
55
|
- Option B — Direct spec flow (recommended for quick runs): write a small `tests/specs/*.ts` Playwright test that imports your fixtures and page objects (no generation). This bypasses generator compatibility issues and runs immediately with `npx playwright test`.
|
|
44
56
|
|
|
45
57
|
Run the direct Playwright spec (no generator required):
|
|
46
58
|
|
|
47
59
|
```bash
|
|
48
|
-
npm install
|
|
60
|
+
npm install # Always installs latest versions
|
|
49
61
|
npx playwright install
|
|
50
62
|
npx playwright test --project=ui tests/specs/login.spec.ts
|
|
51
63
|
```
|
|
52
64
|
|
|
53
|
-
|
|
65
|
+
Or use the npm test script (auto-runs bddgen + test together):
|
|
54
66
|
|
|
55
67
|
```bash
|
|
56
|
-
npm
|
|
57
|
-
npx bddgen
|
|
58
|
-
npx playwright test --project=ui
|
|
68
|
+
npm test
|
|
59
69
|
```
|
|
60
70
|
|
|
61
71
|
Notes & tips
|
|
72
|
+
- **Always Latest**: Dependencies in `package.json` use `"latest"` to ensure every `npm install` picks the most recent stable versions of Playwright, TypeScript, and playwright-bdd.
|
|
62
73
|
- Keep fixtures stable: generated specs import your fixture module, so keep `tests/fixtures/base.fixture.ts` API stable.
|
|
63
|
-
-
|
|
74
|
+
- Always include fixtures in the `steps` pattern (e.g., `steps: [..., 'tests/fixtures/**/*.ts']`) so the generator can detect and use your custom `test` instance.
|
|
64
75
|
- Steps should not import `@playwright/test` directly for test helpers — they should use the fixtures passed by `playwright-bdd` (the `test` instance you pass to `createBdd(test)`). Page objects, however, should import `Page` and be created inside fixtures.
|
|
76
|
+
- The `testMatch` in the `ui` project should match `**/*.feature.spec.{ts,js}` to discover generated specs regardless of language (TypeScript or JavaScript output).
|
|
77
|
+
- To lock specific versions if needed, replace `"latest"` with pinned versions (e.g., `"^1.58.0"`).
|
|
65
78
|
|
|
66
79
|
If you'd like, I can now:
|
|
67
|
-
- Run the direct spec and show results
|
|
68
|
-
-
|
|
69
|
-
-
|
|
80
|
+
- Run the direct spec and show results: `npm run test`
|
|
81
|
+
- Troubleshoot BDD generation or test failures
|
|
82
|
+
- Add more page objects and step definitions
|
|
83
|
+
- Initialize Git + CI and wire automation tests into GitHub Actions workflow
|