testdriverai 4.0.67 → 4.0.69
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/index.js +12 -4
- package/lib/redraw.js +7 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -636,7 +636,7 @@ const firstPrompt = async () => {
|
|
|
636
636
|
} else if (input.indexOf("/manual") == 0) {
|
|
637
637
|
await manualInput(commands.slice(1).join(" "));
|
|
638
638
|
} else if (input.indexOf("/run") == 0) {
|
|
639
|
-
await run(commands[1], commands[2]);
|
|
639
|
+
await run(commands[1], commands[2], commands[3]);
|
|
640
640
|
} else if (input.indexOf("/generate") == 0) {
|
|
641
641
|
await generate(commands[1], commands[2]);
|
|
642
642
|
} else {
|
|
@@ -800,7 +800,12 @@ ${regression}
|
|
|
800
800
|
// this will load a regression test from a file location
|
|
801
801
|
// it parses the markdown file and executes the codeblocks exactly as if they were
|
|
802
802
|
// generated by the AI in a single prompt
|
|
803
|
-
let run = async (file, overwrite = false) => {
|
|
803
|
+
let run = async (file, overwrite = false, exit = true) => {
|
|
804
|
+
|
|
805
|
+
// parse potential string value for exit
|
|
806
|
+
exit = exit === "false" ? false : true;
|
|
807
|
+
overwrite = overwrite === "false" ? false : true;
|
|
808
|
+
|
|
804
809
|
setTerminalWindowTransparency(true);
|
|
805
810
|
|
|
806
811
|
log.log("info", chalk.cyan(`running ${file}...`));
|
|
@@ -874,8 +879,11 @@ ${yaml.dump(step)}
|
|
|
874
879
|
|
|
875
880
|
setTerminalWindowTransparency(false);
|
|
876
881
|
|
|
877
|
-
|
|
878
|
-
|
|
882
|
+
if (exit) {
|
|
883
|
+
await summarize();
|
|
884
|
+
await exit(false);
|
|
885
|
+
}
|
|
886
|
+
|
|
879
887
|
};
|
|
880
888
|
|
|
881
889
|
const promptUser = () => {
|
package/lib/redraw.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
const { captureScreenPNG } = require("./system");
|
|
2
|
-
|
|
2
|
+
const os = require("os");
|
|
3
|
+
const path = require("path");
|
|
3
4
|
const { compare } = require("odiff-bin");
|
|
4
5
|
|
|
5
6
|
async function imageIsDifferent(image1Url, image2Url) {
|
|
7
|
+
|
|
8
|
+
// generate a temporary file path
|
|
9
|
+
const tmpImage = path.join(os.tmpdir(), `tmp-${Date.now()}.png`);
|
|
10
|
+
|
|
6
11
|
const { reason, diffPercentage, match } = await compare(
|
|
7
12
|
image1Url,
|
|
8
13
|
image2Url,
|
|
9
|
-
|
|
14
|
+
tmpImage,
|
|
10
15
|
{
|
|
11
16
|
failOnLayoutDiff: false,
|
|
12
17
|
outputDiffMask: false,
|