agents-cli-automation 1.0.15 → 1.0.16
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
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
name: Playwright UI Testing - TypeScript (current repo)
|
|
3
|
-
description: Snapshot and quick guide for the Playwright + TypeScript setup present in this repository.
|
|
3
|
+
description: Snapshot and quick guide for the Playwright + TypeScript+BDD setup present in this repository.
|
|
4
4
|
argument-hint: "(no args)"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
----
|
|
8
7
|
# Playwright + TypeScript — repo snapshot
|
|
9
|
-
**Current Setup
|
|
8
|
+
**Current Setup**
|
|
10
9
|
- **@playwright/test**: pinned to a verified stable version
|
|
11
|
-
- **playwright-bdd**:
|
|
10
|
+
- **playwright-bdd**: used in this repo; the `test` script runs `bddgen` to convert Gherkin features into Playwright specs
|
|
12
11
|
- **TypeScript**: pinned to a verified stable version
|
|
13
12
|
|
|
14
13
|
This scaffold uses a generator-based BDD flow: Gherkin feature files in `tests/features/` are converted to Playwright specs by `bddgen` (from `playwright-bdd`), and those specs are executed with `@playwright/test`.
|
|
@@ -28,6 +27,38 @@ Quick files to review
|
|
|
28
27
|
- Steps: [tests/steps/loginSteps.ts](tests/steps/loginSteps.ts)
|
|
29
28
|
- Features: [tests/features/login.feature](tests/features/login.feature)
|
|
30
29
|
|
|
30
|
+
Quick runnable example (Sauce Demo)
|
|
31
|
+
----------------------------------
|
|
32
|
+
|
|
33
|
+
Use https://www.saucedemo.com/ with these demo credentials to get a working test quickly:
|
|
34
|
+
|
|
35
|
+
- username: `standard_user`
|
|
36
|
+
- password: `secret_sauce`
|
|
37
|
+
|
|
38
|
+
Here's a minimal Playwright test that performs a login and asserts the inventory page loads:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { test, expect } from '@playwright/test';
|
|
42
|
+
|
|
43
|
+
test('saucedemo login works', async ({ page }) => {
|
|
44
|
+
await page.goto('https://www.saucedemo.com/');
|
|
45
|
+
await page.fill('[data-test="username"]', 'standard_user');
|
|
46
|
+
await page.fill('[data-test="password"]', 'secret_sauce');
|
|
47
|
+
await page.click('[data-test="login-button"]');
|
|
48
|
+
await expect(page).toHaveURL(/inventory.html/);
|
|
49
|
+
await expect(page.locator('.inventory_list')).toBeVisible();
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To run this example locally:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx playwright test tests/example.spec.ts # or run `npm test`
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If you want, I can update the existing `tests/example.spec.ts` and `tests/pages/login.page.ts` to use this Sauce Demo flow and run the tests here.
|
|
60
|
+
|
|
61
|
+
|
|
31
62
|
Run the tests (generator BDD flow):
|
|
32
63
|
|
|
33
64
|
```bash
|
|
@@ -69,6 +100,37 @@ npx playwright install
|
|
|
69
100
|
npm test
|
|
70
101
|
```
|
|
71
102
|
|
|
103
|
+
Handling missing bddgen
|
|
104
|
+
-----------------------
|
|
105
|
+
|
|
106
|
+
If you see the message "To get \"bddgen\" CLI please install \"playwright-bdd\" package", you have two options:
|
|
107
|
+
|
|
108
|
+
- Install the generator (recommended if you use Gherkin features):
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm install -D playwright-bdd
|
|
112
|
+
npx playwright install
|
|
113
|
+
npm test
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- Skip the generator and run Playwright directly (if you don't use Gherkin features):
|
|
117
|
+
|
|
118
|
+
1. Remove `npx bddgen &&` from your `test` script in `package.json`, or run Playwright directly:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx playwright test
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
2. Example `package.json` scripts without `bddgen`:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
"scripts": {
|
|
128
|
+
"test": "npx playwright test",
|
|
129
|
+
"playwright:install": "npx playwright install"
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
|
|
72
134
|
## Notes
|
|
73
135
|
|
|
74
136
|
- The `test` script runs `npx bddgen` and then `npx playwright test`. If `playwright-bdd` is not installed, you'll be prompted to run `npm install -D playwright-bdd`.
|