@specter-automation/test 1.0.107
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/core/component-registry.d.ts +12 -0
- package/dist/core/component-registry.js +25 -0
- package/dist/core/conditions/input-conditions.d.ts +81 -0
- package/dist/core/conditions/input-conditions.js +197 -0
- package/dist/core/events.d.ts +133 -0
- package/dist/core/events.js +6 -0
- package/dist/core/locators/actor-locator.d.ts +425 -0
- package/dist/core/locators/actor-locator.js +1006 -0
- package/dist/core/locators/ai-controller-locator.d.ts +6 -0
- package/dist/core/locators/ai-controller-locator.js +19 -0
- package/dist/core/locators/index.d.ts +6 -0
- package/dist/core/locators/index.js +22 -0
- package/dist/core/locators/movement-locator.d.ts +27 -0
- package/dist/core/locators/movement-locator.js +78 -0
- package/dist/core/locators/skeleton-locator.d.ts +13 -0
- package/dist/core/locators/skeleton-locator.js +35 -0
- package/dist/core/locators/specter-locator.d.ts +110 -0
- package/dist/core/locators/specter-locator.js +323 -0
- package/dist/core/locators/widget-locator.d.ts +104 -0
- package/dist/core/locators/widget-locator.js +297 -0
- package/dist/core/specter-client.d.ts +352 -0
- package/dist/core/specter-client.js +883 -0
- package/dist/core/specter-input-sequence.d.ts +96 -0
- package/dist/core/specter-input-sequence.js +180 -0
- package/dist/core/specter-keyboard.d.ts +21 -0
- package/dist/core/specter-keyboard.js +63 -0
- package/dist/core/specter-keys.d.ts +1 -0
- package/dist/core/specter-keys.js +2 -0
- package/dist/core/specter-network.d.ts +34 -0
- package/dist/core/specter-network.js +59 -0
- package/dist/core/specter-reporter.d.ts +23 -0
- package/dist/core/specter-reporter.js +403 -0
- package/dist/core/test-wrapper.d.ts +25 -0
- package/dist/core/test-wrapper.js +200 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +29 -0
- package/dist/matchers/actor-matchers.d.ts +492 -0
- package/dist/matchers/actor-matchers.js +841 -0
- package/dist/matchers/gas-matchers.d.ts +198 -0
- package/dist/matchers/gas-matchers.js +539 -0
- package/dist/matchers/locator-matchers.d.ts +80 -0
- package/dist/matchers/locator-matchers.js +214 -0
- package/dist/matchers/material-matchers.d.ts +74 -0
- package/dist/matchers/material-matchers.js +295 -0
- package/dist/matchers/widget-matchers.d.ts +81 -0
- package/dist/matchers/widget-matchers.js +110 -0
- package/package.json +33 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.widgetExpect = void 0;
|
|
37
|
+
const test_1 = __importStar(require("@playwright/test"));
|
|
38
|
+
// ============================================================
|
|
39
|
+
// SHARED POLLING HELPER
|
|
40
|
+
// ============================================================
|
|
41
|
+
async function poll(fn, check, timeout) {
|
|
42
|
+
const startTime = Date.now();
|
|
43
|
+
let last = undefined;
|
|
44
|
+
while (Date.now() - startTime < timeout) {
|
|
45
|
+
try {
|
|
46
|
+
last = await fn();
|
|
47
|
+
if (check(last))
|
|
48
|
+
return { passed: true, last };
|
|
49
|
+
}
|
|
50
|
+
catch (_) { }
|
|
51
|
+
await new Promise(r => setTimeout(r, 100));
|
|
52
|
+
}
|
|
53
|
+
return { passed: false, last };
|
|
54
|
+
}
|
|
55
|
+
exports.widgetExpect = test_1.expect.extend({
|
|
56
|
+
async toHaveText(locator, expectedText, options) {
|
|
57
|
+
const isNot = this.isNot;
|
|
58
|
+
const timeout = options?.timeout ?? 5000;
|
|
59
|
+
const prefix = isNot ? 'not.toHaveText' : 'toHaveText';
|
|
60
|
+
return await test_1.default.step(`expect(${locator.toString()}).${prefix}('${expectedText}')`, async () => {
|
|
61
|
+
const { passed, last } = await poll(() => locator.getText(), val => isNot ? val !== expectedText : val === expectedText, timeout);
|
|
62
|
+
return {
|
|
63
|
+
pass: isNot ? !passed : passed,
|
|
64
|
+
message: () => `Expected widget text to${isNot ? ' not' : ''} be "${expectedText}", but got "${last}"`,
|
|
65
|
+
actual: last,
|
|
66
|
+
expected: expectedText
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
async toHaveValue(locator, expectedValue, options) {
|
|
71
|
+
const isNot = this.isNot;
|
|
72
|
+
const timeout = options?.timeout ?? 5000;
|
|
73
|
+
const prefix = isNot ? 'not.toHaveValue' : 'toHaveValue';
|
|
74
|
+
return await test_1.default.step(`expect(${locator.toString()}).${prefix}('${expectedValue}')`, async () => {
|
|
75
|
+
const { passed, last } = await poll(() => locator.getText(), val => isNot ? val !== expectedValue : val === expectedValue, timeout);
|
|
76
|
+
return {
|
|
77
|
+
pass: isNot ? !passed : passed,
|
|
78
|
+
message: () => `Expected widget input value to${isNot ? ' not' : ''} be "${expectedValue}", but got "${last}"`,
|
|
79
|
+
actual: last,
|
|
80
|
+
expected: expectedValue
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
async toContainText(locator, substring, options) {
|
|
85
|
+
const isNot = this.isNot;
|
|
86
|
+
const timeout = options?.timeout ?? 5000;
|
|
87
|
+
const prefix = isNot ? 'not.toContainText' : 'toContainText';
|
|
88
|
+
return await test_1.default.step(`expect(${locator.toString()}).${prefix}('${substring}')`, async () => {
|
|
89
|
+
const { passed, last } = await poll(() => locator.getText(), val => isNot ? !val.includes(substring) : val.includes(substring), timeout);
|
|
90
|
+
return {
|
|
91
|
+
pass: isNot ? !passed : passed,
|
|
92
|
+
message: () => `Expected widget text to${isNot ? ' not' : ''} contain "${substring}", but got "${last}"`,
|
|
93
|
+
actual: last,
|
|
94
|
+
expected: substring
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
async toBeEnabled(locator, options) {
|
|
99
|
+
const isNot = this.isNot;
|
|
100
|
+
const timeout = options?.timeout ?? 5000;
|
|
101
|
+
const prefix = isNot ? 'not.toBeEnabled' : 'toBeEnabled';
|
|
102
|
+
return await test_1.default.step(`expect(${locator.toString()}).${prefix}()`, async () => {
|
|
103
|
+
const { passed, last } = await poll(() => locator.isEnabled(), val => isNot ? !val : val, timeout);
|
|
104
|
+
return {
|
|
105
|
+
pass: isNot ? !passed : passed,
|
|
106
|
+
message: () => `Expected widget to${isNot ? ' not' : ''} be enabled, but it was${last ? '' : ' not'}.`
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@specter-automation/test",
|
|
3
|
+
"version": "1.0.107",
|
|
4
|
+
"description": "Playwright integration for Unreal Engine automation via Specter",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc && tsc-alias",
|
|
9
|
+
"dev": "tsc --watch"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"ws": "^8.20.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^25.7.0",
|
|
25
|
+
"@types/ws": "^8.18.1",
|
|
26
|
+
"tsc-alias": "^1.8.17",
|
|
27
|
+
"typescript": "^6.0.3",
|
|
28
|
+
"@playwright/test": "^1.60.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@playwright/test": "^1.60.0"
|
|
32
|
+
}
|
|
33
|
+
}
|