@chaos-maker/playwright 0.1.0 → 0.2.0-rc.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.
- package/dist/{chunk-BZSMGQHL.js → chunk-TM4IENXC.js} +11 -1
- package/dist/fixture.cjs +11 -1
- package/dist/fixture.d.cts +1 -0
- package/dist/fixture.d.ts +1 -0
- package/dist/fixture.js +4 -2
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +3 -1
- package/package.json +4 -3
|
@@ -37,9 +37,19 @@ async function getChaosLog(page) {
|
|
|
37
37
|
return [];
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
+
async function getChaosSeed(page) {
|
|
41
|
+
return page.evaluate(() => {
|
|
42
|
+
const win = globalThis;
|
|
43
|
+
if (win.chaosUtils) {
|
|
44
|
+
return win.chaosUtils.getSeed();
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
40
49
|
|
|
41
50
|
export {
|
|
42
51
|
injectChaos,
|
|
43
52
|
removeChaos,
|
|
44
|
-
getChaosLog
|
|
53
|
+
getChaosLog,
|
|
54
|
+
getChaosSeed
|
|
45
55
|
};
|
package/dist/fixture.cjs
CHANGED
|
@@ -66,6 +66,15 @@ async function getChaosLog(page) {
|
|
|
66
66
|
return [];
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
+
async function getChaosSeed(page) {
|
|
70
|
+
return page.evaluate(() => {
|
|
71
|
+
const win = globalThis;
|
|
72
|
+
if (win.chaosUtils) {
|
|
73
|
+
return win.chaosUtils.getSeed();
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
69
78
|
|
|
70
79
|
// src/fixture.ts
|
|
71
80
|
var import_test2 = require("@playwright/test");
|
|
@@ -74,7 +83,8 @@ var test = import_test.test.extend({
|
|
|
74
83
|
const fixture = {
|
|
75
84
|
inject: (config) => injectChaos(page, config),
|
|
76
85
|
remove: () => removeChaos(page),
|
|
77
|
-
getLog: () => getChaosLog(page)
|
|
86
|
+
getLog: () => getChaosLog(page),
|
|
87
|
+
getSeed: () => getChaosSeed(page)
|
|
78
88
|
};
|
|
79
89
|
await use(fixture);
|
|
80
90
|
await removeChaos(page);
|
package/dist/fixture.d.cts
CHANGED
package/dist/fixture.d.ts
CHANGED
package/dist/fixture.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getChaosLog,
|
|
3
|
+
getChaosSeed,
|
|
3
4
|
injectChaos,
|
|
4
5
|
removeChaos
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TM4IENXC.js";
|
|
6
7
|
|
|
7
8
|
// src/fixture.ts
|
|
8
9
|
import { test as base } from "@playwright/test";
|
|
@@ -12,7 +13,8 @@ var test = base.extend({
|
|
|
12
13
|
const fixture = {
|
|
13
14
|
inject: (config) => injectChaos(page, config),
|
|
14
15
|
remove: () => removeChaos(page),
|
|
15
|
-
getLog: () => getChaosLog(page)
|
|
16
|
+
getLog: () => getChaosLog(page),
|
|
17
|
+
getSeed: () => getChaosSeed(page)
|
|
16
18
|
};
|
|
17
19
|
await use(fixture);
|
|
18
20
|
await removeChaos(page);
|
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
getChaosLog: () => getChaosLog,
|
|
24
|
+
getChaosSeed: () => getChaosSeed,
|
|
24
25
|
injectChaos: () => injectChaos,
|
|
25
26
|
removeChaos: () => removeChaos
|
|
26
27
|
});
|
|
@@ -64,9 +65,19 @@ async function getChaosLog(page) {
|
|
|
64
65
|
return [];
|
|
65
66
|
});
|
|
66
67
|
}
|
|
68
|
+
async function getChaosSeed(page) {
|
|
69
|
+
return page.evaluate(() => {
|
|
70
|
+
const win = globalThis;
|
|
71
|
+
if (win.chaosUtils) {
|
|
72
|
+
return win.chaosUtils.getSeed();
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
67
77
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
78
|
0 && (module.exports = {
|
|
69
79
|
getChaosLog,
|
|
80
|
+
getChaosSeed,
|
|
70
81
|
injectChaos,
|
|
71
82
|
removeChaos
|
|
72
83
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Page } from '@playwright/test';
|
|
2
2
|
import { ChaosEvent, ChaosConfig } from '@chaos-maker/core';
|
|
3
|
-
export { ChaosConfig, ChaosEvent } from '@chaos-maker/core';
|
|
3
|
+
export { ChaosConfig, ChaosEvent, WebSocketCloseConfig, WebSocketConfig, WebSocketCorruptConfig, WebSocketCorruptionStrategy, WebSocketDelayConfig, WebSocketDirection, WebSocketDropConfig } from '@chaos-maker/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Inject chaos into a Playwright page. Call before `page.goto()` to ensure
|
|
@@ -30,5 +30,10 @@ declare function removeChaos(page: Page): Promise<void>;
|
|
|
30
30
|
* Returns all events emitted since chaos was injected.
|
|
31
31
|
*/
|
|
32
32
|
declare function getChaosLog(page: Page): Promise<ChaosEvent[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the PRNG seed from a Playwright page.
|
|
35
|
+
* Log this value on test failure to replay exact chaos decisions.
|
|
36
|
+
*/
|
|
37
|
+
declare function getChaosSeed(page: Page): Promise<number | null>;
|
|
33
38
|
|
|
34
|
-
export { getChaosLog, injectChaos, removeChaos };
|
|
39
|
+
export { getChaosLog, getChaosSeed, injectChaos, removeChaos };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Page } from '@playwright/test';
|
|
2
2
|
import { ChaosEvent, ChaosConfig } from '@chaos-maker/core';
|
|
3
|
-
export { ChaosConfig, ChaosEvent } from '@chaos-maker/core';
|
|
3
|
+
export { ChaosConfig, ChaosEvent, WebSocketCloseConfig, WebSocketConfig, WebSocketCorruptConfig, WebSocketCorruptionStrategy, WebSocketDelayConfig, WebSocketDirection, WebSocketDropConfig } from '@chaos-maker/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Inject chaos into a Playwright page. Call before `page.goto()` to ensure
|
|
@@ -30,5 +30,10 @@ declare function removeChaos(page: Page): Promise<void>;
|
|
|
30
30
|
* Returns all events emitted since chaos was injected.
|
|
31
31
|
*/
|
|
32
32
|
declare function getChaosLog(page: Page): Promise<ChaosEvent[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the PRNG seed from a Playwright page.
|
|
35
|
+
* Log this value on test failure to replay exact chaos decisions.
|
|
36
|
+
*/
|
|
37
|
+
declare function getChaosSeed(page: Page): Promise<number | null>;
|
|
33
38
|
|
|
34
|
-
export { getChaosLog, injectChaos, removeChaos };
|
|
39
|
+
export { getChaosLog, getChaosSeed, injectChaos, removeChaos };
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaos-maker/playwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Playwright adapter for @chaos-maker/core — one-line chaos injection in E2E tests",
|
|
6
6
|
"keywords": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dist"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@chaos-maker/core": "0.
|
|
52
|
+
"@chaos-maker/core": "0.2.0-rc.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@playwright/test": ">=1.40.0"
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "tsup",
|
|
70
|
-
"test": "vitest"
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"test:watch": "vitest"
|
|
71
72
|
}
|
|
72
73
|
}
|