Skip to content

Commit 6e145d9

Browse files
authored
Update Components to address governance issues (#2524)
- Remove grunt-contrib-qunit to address tar-fs versioning - Update puppeteer - Improve performance and simplify Asynchronous test generation
1 parent 1647e6f commit 6e145d9

37 files changed

Lines changed: 1686 additions & 1163 deletions

File tree

AISKU/Tests/Perf/src/AISKUPerf.Tests.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { AITestClass, Assert } from "@microsoft/ai-test-framework";
22
import { AppInsightsInitPerfTestClass } from "./AISKUPerf";
33
import { utlRemoveSessionStorage } from "@microsoft/applicationinsights-common";
4+
import { createTimeoutPromise, doAwait } from "@nevware21/ts-async";
45

56
function isNullOrUndefined(value: any): boolean {
67
return value === undefined || value === null;
@@ -165,11 +166,10 @@ export class AISKUPerf extends AITestClass {
165166
}
166167

167168
public addPerfTest(): void {
168-
this.testCaseAsync({
169+
this.testCase({
169170
name: "AppInsights AISKU perf Test",
170-
stepDelay: 10000,
171171
assertNoHooks: false,
172-
steps: [() => {
172+
test: () => {
173173
Assert.ok(window["appInsightsInitPerftest"], "global appInsightsInitPerftest exists");
174174
Assert.ok(window["oneDS"], "oneDS exists");
175175
Assert.ok(this.perfMgr, "perfMgr exists");
@@ -195,9 +195,11 @@ export class AISKUPerf extends AITestClass {
195195
Assert.ok(false, "load snippet error: " + e);
196196
}
197197

198-
}].concat(() => {
199-
Assert.ok(true, "test version: " + this.AISKUPerfTest.version);
200-
})
198+
// Wait for 10 seconds to allow the script to load and then check if the appInsights object is available
199+
return this._delay(10000, () => {
200+
Assert.ok(true, "test version: " + this.AISKUPerfTest.version);
201+
});
202+
}
201203
});
202204
}
203205

AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export class ApplicationInsightsTests extends AITestClass {
315315
return true;
316316
}
317317
return false;
318-
}, "Wait for promise response" + new Date().toISOString(), 60, 1000) as any).concat(PollingAssert.createPollingAssert(() => {
318+
}, "Wait for promise response" + new Date().toISOString(), 60) as any).concat(PollingAssert.createPollingAssert(() => {
319319
let core = this._ai.core
320320
let activeStatus = core.activeStatus && core.activeStatus();
321321

@@ -325,7 +325,7 @@ export class ApplicationInsightsTests extends AITestClass {
325325
return true;
326326
}
327327
return false;
328-
}, "Wait for new string response" + new Date().toISOString(), 60, 1000) as any)
328+
}, "Wait for new string response" + new Date().toISOString(), 60) as any)
329329
});
330330

331331
this.testCaseAsync({
@@ -380,7 +380,7 @@ export class ApplicationInsightsTests extends AITestClass {
380380
return true;
381381
}
382382
return false;
383-
}, "Wait for promise response" + new Date().toISOString(), 60, 1000) as any)
383+
}, "Wait for promise response" + new Date().toISOString(), 60) as any)
384384
});
385385

386386

@@ -443,7 +443,7 @@ export class ApplicationInsightsTests extends AITestClass {
443443
return true;
444444
}
445445
return false;
446-
}, "Wait for promise response" + new Date().toISOString(), 60, 1000) as any)
446+
}, "Wait for promise response" + new Date().toISOString(), 60) as any)
447447
});
448448

449449

@@ -484,7 +484,7 @@ export class ApplicationInsightsTests extends AITestClass {
484484
return true;
485485
}
486486
return false;
487-
}, "Wait for promise response" + new Date().toISOString(), 60, 1000) as any)
487+
}, "Wait for promise response" + new Date().toISOString(), 60) as any)
488488
});
489489

490490
this.testCaseAsync({
@@ -538,7 +538,7 @@ export class ApplicationInsightsTests extends AITestClass {
538538
return true;
539539
}
540540
return false;
541-
}, "Wait for promise response" + new Date().toISOString(), 60, 1000) as any)
541+
}, "Wait for promise response" + new Date().toISOString(), 60) as any)
542542
});
543543

544544

@@ -783,7 +783,7 @@ export class ApplicationInsightsTests extends AITestClass {
783783
return false;
784784
}
785785
return false;
786-
}, "Wait for response" + new Date().toISOString(), 60, 1000) as any)
786+
}, "Wait for response" + new Date().toISOString(), 60) as any)
787787
});
788788

789789
this.testCaseAsync({
@@ -836,7 +836,7 @@ export class ApplicationInsightsTests extends AITestClass {
836836
return false;
837837
}
838838
return false;
839-
}, "Wait for response" + new Date().toISOString(), 60, 1000) as any)
839+
}, "Wait for response" + new Date().toISOString(), 60) as any)
840840
});
841841

842842
this.testCaseAsync({
@@ -871,7 +871,7 @@ export class ApplicationInsightsTests extends AITestClass {
871871
return true;
872872
}
873873
return false;
874-
}, "Wait for response" + new Date().toISOString(), 60, 1000) as any)
874+
}, "Wait for response" + new Date().toISOString(), 60) as any)
875875
});
876876
}
877877

@@ -910,7 +910,7 @@ export class ApplicationInsightsTests extends AITestClass {
910910
return true
911911
}
912912
return false
913-
}, "Wait for init" + new Date().toISOString(), 60, 1000) as any).concat(this.asserts(1)).concat(() => {
913+
}, "Wait for init" + new Date().toISOString(), 60) as any).concat(this.asserts(1)).concat(() => {
914914
const payloadStr: string[] = this.getPayloadMessages(this.successSpy);
915915
if (payloadStr.length > 0) {
916916
const payload = JSON.parse(payloadStr[0]);
@@ -2023,7 +2023,7 @@ export class ApplicationInsightsTests extends AITestClass {
20232023
}
20242024

20252025
return false;
2026-
}, "sender succeeded", 60, 1000))
2026+
}, "sender succeeded", 60))
20272027
];
20282028
}
20292029

0 commit comments

Comments
 (0)