agents-cli-automation 1.0.13 → 1.0.14
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,13 +6,13 @@ argument-hint: "(no args)"
|
|
|
6
6
|
|
|
7
7
|
# Playwright + TypeScript (BDD-capable) — repo snapshot
|
|
8
8
|
|
|
9
|
-
**Current Setup (Feb 2026) —
|
|
10
|
-
- **@playwright/test**:
|
|
11
|
-
- **playwright-bdd**:
|
|
12
|
-
- **typescript**:
|
|
13
|
-
- **@types/node**:
|
|
9
|
+
**Current Setup (Feb 2026) — Latest Pinned**
|
|
10
|
+
- **@playwright/test**: pinned to verified stable version
|
|
11
|
+
- **playwright-bdd**: pinned to verified stable version
|
|
12
|
+
- **typescript**: pinned to verified stable version
|
|
13
|
+
- **@types/node**: pinned to verified stable version
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Initial setup installs latest versions, then locks them to prevent unexpected updates.
|
|
16
16
|
|
|
17
17
|
This document explains the current Playwright + TypeScript scaffold and details the recommended layout for:
|
|
18
18
|
- Page Object Models using `@playwright/test`
|
|
@@ -21,14 +21,15 @@ This document explains the current Playwright + TypeScript scaffold and details
|
|
|
21
21
|
- Step definitions that consume fixtures via `playwright-bdd`
|
|
22
22
|
|
|
23
23
|
**Key points (current state and recommended layout)**
|
|
24
|
-
- Playwright config uses `defineBddConfig()` from `playwright-bdd` to export the BDD configuration: see [playwright.config.ts](playwright.config.ts). The config
|
|
24
|
+
- Playwright config uses `defineBddConfig()` from `playwright-bdd` to export the BDD configuration: see [playwright.config.ts](playwright.config.ts). The config includes `features`, `steps`, and `outputDir` patterns with reporter configuration for HTML, JSON, and JUnit outputs.
|
|
25
25
|
- The `ui` project has `testDir: '.features-gen'` and `testMatch: '**/*.feature.spec.{ts,js}'` to discover generated specs.
|
|
26
26
|
- Place Gherkin features in `tests/features/*.feature` (example: [tests/features/login.feature](tests/features/login.feature)).
|
|
27
27
|
- Page Objects: implement page classes under `tests/pages/` (example: `tests/pages/login.page.ts`) and import `Page` from `@playwright/test`.
|
|
28
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.
|
|
29
|
-
- Fixtures: create `tests/fixtures/base.fixture.ts` that extends `test` from `playwright-bdd`
|
|
29
|
+
- Fixtures: create `tests/fixtures/base.fixture.ts` that extends `test` from `playwright-bdd` with proper TypeScript type definitions via `CustomFixtures` interface. This ensures fixtures are properly typed (for example `loginPage`). Include the fixtures file in the `steps` pattern in `bddConfig` so the generator can discover them.
|
|
30
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.
|
|
31
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}'`.
|
|
32
|
+
- Reporters: HTML (in `playwright-report/`), JSON (for CI integration), and JUnit (for CI/CD pipelines) are configured by default.
|
|
32
33
|
|
|
33
34
|
Files to inspect or add quickly
|
|
34
35
|
- Playwright config: [playwright.config.ts](playwright.config.ts)
|
|
@@ -44,7 +45,7 @@ Files to inspect or add quickly
|
|
|
44
45
|
How the flow works here
|
|
45
46
|
- Create page classes that import `Page` from `@playwright/test`; page methods should perform simple interactions and checks (for example, `LoginPage.goto()`, `LoginPage.login()`, `LoginPage.isInventoryVisible()`).
|
|
46
47
|
- Add a small data helper `readTestData(path)` that loads JSON from `tests/data/` so credentials are not hard-coded in steps or specs.
|
|
47
|
-
- Implement `tests/fixtures/base.fixture.ts` that extends Playwright's `test` to provide page-object fixtures (e.g., `loginPage`)
|
|
48
|
+
- Implement `tests/fixtures/base.fixture.ts` that extends Playwright's `test` to provide page-object fixtures (e.g., `loginPage`) with proper TypeScript types using a `CustomFixtures` type definition. This ensures type safety and IDE support for all fixtures.
|
|
48
49
|
- Write step definitions in `tests/steps/*.ts` using `playwright-bdd`'s `createBdd(test)` helper. Example pattern:
|
|
49
50
|
- import `createBdd` and your `test` fixture: `const { Given, When, Then } = createBdd(test)`
|
|
50
51
|
- register steps that accept fixtures: `Given('I open login page', async ({ loginPage }) => { await loginPage.goto(); })`.
|
|
@@ -53,13 +54,15 @@ How the flow works here
|
|
|
53
54
|
- `steps`: glob patterns for step definitions **and fixtures** (e.g., `['tests/steps/**/*.ts', 'tests/fixtures/**/*.ts']`)
|
|
54
55
|
- `outputDir`: where generated specs are written (default `.features-gen`)
|
|
55
56
|
- 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`.
|
|
57
|
+
- Test reports are automatically generated in `playwright-report/` (HTML), `test-results/results.json` (JSON), and `test-results/results.xml` (JUnit) after each run.
|
|
56
58
|
|
|
57
59
|
Run the direct Playwright spec (no generator required):
|
|
58
60
|
|
|
59
61
|
```bash
|
|
60
|
-
npm install # Always installs latest versions
|
|
61
62
|
npx playwright install
|
|
62
63
|
npx playwright test --project=ui tests/specs/login.spec.ts
|
|
64
|
+
npx playwright show-report # View HTML report
|
|
65
|
+
npx playwright test --project=ui tests/specs/login.spec.ts
|
|
63
66
|
```
|
|
64
67
|
|
|
65
68
|
Or use the npm test script (auto-runs bddgen + test together):
|
|
@@ -67,14 +70,21 @@ Or use the npm test script (auto-runs bddgen + test together):
|
|
|
67
70
|
```bash
|
|
68
71
|
npm test
|
|
69
72
|
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
2"`) to lock dependencies. This prevents unexpected breaking changes on future installs while still allowing patch/minor updates.
|
|
74
|
+
- **Initial Setup Flow**:
|
|
75
|
+
1. Install with `"latest"` to get current stable versions
|
|
76
|
+
2. Verify tests pass with `npm test` or `npx playwright test`
|
|
77
|
+
3. Replace `"latest"` with the installed versions (run `npm list` to see them)
|
|
78
|
+
4. Commit pinned versions to version control
|
|
79
|
+
- **Type Safety for Fixtures**: Always create a `CustomFixtures` type interface in `tests/fixtures/base.fixture.ts` that defines all custom fixtures. Extend `test.extend<CustomFixtures>()` for proper TypeScript support.
|
|
73
80
|
- Keep fixtures stable: generated specs import your fixture module, so keep `tests/fixtures/base.fixture.ts` API stable.
|
|
74
81
|
- Always include fixtures in the `steps` pattern (e.g., `steps: [..., 'tests/fixtures/**/*.ts']`) so the generator can detect and use your custom `test` instance.
|
|
75
82
|
- 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
83
|
- The `testMatch` in the `ui` project should match `**/*.feature.spec.{ts,js}` to discover generated specs regardless of language (TypeScript or JavaScript output).
|
|
77
|
-
-
|
|
84
|
+
- Do not spread `bddConfig` properties directly into `defineConfig()` — let `bddConfig` handle its own routing; just pass it as `...bddConfig` and define projects separately to avoid TypeScript conflicts.
|
|
85
|
+
- View reports after test runs: run `npx playwright show-report` to open the HTML report in your browser
|
|
86
|
+
- 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.
|
|
87
|
+
- The `testMatch` in the `ui` project should match `**/*.feature.spec.{ts,js}` to discover generated specs regardless of language (TypeScript or JavaScript output).
|
|
78
88
|
|
|
79
89
|
If you'd like, I can now:
|
|
80
90
|
- Run the direct spec and show results: `npm run test`
|