@humanjs/playwright 0.7.0 → 0.8.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/README.md +22 -0
- package/dist/chunk-CCZEDNOF.js +1915 -0
- package/dist/chunk-CCZEDNOF.js.map +1 -0
- package/dist/chunk-RCMSDC3N.cjs +1998 -0
- package/dist/chunk-RCMSDC3N.cjs.map +1 -0
- package/dist/index.cjs +37 -1785
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -4
- package/dist/index.d.ts +100 -4
- package/dist/index.js +1 -1759
- package/dist/index.js.map +1 -1
- package/dist/test.cjs +26 -0
- package/dist/test.cjs.map +1 -0
- package/dist/test.d.cts +32 -0
- package/dist/test.d.ts +32 -0
- package/dist/test.js +21 -0
- package/dist/test.js.map +1 -0
- package/package.json +28 -4
package/dist/test.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkRCMSDC3N_cjs = require('./chunk-RCMSDC3N.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 chunkRCMSDC3N_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
|
+
...humanOptions
|
|
15
|
+
});
|
|
16
|
+
await use(human);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
Object.defineProperty(exports, "expect", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return test$1.expect; }
|
|
23
|
+
});
|
|
24
|
+
exports.test = test;
|
|
25
|
+
//# sourceMappingURL=test.cjs.map
|
|
26
|
+
//# 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,MACpC,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 ...humanOptions,\n });\n await use(human);\n },\n});\n\nexport { expect } from '@playwright/test';\n"]}
|
package/dist/test.d.cts
ADDED
|
@@ -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,21 @@
|
|
|
1
|
+
import { createHuman } from './chunk-CCZEDNOF.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
|
+
...humanOptions
|
|
14
|
+
});
|
|
15
|
+
await use(human);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export { test };
|
|
20
|
+
//# sourceMappingURL=test.js.map
|
|
21
|
+
//# sourceMappingURL=test.js.map
|
package/dist/test.js.map
ADDED
|
@@ -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,MACpC,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 ...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.
|
|
3
|
+
"version": "0.8.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-
|
|
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.
|
|
66
|
+
"@humanjs/core": "0.7.0"
|
|
51
67
|
},
|
|
52
68
|
"peerDependencies": {
|
|
53
|
-
"playwright": ">=1.
|
|
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
|
}
|