@specter-automation/test 1.0.117 → 1.0.119

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.
@@ -1,50 +1,15 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.locatorExpect = void 0;
37
- const test_1 = __importStar(require("@playwright/test"));
4
+ const test_1 = require("@playwright/test");
5
+ const instrument_1 = require("./instrument");
38
6
  const locators_1 = require("../core/locators");
39
- exports.locatorExpect = test_1.expect.extend({
7
+ exports.locatorExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
40
8
  async toHavePropertyValue(locator, propertyName, expectedValue, options) {
41
9
  const operator = options?.operator ?? '===';
42
10
  const pollTimeout = options?.timeout ?? 5000;
43
11
  const isNot = this.isNot;
44
- const prefix = isNot ? 'not.toHavePropertyValue' : 'toHavePropertyValue';
45
- const portStr = locator.portTag || '';
46
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}('${propertyName}', '${operator}', ${JSON.stringify(expectedValue)})`;
47
- return await test_1.default.step(stepName, async () => {
12
+ return await (async () => {
48
13
  let lastValue;
49
14
  try {
50
15
  await test_1.expect.poll(async () => {
@@ -66,15 +31,13 @@ exports.locatorExpect = test_1.expect.extend({
66
31
  expected: expectedValue
67
32
  };
68
33
  }
69
- });
34
+ })();
70
35
  },
71
36
  async toHaveCount(locator, expectedCount, options) {
72
37
  const pollTimeout = options?.timeout ?? 5000;
73
38
  const isNot = this.isNot;
74
39
  const prefix = isNot ? 'not.toHaveCount' : 'toHaveCount';
75
- const portStr = locator.portTag || '';
76
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}(${expectedCount})`;
77
- return await test_1.default.step(stepName, async () => {
40
+ return await (async () => {
78
41
  let lastCount = -1;
79
42
  try {
80
43
  const poll = test_1.expect.poll(async () => {
@@ -98,7 +61,7 @@ exports.locatorExpect = test_1.expect.extend({
98
61
  `Received: ${this.utils.printReceived(lastCount)}\n`
99
62
  };
100
63
  }
101
- });
64
+ })();
102
65
  },
103
66
  async toBeVisible(locator, // Accept any to bypass generic strictness
104
67
  options) {
@@ -117,10 +80,7 @@ exports.locatorExpect = test_1.expect.extend({
117
80
  const pollTimeout = options?.timeout ?? 5000;
118
81
  const checkOnScreen = isActor ? (options?.onScreen ?? false) : false; // UMG ignores spatial onScreen bounds
119
82
  const isNot = this.isNot;
120
- const prefix = isNot ? 'not.toBeVisible' : 'toBeVisible';
121
- const portStr = locator.portTag || '';
122
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}`;
123
- return await test_1.default.step(stepName, async () => {
83
+ return await (async () => {
124
84
  let isVis = false;
125
85
  try {
126
86
  await test_1.expect.poll(async () => {
@@ -163,7 +123,7 @@ exports.locatorExpect = test_1.expect.extend({
163
123
  (errorMessage.includes('0 objects') ? '' : `\nUnderlying Engine Error: ${errorMessage}`)
164
124
  };
165
125
  }
166
- });
126
+ })();
167
127
  },
168
128
  async toBeInViewport(locator, options) {
169
129
  return this.toBeVisible(locator, { onScreen: true, timeout: options?.timeout });
@@ -183,9 +143,7 @@ exports.locatorExpect = test_1.expect.extend({
183
143
  const pollTimeout = options?.timeout ?? 5000;
184
144
  const isNot = this.isNot;
185
145
  const prefix = isNot ? 'not.toBeDestroyed' : 'toBeDestroyed';
186
- const portStr = locator.portTag || '';
187
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}`;
188
- return await test_1.default.step(stepName, async () => {
146
+ return await (async () => {
189
147
  let lastCount = -1;
190
148
  try {
191
149
  await test_1.expect.poll(async () => {
@@ -209,6 +167,6 @@ exports.locatorExpect = test_1.expect.extend({
209
167
  `Received count: ${this.utils.printReceived(lastCount)}`
210
168
  };
211
169
  }
212
- });
170
+ })();
213
171
  }
214
- });
172
+ }));
@@ -1,40 +1,8 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.materialExpect = void 0;
37
- const test_1 = __importStar(require("@playwright/test"));
4
+ const test_1 = require("@playwright/test");
5
+ const instrument_1 = require("./instrument");
38
6
  function normalizeColor(input) {
39
7
  if (typeof input === 'string') {
40
8
  let hex = input.trim().replace(/^#/, '');
@@ -115,7 +83,7 @@ async function poll(fn, check, timeout) {
115
83
  }
116
84
  return { passed: false, last };
117
85
  }
118
- exports.materialExpect = test_1.expect.extend({
86
+ exports.materialExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
119
87
  async toHaveMaterialScalarParameter(locator, parameterName, expectedValue, options) {
120
88
  const operator = options?.operator ?? '===';
121
89
  const tolerance = options?.tolerance ?? 0.001;
@@ -123,10 +91,7 @@ exports.materialExpect = test_1.expect.extend({
123
91
  const slotIndex = options?.slotIndex ?? 0;
124
92
  const componentName = options?.componentName;
125
93
  const isNot = this.isNot;
126
- const prefix = isNot ? 'not.toHaveMaterialScalarParameter' : 'toHaveMaterialScalarParameter';
127
- const portStr = locator.portTag || '';
128
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}('${parameterName}', ${operator}, ${expectedValue})`;
129
- return await test_1.default.step(stepName, async () => {
94
+ return await (async () => {
130
95
  const { passed, last } = await poll(async () => {
131
96
  const res = await locator.evaluate('GetMaterialParameter', {
132
97
  parameterName,
@@ -150,7 +115,7 @@ exports.materialExpect = test_1.expect.extend({
150
115
  actual: receivedValue,
151
116
  expected: expectedValue
152
117
  };
153
- });
118
+ })();
154
119
  },
155
120
  async toHaveMaterialVectorParameter(locator, parameterName, expectedColor, options) {
156
121
  const tolerance = options?.tolerance ?? 0.01;
@@ -159,10 +124,7 @@ exports.materialExpect = test_1.expect.extend({
159
124
  const componentName = options?.componentName;
160
125
  const normalizedExpected = normalizeColor(expectedColor);
161
126
  const isNot = this.isNot;
162
- const prefix = isNot ? 'not.toHaveMaterialVectorParameter' : 'toHaveMaterialVectorParameter';
163
- const portStr = locator.portTag || '';
164
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}('${parameterName}', ${JSON.stringify(expectedColor)})`;
165
- return await test_1.default.step(stepName, async () => {
127
+ return await (async () => {
166
128
  const { passed, last } = await poll(async () => {
167
129
  const res = await locator.evaluate('GetMaterialParameter', {
168
130
  parameterName,
@@ -186,17 +148,14 @@ exports.materialExpect = test_1.expect.extend({
186
148
  actual: receivedValue,
187
149
  expected: normalizedExpected
188
150
  };
189
- });
151
+ })();
190
152
  },
191
153
  async toHaveMaterial(locator, expectedMaterial, options) {
192
154
  const timeout = options?.timeout ?? 5000;
193
155
  const slotIndex = options?.slotIndex ?? 0;
194
156
  const componentName = options?.componentName;
195
157
  const isNot = this.isNot;
196
- const prefix = isNot ? 'not.toHaveMaterial' : 'toHaveMaterial';
197
- const portStr = locator.portTag || '';
198
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}(${expectedMaterial})`;
199
- return await test_1.default.step(stepName, async () => {
158
+ return await (async () => {
200
159
  const { passed, last } = await poll(async () => {
201
160
  const res = await locator.evaluate('GetMaterialParameter', {
202
161
  parameterType: 'Info',
@@ -221,17 +180,14 @@ exports.materialExpect = test_1.expect.extend({
221
180
  actual: receivedName,
222
181
  expected: expectedMaterial
223
182
  };
224
- });
183
+ })();
225
184
  },
226
185
  async toBeDynamicMaterial(locator, options) {
227
186
  const timeout = options?.timeout ?? 5000;
228
187
  const slotIndex = options?.slotIndex ?? 0;
229
188
  const componentName = options?.componentName;
230
189
  const isNot = this.isNot;
231
- const prefix = isNot ? 'not.toBeDynamicMaterial' : 'toBeDynamicMaterial';
232
- const portStr = locator.portTag || '';
233
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}()`;
234
- return await test_1.default.step(stepName, async () => {
190
+ return await (async () => {
235
191
  const { passed, last } = await poll(async () => {
236
192
  const res = await locator.evaluate('GetMaterialParameter', {
237
193
  parameterType: 'Info',
@@ -253,17 +209,14 @@ exports.materialExpect = test_1.expect.extend({
253
209
  actual: isDynamic,
254
210
  expected: !isNot
255
211
  };
256
- });
212
+ })();
257
213
  },
258
214
  async toHaveMaterialTextureParameter(locator, parameterName, expectedTexture, options) {
259
215
  const timeout = options?.timeout ?? 5000;
260
216
  const slotIndex = options?.slotIndex ?? 0;
261
217
  const componentName = options?.componentName;
262
218
  const isNot = this.isNot;
263
- const prefix = isNot ? 'not.toHaveMaterialTextureParameter' : 'toHaveMaterialTextureParameter';
264
- const portStr = locator.portTag || '';
265
- const stepName = `${portStr}expect(${locator.toString()}).${prefix}('${parameterName}', ${expectedTexture})`;
266
- return await test_1.default.step(stepName, async () => {
219
+ return await (async () => {
267
220
  const { passed, last } = await poll(async () => {
268
221
  const res = await locator.evaluate('GetMaterialParameter', {
269
222
  parameterName,
@@ -290,6 +243,6 @@ exports.materialExpect = test_1.expect.extend({
290
243
  actual: receivedName,
291
244
  expected: expectedTexture
292
245
  };
293
- });
246
+ })();
294
247
  }
295
- });
248
+ }));
@@ -1,40 +1,8 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.widgetExpect = void 0;
37
- const test_1 = __importStar(require("@playwright/test"));
4
+ const test_1 = require("@playwright/test");
5
+ const instrument_1 = require("./instrument");
38
6
  // ============================================================
39
7
  // SHARED POLLING HELPER
40
8
  // ============================================================
@@ -52,12 +20,11 @@ async function poll(fn, check, timeout) {
52
20
  }
53
21
  return { passed: false, last };
54
22
  }
55
- exports.widgetExpect = test_1.expect.extend({
23
+ exports.widgetExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
56
24
  async toHaveText(locator, expectedText, options) {
57
25
  const isNot = this.isNot;
58
26
  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 () => {
27
+ return await (async () => {
61
28
  const { passed, last } = await poll(() => locator.getText(), val => isNot ? val !== expectedText : val === expectedText, timeout);
62
29
  return {
63
30
  pass: isNot ? !passed : passed,
@@ -65,13 +32,12 @@ exports.widgetExpect = test_1.expect.extend({
65
32
  actual: last,
66
33
  expected: expectedText
67
34
  };
68
- });
35
+ })();
69
36
  },
70
37
  async toHaveValue(locator, expectedValue, options) {
71
38
  const isNot = this.isNot;
72
39
  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 () => {
40
+ return await (async () => {
75
41
  const { passed, last } = await poll(() => locator.getText(), val => isNot ? val !== expectedValue : val === expectedValue, timeout);
76
42
  return {
77
43
  pass: isNot ? !passed : passed,
@@ -79,13 +45,12 @@ exports.widgetExpect = test_1.expect.extend({
79
45
  actual: last,
80
46
  expected: expectedValue
81
47
  };
82
- });
48
+ })();
83
49
  },
84
50
  async toContainText(locator, substring, options) {
85
51
  const isNot = this.isNot;
86
52
  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 () => {
53
+ return await (async () => {
89
54
  const { passed, last } = await poll(() => locator.getText(), val => isNot ? !val.includes(substring) : val.includes(substring), timeout);
90
55
  return {
91
56
  pass: isNot ? !passed : passed,
@@ -93,18 +58,17 @@ exports.widgetExpect = test_1.expect.extend({
93
58
  actual: last,
94
59
  expected: substring
95
60
  };
96
- });
61
+ })();
97
62
  },
98
63
  async toBeEnabled(locator, options) {
99
64
  const isNot = this.isNot;
100
65
  const timeout = options?.timeout ?? 5000;
101
- const prefix = isNot ? 'not.toBeEnabled' : 'toBeEnabled';
102
- return await test_1.default.step(`expect(${locator.toString()}).${prefix}()`, async () => {
66
+ return await (async () => {
103
67
  const { passed, last } = await poll(() => locator.isEnabled(), val => isNot ? !val : val, timeout);
104
68
  return {
105
69
  pass: isNot ? !passed : passed,
106
70
  message: () => `Expected widget to${isNot ? ' not' : ''} be enabled, but it was${last ? '' : ' not'}.`
107
71
  };
108
- });
72
+ })();
109
73
  }
110
- });
74
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specter-automation/test",
3
- "version": "1.0.117",
3
+ "version": "1.0.119",
4
4
  "description": "Playwright integration for Unreal Engine automation via Specter",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",