1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59import { Command } from "commander";
import { DisposableStore } from "./src/disposables";
import { getSteps } from "./src/steps";
import { StepsRunner } from "./src/steps/StepsRunner";
import { ScreenRecording } from "./src/ScreenRecording";
import { ArtifactRef, VsCodeArtifactName, getArch, getOs } from "./src/vscode/getDownloadUrl";
async function main() {
const program = new Command();
program
.name("automatic-sanity-testing")
.description("Automated sanity testing tool")
.version("1.0.0")
.requiredOption("-t, --target <target>", "Target environment (user, system, or archive)")
.requiredOption("-c, --vscode-commit <commit>", "VS Code commit hash")
.parse();
const options = program.opts();
const target = options.target as string;
const vscodeCommit = options.vscodeCommit as string;
const artifact = new ArtifactRef(
vscodeCommit,
VsCodeArtifactName.build({
arch: getArch(),
os: getOs(),
type: 'desktop',
flavor: ({
"user": 'user',
"archive": 'archive',
"system": undefined,
} as any)[target],
}),
"stable",
);
console.log(`Running automated sanity testing for target: ${target}`);
const store = new DisposableStore();
const recording = store.add(await ScreenRecording.record("output.mp4"));
const runner = store.add(new StepsRunner(getSteps(store, artifact)));
try {
await runner.getFinalResult();
console.log("Steps completed successfully");
} catch (e) {
console.error("An error occurred during the steps execution:", e);
}
await recording.stop();
store.dispose();
process.exit();
}
main();