bdd-vitest 0.1.2 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +45 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -183,6 +183,51 @@ feature("Auth", () => {
183
183
  });
184
184
  ```
185
185
 
186
+ ## Browser tests (Playwright)
187
+
188
+ Works with `@vitest/browser` + Playwright. No special API — `e2e` gives you 120s timeout:
189
+
190
+ ```ts
191
+ import { e2e, feature, rule, expect } from "bdd-vitest";
192
+ import { page } from "@vitest/browser/context";
193
+
194
+ feature("Ship AI — Bridge Console", () => {
195
+ rule("authentication", () => {
196
+ e2e("Kai logs in with commander clearance", {
197
+ given: ["the login screen", async () => {
198
+ await page.goto("/bridge/login");
199
+ }],
200
+ when: ["submitting commander credentials", async () => {
201
+ await page.getByLabel("Crew ID").fill("kai");
202
+ await page.getByLabel("Access code").fill("clearance-9");
203
+ await page.getByRole("button", { name: "Authenticate" }).click();
204
+ }],
205
+ then: ["the bridge dashboard loads", async () => {
206
+ await expect.element(page.getByText("Welcome, Commander Kai")).toBeVisible();
207
+ expect(page.url()).toContain("/bridge/dashboard");
208
+ }],
209
+ });
210
+ });
211
+
212
+ rule("navigation controls", () => {
213
+ e2e("Yara plots a course from the bridge", {
214
+ given: ["Yara is on the navigation panel", async () => {
215
+ await page.goto("/bridge/navigation");
216
+ await expect.element(page.getByText("Navigation")).toBeVisible();
217
+ }],
218
+ when: ["plotting a course to Proxima", async () => {
219
+ await page.getByLabel("Destination").fill("Proxima Centauri");
220
+ await page.getByRole("button", { name: "Plot course" }).click();
221
+ }],
222
+ then: ["the course is confirmed", async () => {
223
+ await expect.element(page.getByText("Course set: Proxima Centauri")).toBeVisible();
224
+ await expect.element(page.getByText("ETA:")).toBeVisible();
225
+ }],
226
+ });
227
+ });
228
+ });
229
+ ```
230
+
186
231
  ## Real world example
187
232
 
188
233
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdd-vitest",
3
- "version": "0.1.2",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "description": "Enforced Given/When/Then for Vitest. ~200 lines. Zero config.",
6
6
  "license": "MIT",