@specter-automation/test 1.0.118 → 1.0.120
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/expect-all.d.ts +27 -0
- package/dist/core/expect-all.js +66 -0
- package/dist/core/locators/specter-locator.d.ts +14 -0
- package/dist/core/locators/specter-locator.js +25 -2
- package/dist/core/specter-client.d.ts +1 -0
- package/dist/core/specter-client.js +3 -0
- package/dist/core/specter-matcher-report.d.ts +42 -0
- package/dist/core/specter-matcher-report.js +54 -0
- package/dist/core/specter-reporter.d.ts +5 -0
- package/dist/core/specter-reporter.js +116 -80
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -1
- package/dist/matchers/actor-matchers.js +24 -86
- package/dist/matchers/ai-matchers.js +20 -76
- package/dist/matchers/gas-matchers.js +33 -48
- package/dist/matchers/instrument.d.ts +13 -0
- package/dist/matchers/instrument.js +150 -0
- package/dist/matchers/locator-matchers.js +12 -54
- package/dist/matchers/material-matchers.js +14 -61
- package/dist/matchers/widget-matchers.js +12 -48
- package/package.json +1 -1
|
@@ -1,41 +1,9 @@
|
|
|
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.actorExpect = void 0;
|
|
37
|
-
const test_1 =
|
|
38
|
-
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const instrument_1 = require("./instrument");
|
|
6
|
+
exports.actorExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
|
|
39
7
|
async toHaveMovedFurtherThan(locator, startLocation, expectedDistance, options) {
|
|
40
8
|
const assertionName = 'toHaveMovedFurtherThan';
|
|
41
9
|
const timeout = options?.timeout ?? 5000;
|
|
@@ -504,10 +472,7 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
504
472
|
async toBePossessed(locator, options) {
|
|
505
473
|
const isNot = this.isNot;
|
|
506
474
|
const timeout = options?.timeout ?? 5000;
|
|
507
|
-
|
|
508
|
-
const portStr = locator.portTag || '';
|
|
509
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}`;
|
|
510
|
-
return await test_1.default.step(stepName, async () => {
|
|
475
|
+
return await (async () => {
|
|
511
476
|
let lastInfo = null;
|
|
512
477
|
try {
|
|
513
478
|
await test_1.expect.poll(async () => {
|
|
@@ -523,15 +488,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
523
488
|
`Received: ${lastInfo ? (lastInfo.isPossessed ? `Possessed by ${lastInfo.controllerClass}` : 'Unpossessed') : 'null'}`
|
|
524
489
|
};
|
|
525
490
|
}
|
|
526
|
-
});
|
|
491
|
+
})();
|
|
527
492
|
},
|
|
528
493
|
async toBePlayerControlled(locator, options) {
|
|
529
494
|
const isNot = this.isNot;
|
|
530
495
|
const timeout = options?.timeout ?? 5000;
|
|
531
|
-
|
|
532
|
-
const portStr = locator.portTag || '';
|
|
533
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}`;
|
|
534
|
-
return await test_1.default.step(stepName, async () => {
|
|
496
|
+
return await (async () => {
|
|
535
497
|
let lastInfo = null;
|
|
536
498
|
try {
|
|
537
499
|
await test_1.expect.poll(async () => {
|
|
@@ -547,15 +509,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
547
509
|
`Received controller: ${lastInfo?.controllerClass || 'None (Unpossessed)'}`
|
|
548
510
|
};
|
|
549
511
|
}
|
|
550
|
-
});
|
|
512
|
+
})();
|
|
551
513
|
},
|
|
552
514
|
async toBeLocallyControlled(locator, options) {
|
|
553
515
|
const isNot = this.isNot;
|
|
554
516
|
const timeout = options?.timeout ?? 5000;
|
|
555
|
-
|
|
556
|
-
const portStr = locator.portTag || '';
|
|
557
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}`;
|
|
558
|
-
return await test_1.default.step(stepName, async () => {
|
|
517
|
+
return await (async () => {
|
|
559
518
|
let lastInfo = null;
|
|
560
519
|
try {
|
|
561
520
|
await test_1.expect.poll(async () => {
|
|
@@ -571,15 +530,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
571
530
|
`Received: isLocallyControlled=${lastInfo?.isLocallyControlled}`
|
|
572
531
|
};
|
|
573
532
|
}
|
|
574
|
-
});
|
|
533
|
+
})();
|
|
575
534
|
},
|
|
576
535
|
async toHaveController(locator, expectedControllerClass, options) {
|
|
577
536
|
const isNot = this.isNot;
|
|
578
537
|
const timeout = options?.timeout ?? 5000;
|
|
579
|
-
|
|
580
|
-
const portStr = locator.portTag || '';
|
|
581
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}(${expectedControllerClass ? JSON.stringify(expectedControllerClass) : ''})`;
|
|
582
|
-
return await test_1.default.step(stepName, async () => {
|
|
538
|
+
return await (async () => {
|
|
583
539
|
let lastInfo = null;
|
|
584
540
|
try {
|
|
585
541
|
await test_1.expect.poll(async () => {
|
|
@@ -600,15 +556,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
600
556
|
`Received: ${lastInfo?.controllerClass || 'None (Unpossessed)'}`
|
|
601
557
|
};
|
|
602
558
|
}
|
|
603
|
-
});
|
|
559
|
+
})();
|
|
604
560
|
},
|
|
605
561
|
async toBeFalling(locator, options) {
|
|
606
562
|
const isNot = this.isNot;
|
|
607
563
|
const timeout = options?.timeout ?? 5000;
|
|
608
|
-
|
|
609
|
-
const portStr = locator.portTag || '';
|
|
610
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}()`;
|
|
611
|
-
return await test_1.default.step(stepName, async () => {
|
|
564
|
+
return await (async () => {
|
|
612
565
|
// 1. Initial State Check: 0ms return if already in desired state
|
|
613
566
|
let current = await locator.isFalling();
|
|
614
567
|
if (isNot ? !current : current) {
|
|
@@ -646,15 +599,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
646
599
|
`Received: isFalling=${current}`
|
|
647
600
|
};
|
|
648
601
|
}
|
|
649
|
-
});
|
|
602
|
+
})();
|
|
650
603
|
},
|
|
651
604
|
async toBeSwimming(locator, options) {
|
|
652
605
|
const isNot = this.isNot;
|
|
653
606
|
const timeout = options?.timeout ?? 5000;
|
|
654
|
-
|
|
655
|
-
const portStr = locator.portTag || '';
|
|
656
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}()`;
|
|
657
|
-
return await test_1.default.step(stepName, async () => {
|
|
607
|
+
return await (async () => {
|
|
658
608
|
// 1. Initial State Check
|
|
659
609
|
let current = await locator.isSwimming();
|
|
660
610
|
if (isNot ? !current : current) {
|
|
@@ -681,15 +631,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
681
631
|
`Received: isSwimming=${current}`
|
|
682
632
|
};
|
|
683
633
|
}
|
|
684
|
-
});
|
|
634
|
+
})();
|
|
685
635
|
},
|
|
686
636
|
async toBeFlying(locator, options) {
|
|
687
637
|
const isNot = this.isNot;
|
|
688
638
|
const timeout = options?.timeout ?? 5000;
|
|
689
|
-
|
|
690
|
-
const portStr = locator.portTag || '';
|
|
691
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}()`;
|
|
692
|
-
return await test_1.default.step(stepName, async () => {
|
|
639
|
+
return await (async () => {
|
|
693
640
|
// 1. Initial State Check
|
|
694
641
|
let current = await locator.isFlying();
|
|
695
642
|
if (isNot ? !current : current) {
|
|
@@ -716,15 +663,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
716
663
|
`Received: isFlying=${current}`
|
|
717
664
|
};
|
|
718
665
|
}
|
|
719
|
-
});
|
|
666
|
+
})();
|
|
720
667
|
},
|
|
721
668
|
async toBeCrouching(locator, options) {
|
|
722
669
|
const isNot = this.isNot;
|
|
723
670
|
const timeout = options?.timeout ?? 5000;
|
|
724
|
-
|
|
725
|
-
const portStr = locator.portTag || '';
|
|
726
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}()`;
|
|
727
|
-
return await test_1.default.step(stepName, async () => {
|
|
671
|
+
return await (async () => {
|
|
728
672
|
// 1. Initial State Check
|
|
729
673
|
let current = await locator.isCrouching();
|
|
730
674
|
if (isNot ? !current : current) {
|
|
@@ -749,15 +693,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
749
693
|
`Received: isCrouching=${current}`
|
|
750
694
|
};
|
|
751
695
|
}
|
|
752
|
-
});
|
|
696
|
+
})();
|
|
753
697
|
},
|
|
754
698
|
async toBeMovingOnGround(locator, options) {
|
|
755
699
|
const isNot = this.isNot;
|
|
756
700
|
const timeout = options?.timeout ?? 5000;
|
|
757
|
-
|
|
758
|
-
const portStr = locator.portTag || '';
|
|
759
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}()`;
|
|
760
|
-
return await test_1.default.step(stepName, async () => {
|
|
701
|
+
return await (async () => {
|
|
761
702
|
// 1. Initial State Check
|
|
762
703
|
let current = await locator.isMovingOnGround();
|
|
763
704
|
if (isNot ? !current : current) {
|
|
@@ -795,15 +736,12 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
795
736
|
`Received: isMovingOnGround=${current}`
|
|
796
737
|
};
|
|
797
738
|
}
|
|
798
|
-
});
|
|
739
|
+
})();
|
|
799
740
|
},
|
|
800
741
|
async toHaveMovementMode(locator, expectedMode, options) {
|
|
801
742
|
const isNot = this.isNot;
|
|
802
743
|
const timeout = options?.timeout ?? 5000;
|
|
803
|
-
|
|
804
|
-
const portStr = locator.portTag || '';
|
|
805
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}('${expectedMode}')`;
|
|
806
|
-
return await test_1.default.step(stepName, async () => {
|
|
744
|
+
return await (async () => {
|
|
807
745
|
// 1. Initial State Check
|
|
808
746
|
const info = await locator.getMovementMode();
|
|
809
747
|
let lastMode = typeof info === 'string' ? info : (info?.movementMode ?? info?.mode ?? 'None');
|
|
@@ -836,6 +774,6 @@ exports.actorExpect = test_1.expect.extend({
|
|
|
836
774
|
`Received: '${lastMode}'`
|
|
837
775
|
};
|
|
838
776
|
}
|
|
839
|
-
});
|
|
777
|
+
})();
|
|
840
778
|
}
|
|
841
|
-
});
|
|
779
|
+
}));
|
|
@@ -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.aiExpect = void 0;
|
|
37
|
-
const test_1 =
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const instrument_1 = require("./instrument");
|
|
38
6
|
function formatTarget(target) {
|
|
39
7
|
if (typeof target === 'string')
|
|
40
8
|
return `'${target}'`;
|
|
@@ -46,15 +14,12 @@ function formatTarget(target) {
|
|
|
46
14
|
}
|
|
47
15
|
return JSON.stringify(target);
|
|
48
16
|
}
|
|
49
|
-
exports.aiExpect = test_1.expect.extend({
|
|
17
|
+
exports.aiExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
|
|
50
18
|
async toHaveBlackboardValue(locator, keyName, expectedValue, options) {
|
|
51
19
|
const isNot = this.isNot;
|
|
52
20
|
const timeout = options?.timeout ?? 5000;
|
|
53
21
|
const startTime = Date.now();
|
|
54
|
-
|
|
55
|
-
const portStr = locator?.transport?.port ? `[Port ${locator.transport.port}] ` : '';
|
|
56
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}('${keyName}', ${formatTarget(expectedValue)})`;
|
|
57
|
-
return await test_1.default.step(stepName, async () => {
|
|
22
|
+
return await (async () => {
|
|
58
23
|
let lastValue = null;
|
|
59
24
|
let lastObjName = undefined;
|
|
60
25
|
let lastObjTags = [];
|
|
@@ -102,17 +67,14 @@ exports.aiExpect = test_1.expect.extend({
|
|
|
102
67
|
message: () => `Expected Blackboard key '${keyName}' to ${isNot ? 'not ' : ''}match '${expectedValue}'.\n` +
|
|
103
68
|
`Received value: '${lastValue}'${lastObjName ? ` (Object: '${lastObjName}', Tags: [${lastObjTags.join(', ')}])` : ''}`
|
|
104
69
|
};
|
|
105
|
-
});
|
|
70
|
+
})();
|
|
106
71
|
},
|
|
107
72
|
async toHaveAIState(locator, expectedState, options) {
|
|
108
73
|
const isNot = this.isNot;
|
|
109
74
|
const timeout = options?.timeout ?? 5000;
|
|
110
75
|
const keyName = options?.keyName ?? 'AIState';
|
|
111
76
|
const startTime = Date.now();
|
|
112
|
-
|
|
113
|
-
const portStr = locator?.transport?.port ? `[Port ${locator.transport.port}] ` : '';
|
|
114
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}('${expectedState}')`;
|
|
115
|
-
return await test_1.default.step(stepName, async () => {
|
|
77
|
+
return await (async () => {
|
|
116
78
|
let lastState = '';
|
|
117
79
|
while (Date.now() - startTime < timeout) {
|
|
118
80
|
try {
|
|
@@ -132,17 +94,14 @@ exports.aiExpect = test_1.expect.extend({
|
|
|
132
94
|
message: () => `Expected AI state to ${isNot ? 'not ' : ''}be '${expectedState}'.\n` +
|
|
133
95
|
`Received state: '${lastState}' (Key: '${keyName}')`
|
|
134
96
|
};
|
|
135
|
-
});
|
|
97
|
+
})();
|
|
136
98
|
},
|
|
137
99
|
async toBeMovingTowards(locator, target, options) {
|
|
138
100
|
const isNot = this.isNot;
|
|
139
101
|
const timeout = options?.timeout ?? 5000;
|
|
140
102
|
const minSpeed = options?.minSpeed ?? 10.0;
|
|
141
103
|
const startTime = Date.now();
|
|
142
|
-
|
|
143
|
-
const portStr = locator?.transport?.port ? `[Port ${locator.transport.port}] ` : '';
|
|
144
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}(${formatTarget(target)})`;
|
|
145
|
-
return await test_1.default.step(stepName, async () => {
|
|
104
|
+
return await (async () => {
|
|
146
105
|
let lastInfo = null;
|
|
147
106
|
while (Date.now() - startTime < timeout) {
|
|
148
107
|
try {
|
|
@@ -167,17 +126,14 @@ exports.aiExpect = test_1.expect.extend({
|
|
|
167
126
|
`Facing Dot: ${lastInfo?.facingDot.toFixed(2) ?? 0} (facing: ${lastInfo?.isFacingTarget ? 'yes' : 'no'})\n` +
|
|
168
127
|
`Distance: ${lastInfo?.distance2D.toFixed(1) ?? 0} units`
|
|
169
128
|
};
|
|
170
|
-
});
|
|
129
|
+
})();
|
|
171
130
|
},
|
|
172
131
|
async toBeMovingAwayFrom(locator, target, options) {
|
|
173
132
|
const isNot = this.isNot;
|
|
174
133
|
const timeout = options?.timeout ?? 5000;
|
|
175
134
|
const minSpeed = options?.minSpeed ?? 10.0;
|
|
176
135
|
const startTime = Date.now();
|
|
177
|
-
|
|
178
|
-
const portStr = locator?.transport?.port ? `[Port ${locator.transport.port}] ` : '';
|
|
179
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}(${formatTarget(target)})`;
|
|
180
|
-
return await test_1.default.step(stepName, async () => {
|
|
136
|
+
return await (async () => {
|
|
181
137
|
let lastInfo = null;
|
|
182
138
|
while (Date.now() - startTime < timeout) {
|
|
183
139
|
try {
|
|
@@ -201,17 +157,14 @@ exports.aiExpect = test_1.expect.extend({
|
|
|
201
157
|
`Velocity Dot: ${lastInfo?.velocityDot.toFixed(2) ?? 0}\n` +
|
|
202
158
|
`Distance: ${lastInfo?.distance2D.toFixed(1) ?? 0} units`
|
|
203
159
|
};
|
|
204
|
-
});
|
|
160
|
+
})();
|
|
205
161
|
},
|
|
206
162
|
async toBeWithinDistance(locator, target, distance, options) {
|
|
207
163
|
const isNot = this.isNot;
|
|
208
164
|
const timeout = options?.timeout ?? 5000;
|
|
209
165
|
const planar = options?.planar ?? true;
|
|
210
166
|
const startTime = Date.now();
|
|
211
|
-
|
|
212
|
-
const portStr = locator?.transport?.port ? `[Port ${locator.transport.port}] ` : '';
|
|
213
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}(${formatTarget(target)}, ${distance})`;
|
|
214
|
-
return await test_1.default.step(stepName, async () => {
|
|
167
|
+
return await (async () => {
|
|
215
168
|
let lastDistance = Infinity;
|
|
216
169
|
while (Date.now() - startTime < timeout) {
|
|
217
170
|
try {
|
|
@@ -230,16 +183,13 @@ exports.aiExpect = test_1.expect.extend({
|
|
|
230
183
|
message: () => `Expected Actor to ${isNot ? 'not ' : ''}be within ${distance} units of target.\n` +
|
|
231
184
|
`Current distance: ${lastDistance.toFixed(1)} units (${planar ? '2D planar' : '3D'})`
|
|
232
185
|
};
|
|
233
|
-
});
|
|
186
|
+
})();
|
|
234
187
|
},
|
|
235
188
|
async toBeFollowing(locator, target, options) {
|
|
236
189
|
const isNot = this.isNot;
|
|
237
190
|
const timeout = options?.timeout ?? 5000;
|
|
238
191
|
const startTime = Date.now();
|
|
239
|
-
|
|
240
|
-
const portStr = locator?.transport?.port ? `[Port ${locator.transport.port}] ` : '';
|
|
241
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}(${formatTarget(target)})`;
|
|
242
|
-
return await test_1.default.step(stepName, async () => {
|
|
192
|
+
return await (async () => {
|
|
243
193
|
let lastInfo = null;
|
|
244
194
|
while (Date.now() - startTime < timeout) {
|
|
245
195
|
try {
|
|
@@ -263,16 +213,13 @@ exports.aiExpect = test_1.expect.extend({
|
|
|
263
213
|
`Navigating Towards Destination: ${lastInfo?.isNavigatingTowards ? 'yes' : 'no'}\n` +
|
|
264
214
|
`Distance: ${lastInfo?.distance2D.toFixed(1) ?? 0} units${options?.maxDistance ? ` (max: ${options.maxDistance})` : ''}`
|
|
265
215
|
};
|
|
266
|
-
});
|
|
216
|
+
})();
|
|
267
217
|
},
|
|
268
218
|
async toHaveLineOfSightTo(locator, target, options) {
|
|
269
219
|
const isNot = this.isNot;
|
|
270
220
|
const timeout = options?.timeout ?? 5000;
|
|
271
221
|
const startTime = Date.now();
|
|
272
|
-
|
|
273
|
-
const portStr = locator?.transport?.port ? `[Port ${locator.transport.port}] ` : '';
|
|
274
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}(${formatTarget(target)})`;
|
|
275
|
-
return await test_1.default.step(stepName, async () => {
|
|
222
|
+
return await (async () => {
|
|
276
223
|
let lastLOS = false;
|
|
277
224
|
while (Date.now() - startTime < timeout) {
|
|
278
225
|
try {
|
|
@@ -288,16 +235,13 @@ exports.aiExpect = test_1.expect.extend({
|
|
|
288
235
|
pass: isNot,
|
|
289
236
|
message: () => `Expected AI to ${isNot ? 'not ' : ''}have Line of Sight to target '${formatTarget(target)}', but hasLOS was ${lastLOS}.`
|
|
290
237
|
};
|
|
291
|
-
});
|
|
238
|
+
})();
|
|
292
239
|
},
|
|
293
240
|
async toBeRunningBehaviorTree(locator, treePath, options) {
|
|
294
241
|
const isNot = this.isNot;
|
|
295
242
|
const timeout = options?.timeout ?? 5000;
|
|
296
243
|
const startTime = Date.now();
|
|
297
|
-
|
|
298
|
-
const portStr = locator?.transport?.port ? `[Port ${locator.transport.port}] ` : '';
|
|
299
|
-
const stepName = `${portStr}expect(${locator.toString()}).${prefix}('${treePath}')`;
|
|
300
|
-
return await test_1.default.step(stepName, async () => {
|
|
244
|
+
return await (async () => {
|
|
301
245
|
let lastRunning = false;
|
|
302
246
|
while (Date.now() - startTime < timeout) {
|
|
303
247
|
try {
|
|
@@ -313,6 +257,6 @@ exports.aiExpect = test_1.expect.extend({
|
|
|
313
257
|
pass: isNot,
|
|
314
258
|
message: () => `Expected AI to ${isNot ? 'not ' : ''}be running BehaviorTree '${treePath}', but isRunning was ${lastRunning}.`
|
|
315
259
|
};
|
|
316
|
-
});
|
|
260
|
+
})();
|
|
317
261
|
}
|
|
318
|
-
});
|
|
262
|
+
}));
|