@humanjs/playwright 0.7.0 → 0.9.0

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/dist/test.cjs ADDED
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ var chunk3X36PFTS_cjs = require('./chunk-3X36PFTS.cjs');
4
+ var test$1 = require('@playwright/test');
5
+
6
+ var test = test$1.test.extend({
7
+ humanOptions: [{}, { option: true }],
8
+ human: async ({ page, humanOptions }, use, testInfo) => {
9
+ const human = await chunk3X36PFTS_cjs.createHuman(page, {
10
+ // Deterministic per test, CI-fast by default — both overridable since
11
+ // the spread comes last.
12
+ seed: testInfo.title,
13
+ speed: process.env.CI ? "instant" : "human",
14
+ // No cursor overlay in CI (instant) so it never lands in test DOM or
15
+ // screenshots; shown locally where you actually watch the run.
16
+ cursor: !process.env.CI,
17
+ ...humanOptions
18
+ });
19
+ await use(human);
20
+ }
21
+ });
22
+
23
+ Object.defineProperty(exports, "expect", {
24
+ enumerable: true,
25
+ get: function () { return test$1.expect; }
26
+ });
27
+ exports.test = test;
28
+ //# sourceMappingURL=test.cjs.map
29
+ //# sourceMappingURL=test.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/test/index.ts"],"names":["base","createHuman"],"mappings":";;;;;AAyDO,IAAM,IAAA,GAAOA,YAAK,MAAA,CAAqC;AAAA,EAC5D,cAAc,CAAC,IAAI,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EACnC,OAAO,OAAO,EAAE,MAAM,YAAA,EAAa,EAAG,KAAK,QAAA,KAAa;AACtD,IAAA,MAAM,KAAA,GAAQ,MAAMC,6BAAA,CAAY,IAAA,EAAM;AAAA;AAAA;AAAA,MAGpC,MAAM,QAAA,CAAS,KAAA;AAAA,MACf,KAAA,EAAO,OAAA,CAAQ,GAAA,CAAI,EAAA,GAAK,SAAA,GAAY,OAAA;AAAA;AAAA;AAAA,MAGpC,MAAA,EAAQ,CAAC,OAAA,CAAQ,GAAA,CAAI,EAAA;AAAA,MACrB,GAAG;AAAA,KACJ,CAAA;AACD,IAAA,MAAM,IAAI,KAAK,CAAA;AAAA,EACjB;AACF,CAAC","file":"test.cjs","sourcesContent":["/**\n * Playwright Test integration — opt-in via the `@humanjs/playwright/test`\n * subpath. Re-exports `test` / `expect` from `@playwright/test` with a\n * pre-wired `human` fixture, so a spec never hand-rolls `createHuman`.\n *\n * Each test gets a {@link Human} bound to its `page`, **seeded from the test\n * title** (deterministic per test, so snapshots stay stable) and **instant in\n * CI / humanized locally** (fast pipelines, real-pace runs at your desk).\n * Override any of that per-file or per-project with the `humanOptions` option.\n *\n * `@playwright/test` is an optional peer — it's how you run Playwright tests,\n * so the host already provides it. Keeping the fixture on a subpath means the\n * package root never pulls in the test runner.\n *\n * @example\n * ```ts\n * import { test, expect } from '@humanjs/playwright/test';\n *\n * test('checkout', async ({ human, page }) => {\n * await human.goto('/cart');\n * await human.click('Checkout');\n * await expect(page).toHaveURL(/success/);\n * });\n *\n * // Customize for a file (or a whole project via playwright.config.ts):\n * test.use({ humanOptions: { personality: 'distracted', speed: 'human' } });\n * ```\n */\n\nimport { test as base } from '@playwright/test';\nimport { type CreateHumanOptions, createHuman, type Human } from '../index';\n\n/** Test-scoped fixtures added by `@humanjs/playwright/test`. */\nexport interface HumanFixtures {\n /**\n * A {@link Human} bound to the test's `page`. Created fresh per test; by\n * default seeded from the test title and run instant in CI, humanized\n * locally. Tune via the `humanOptions` option.\n */\n human: Human;\n}\n\n/** Option fixture to customize the per-test {@link Human}. */\nexport interface HumanOptions {\n /**\n * Options forwarded to `createHuman` for the `human` fixture. Set with\n * `test.use({ humanOptions: { … } })` (per file) or in `playwright.config.ts`\n * `use` (per project). Defaults: `seed` = the test title, `speed` =\n * `'instant'` in CI else `'human'`. Anything you set here overrides those.\n */\n humanOptions: CreateHumanOptions;\n}\n\n/**\n * Playwright `test` extended with the `human` fixture. Drop-in replacement\n * for `@playwright/test`'s `test`.\n */\nexport const test = base.extend<HumanFixtures & HumanOptions>({\n humanOptions: [{}, { option: true }],\n human: async ({ page, humanOptions }, use, testInfo) => {\n const human = await createHuman(page, {\n // Deterministic per test, CI-fast by default — both overridable since\n // the spread comes last.\n seed: testInfo.title,\n speed: process.env.CI ? 'instant' : 'human',\n // No cursor overlay in CI (instant) so it never lands in test DOM or\n // screenshots; shown locally where you actually watch the run.\n cursor: !process.env.CI,\n ...humanOptions,\n });\n await use(human);\n },\n});\n\nexport { expect } from '@playwright/test';\n"]}
@@ -0,0 +1,32 @@
1
+ import * as playwright_test from 'playwright/test';
2
+ import { Human, CreateHumanOptions } from './index.cjs';
3
+ export { expect } from '@playwright/test';
4
+ import '@humanjs/core';
5
+ import 'playwright';
6
+
7
+ /** Test-scoped fixtures added by `@humanjs/playwright/test`. */
8
+ interface HumanFixtures {
9
+ /**
10
+ * A {@link Human} bound to the test's `page`. Created fresh per test; by
11
+ * default seeded from the test title and run instant in CI, humanized
12
+ * locally. Tune via the `humanOptions` option.
13
+ */
14
+ human: Human;
15
+ }
16
+ /** Option fixture to customize the per-test {@link Human}. */
17
+ interface HumanOptions {
18
+ /**
19
+ * Options forwarded to `createHuman` for the `human` fixture. Set with
20
+ * `test.use({ humanOptions: { … } })` (per file) or in `playwright.config.ts`
21
+ * `use` (per project). Defaults: `seed` = the test title, `speed` =
22
+ * `'instant'` in CI else `'human'`. Anything you set here overrides those.
23
+ */
24
+ humanOptions: CreateHumanOptions;
25
+ }
26
+ /**
27
+ * Playwright `test` extended with the `human` fixture. Drop-in replacement
28
+ * for `@playwright/test`'s `test`.
29
+ */
30
+ declare const test: playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & HumanFixtures & HumanOptions, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
31
+
32
+ export { type HumanFixtures, type HumanOptions, test };
package/dist/test.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import * as playwright_test from 'playwright/test';
2
+ import { Human, CreateHumanOptions } from './index.js';
3
+ export { expect } from '@playwright/test';
4
+ import '@humanjs/core';
5
+ import 'playwright';
6
+
7
+ /** Test-scoped fixtures added by `@humanjs/playwright/test`. */
8
+ interface HumanFixtures {
9
+ /**
10
+ * A {@link Human} bound to the test's `page`. Created fresh per test; by
11
+ * default seeded from the test title and run instant in CI, humanized
12
+ * locally. Tune via the `humanOptions` option.
13
+ */
14
+ human: Human;
15
+ }
16
+ /** Option fixture to customize the per-test {@link Human}. */
17
+ interface HumanOptions {
18
+ /**
19
+ * Options forwarded to `createHuman` for the `human` fixture. Set with
20
+ * `test.use({ humanOptions: { … } })` (per file) or in `playwright.config.ts`
21
+ * `use` (per project). Defaults: `seed` = the test title, `speed` =
22
+ * `'instant'` in CI else `'human'`. Anything you set here overrides those.
23
+ */
24
+ humanOptions: CreateHumanOptions;
25
+ }
26
+ /**
27
+ * Playwright `test` extended with the `human` fixture. Drop-in replacement
28
+ * for `@playwright/test`'s `test`.
29
+ */
30
+ declare const test: playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & HumanFixtures & HumanOptions, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
31
+
32
+ export { type HumanFixtures, type HumanOptions, test };
package/dist/test.js ADDED
@@ -0,0 +1,24 @@
1
+ import { createHuman } from './chunk-3TXDODCO.js';
2
+ import { test as test$1 } from '@playwright/test';
3
+ export { expect } from '@playwright/test';
4
+
5
+ var test = test$1.extend({
6
+ humanOptions: [{}, { option: true }],
7
+ human: async ({ page, humanOptions }, use, testInfo) => {
8
+ const human = await createHuman(page, {
9
+ // Deterministic per test, CI-fast by default — both overridable since
10
+ // the spread comes last.
11
+ seed: testInfo.title,
12
+ speed: process.env.CI ? "instant" : "human",
13
+ // No cursor overlay in CI (instant) so it never lands in test DOM or
14
+ // screenshots; shown locally where you actually watch the run.
15
+ cursor: !process.env.CI,
16
+ ...humanOptions
17
+ });
18
+ await use(human);
19
+ }
20
+ });
21
+
22
+ export { test };
23
+ //# sourceMappingURL=test.js.map
24
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/test/index.ts"],"names":["base"],"mappings":";;;;AAyDO,IAAM,IAAA,GAAOA,OAAK,MAAA,CAAqC;AAAA,EAC5D,cAAc,CAAC,IAAI,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EACnC,OAAO,OAAO,EAAE,MAAM,YAAA,EAAa,EAAG,KAAK,QAAA,KAAa;AACtD,IAAA,MAAM,KAAA,GAAQ,MAAM,WAAA,CAAY,IAAA,EAAM;AAAA;AAAA;AAAA,MAGpC,MAAM,QAAA,CAAS,KAAA;AAAA,MACf,KAAA,EAAO,OAAA,CAAQ,GAAA,CAAI,EAAA,GAAK,SAAA,GAAY,OAAA;AAAA;AAAA;AAAA,MAGpC,MAAA,EAAQ,CAAC,OAAA,CAAQ,GAAA,CAAI,EAAA;AAAA,MACrB,GAAG;AAAA,KACJ,CAAA;AACD,IAAA,MAAM,IAAI,KAAK,CAAA;AAAA,EACjB;AACF,CAAC","file":"test.js","sourcesContent":["/**\n * Playwright Test integration — opt-in via the `@humanjs/playwright/test`\n * subpath. Re-exports `test` / `expect` from `@playwright/test` with a\n * pre-wired `human` fixture, so a spec never hand-rolls `createHuman`.\n *\n * Each test gets a {@link Human} bound to its `page`, **seeded from the test\n * title** (deterministic per test, so snapshots stay stable) and **instant in\n * CI / humanized locally** (fast pipelines, real-pace runs at your desk).\n * Override any of that per-file or per-project with the `humanOptions` option.\n *\n * `@playwright/test` is an optional peer — it's how you run Playwright tests,\n * so the host already provides it. Keeping the fixture on a subpath means the\n * package root never pulls in the test runner.\n *\n * @example\n * ```ts\n * import { test, expect } from '@humanjs/playwright/test';\n *\n * test('checkout', async ({ human, page }) => {\n * await human.goto('/cart');\n * await human.click('Checkout');\n * await expect(page).toHaveURL(/success/);\n * });\n *\n * // Customize for a file (or a whole project via playwright.config.ts):\n * test.use({ humanOptions: { personality: 'distracted', speed: 'human' } });\n * ```\n */\n\nimport { test as base } from '@playwright/test';\nimport { type CreateHumanOptions, createHuman, type Human } from '../index';\n\n/** Test-scoped fixtures added by `@humanjs/playwright/test`. */\nexport interface HumanFixtures {\n /**\n * A {@link Human} bound to the test's `page`. Created fresh per test; by\n * default seeded from the test title and run instant in CI, humanized\n * locally. Tune via the `humanOptions` option.\n */\n human: Human;\n}\n\n/** Option fixture to customize the per-test {@link Human}. */\nexport interface HumanOptions {\n /**\n * Options forwarded to `createHuman` for the `human` fixture. Set with\n * `test.use({ humanOptions: { … } })` (per file) or in `playwright.config.ts`\n * `use` (per project). Defaults: `seed` = the test title, `speed` =\n * `'instant'` in CI else `'human'`. Anything you set here overrides those.\n */\n humanOptions: CreateHumanOptions;\n}\n\n/**\n * Playwright `test` extended with the `human` fixture. Drop-in replacement\n * for `@playwright/test`'s `test`.\n */\nexport const test = base.extend<HumanFixtures & HumanOptions>({\n humanOptions: [{}, { option: true }],\n human: async ({ page, humanOptions }, use, testInfo) => {\n const human = await createHuman(page, {\n // Deterministic per test, CI-fast by default — both overridable since\n // the spread comes last.\n seed: testInfo.title,\n speed: process.env.CI ? 'instant' : 'human',\n // No cursor overlay in CI (instant) so it never lands in test DOM or\n // screenshots; shown locally where you actually watch the run.\n cursor: !process.env.CI,\n ...humanOptions,\n });\n await use(human);\n },\n});\n\nexport { expect } from '@playwright/test';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanjs/playwright",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Humanize Playwright sessions for AI agents, QA tests, and demos.",
5
5
  "keywords": [
6
6
  "humanjs",
@@ -8,7 +8,13 @@
8
8
  "humanize",
9
9
  "browser-automation",
10
10
  "qa",
11
- "ai-agents"
11
+ "ai-agent",
12
+ "ai-agents",
13
+ "human-like",
14
+ "bezier",
15
+ "typing-rhythm",
16
+ "e2e-testing",
17
+ "test-automation"
12
18
  ],
13
19
  "author": "Gonzalo Muñoz <toti@eventurex.com.ar>",
14
20
  "license": "MIT",
@@ -34,6 +40,16 @@
34
40
  "default": "./dist/index.cjs"
35
41
  }
36
42
  },
43
+ "./test": {
44
+ "import": {
45
+ "types": "./dist/test.d.ts",
46
+ "default": "./dist/test.js"
47
+ },
48
+ "require": {
49
+ "types": "./dist/test.d.cts",
50
+ "default": "./dist/test.cjs"
51
+ }
52
+ },
37
53
  "./package.json": "./package.json"
38
54
  },
39
55
  "files": [
@@ -47,15 +63,22 @@
47
63
  },
48
64
  "dependencies": {
49
65
  "ffmpeg-static": "^5.2.0",
50
- "@humanjs/core": "0.6.0"
66
+ "@humanjs/core": "0.8.0"
51
67
  },
52
68
  "peerDependencies": {
53
- "playwright": ">=1.40.0"
69
+ "playwright": ">=1.49.0",
70
+ "@playwright/test": ">=1.49.0"
71
+ },
72
+ "peerDependenciesMeta": {
73
+ "@playwright/test": {
74
+ "optional": true
75
+ }
54
76
  },
55
77
  "publishConfig": {
56
78
  "access": "public"
57
79
  },
58
80
  "devDependencies": {
81
+ "@playwright/test": "^1.60.0",
59
82
  "playwright": "^1.60.0"
60
83
  },
61
84
  "scripts": {
@@ -66,6 +89,7 @@
66
89
  "test:watch": "vitest",
67
90
  "typecheck": "tsc --noEmit",
68
91
  "lint": "biome check .",
92
+ "check:exports": "publint --strict",
69
93
  "clean": "rm -rf dist .turbo"
70
94
  }
71
95
  }