runapptests - Add option for filtering tests by app id

pull/3399/head
Martin Boonk 2024-05-05 08:59:43 +02:00
parent 8c74a23549
commit 00f66f31a0
1 changed files with 4 additions and 2 deletions

View File

@ -93,7 +93,7 @@ function assertValue(step){
let value = step.js; let value = step.js;
if (value === undefined) if (value === undefined)
value = step.value; value = step.value;
switch (step.is){ switch (step.is.toLowerCase()){
case "truthy": isOK = assertCondition(getValue(`!!${value}`), step.text); break; case "truthy": isOK = assertCondition(getValue(`!!${value}`), step.text); break;
case "falsy": isOK = assertCondition(getValue(`!${value}`), step.text); break; case "falsy": isOK = assertCondition(getValue(`!${value}`), step.text); break;
case "true": isOK = assertCondition(getValue(`${value} === true`), step.text); break; case "true": isOK = assertCondition(getValue(`${value} === true`), step.text); break;
@ -355,7 +355,9 @@ emu.init({
// Emulator is now loaded // Emulator is now loaded
console.log("Loading tests"); console.log("Loading tests");
let p = Promise.resolve(); let p = Promise.resolve();
apploader.apps.forEach(app => { let apps = apploader.apps;
if (process.argv.includes("--id")) apps = apps.filter(e=>e.id==process.argv[process.argv.indexOf("--id") + 1]);
apps.forEach(app => {
var testFile = APP_DIR+"/"+app.id+"/test.json"; var testFile = APP_DIR+"/"+app.id+"/test.json";
if (!require("fs").existsSync(testFile)) return; if (!require("fs").existsSync(testFile)) return;
var test = JSON.parse(require("fs").readFileSync(testFile).toString()); var test = JSON.parse(require("fs").readFileSync(testFile).toString());