@zondax/zemu
Advanced tools
Comparing version 0.36.2-beta.2 to 0.36.2-beta.3
@@ -57,3 +57,3 @@ "use strict"; | ||
y: 550, | ||
delay: 1, | ||
delay: 0.1, | ||
}; | ||
@@ -63,3 +63,3 @@ const approveHoldButton = { | ||
y: 525, | ||
delay: 6, | ||
delay: 4, | ||
}; | ||
@@ -66,0 +66,0 @@ const rejectButton = { |
@@ -165,3 +165,3 @@ "use strict"; | ||
const currentTimestamp = new Date().toISOString().slice(11, 23); | ||
process.stdout.write(`[ZEMU] ${currentTimestamp}: ${message}\n`); | ||
process.stdout.write(`[${this.containerName}] ${currentTimestamp}: ${message}\n`); | ||
} | ||
@@ -270,4 +270,2 @@ } | ||
while (currEvents.length === prevEvents.length) { | ||
await Zemu.sleep(); | ||
currEvents = await this.getEvents(); | ||
const elapsed = new Date().getTime() - startTime.getTime(); | ||
@@ -277,4 +275,9 @@ if (elapsed > timeout) { | ||
} | ||
await Zemu.sleep(); | ||
this.log(`Check [${elapsed}ms]`); | ||
currEvents = await this.getEvents(); | ||
} | ||
this.log(JSON.stringify(prevEvents)); | ||
this.log(JSON.stringify(currEvents)); | ||
this.log("Events changed"); | ||
} | ||
@@ -334,3 +337,3 @@ formatIndexString(i) { | ||
catch (err) { | ||
console.log(err); | ||
this.log(`${err}`); | ||
throw new Error("Snapshot does not exist"); | ||
@@ -474,6 +477,3 @@ } | ||
const events = await this.getEvents(); | ||
found = events.some((event) => { | ||
this.log(JSON.stringify(event)); | ||
return startRegex.test(event.text); | ||
}); | ||
found = events.some((event) => startRegex.test(event.text)); | ||
await Zemu.sleep(); | ||
@@ -484,2 +484,3 @@ } | ||
const prevEvents = await this.getEvents(); | ||
const prevScreen = await this.snapshot(); | ||
const clickUrl = `${this.transportProtocol}://${this.host}:${this.speculosApiPort}${endpoint}`; | ||
@@ -490,6 +491,10 @@ const payload = { action: "press-and-release" }; | ||
// Wait and poll Speculos until the application screen gets updated | ||
if (waitForScreenUpdate) | ||
if (waitForScreenUpdate) { | ||
await this.waitForScreenChanges(prevEvents); | ||
else | ||
await Zemu.sleep(); // A minimum delay is required | ||
await this.waitUntilScreenIsNot(prevScreen); | ||
} | ||
else { | ||
// A minimum delay is required | ||
await Zemu.sleep(); | ||
} | ||
return await this.snapshot(filename); | ||
@@ -496,0 +501,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "0.36.2-beta.2", | ||
"version": "0.36.2-beta.3", | ||
"description": "Zemu Testing Framework", | ||
@@ -66,3 +66,3 @@ "main": "./dist/index.js", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.4", | ||
"prettier": "^2.8.5", | ||
"rimraf": "^4.3.1", | ||
@@ -69,0 +69,0 @@ "ts-jest": "^29.0.5", |
@@ -81,3 +81,3 @@ /** ****************************************************************************** | ||
y: 550, | ||
delay: 1, | ||
delay: 0.1, | ||
}; | ||
@@ -88,3 +88,3 @@ | ||
y: 525, | ||
delay: 6, | ||
delay: 4, | ||
}; | ||
@@ -91,0 +91,0 @@ |
@@ -243,3 +243,3 @@ /** ****************************************************************************** | ||
const currentTimestamp = new Date().toISOString().slice(11, 23); | ||
process.stdout.write(`[ZEMU] ${currentTimestamp}: ${message}\n`); | ||
process.stdout.write(`[${this.containerName}] ${currentTimestamp}: ${message}\n`); | ||
} | ||
@@ -369,4 +369,2 @@ } | ||
while (currEvents.length === prevEvents.length) { | ||
await Zemu.sleep(); | ||
currEvents = await this.getEvents(); | ||
const elapsed = new Date().getTime() - startTime.getTime(); | ||
@@ -376,4 +374,9 @@ if (elapsed > timeout) { | ||
} | ||
await Zemu.sleep(); | ||
this.log(`Check [${elapsed}ms]`); | ||
currEvents = await this.getEvents(); | ||
} | ||
this.log(JSON.stringify(prevEvents)); | ||
this.log(JSON.stringify(currEvents)); | ||
this.log("Events changed"); | ||
} | ||
@@ -462,3 +465,3 @@ | ||
} catch (err) { | ||
console.log(err); | ||
this.log(`${err}`); | ||
throw new Error("Snapshot does not exist"); | ||
@@ -704,6 +707,3 @@ } | ||
const events = await this.getEvents(); | ||
found = events.some((event: IEvent) => { | ||
this.log(JSON.stringify(event)); | ||
return startRegex.test(event.text); | ||
}); | ||
found = events.some((event: IEvent) => startRegex.test(event.text)); | ||
await Zemu.sleep(); | ||
@@ -715,2 +715,3 @@ } | ||
const prevEvents = await this.getEvents(); | ||
const prevScreen = await this.snapshot(); | ||
@@ -723,4 +724,9 @@ const clickUrl = `${this.transportProtocol}://${this.host}:${this.speculosApiPort}${endpoint}`; | ||
// Wait and poll Speculos until the application screen gets updated | ||
if (waitForScreenUpdate) await this.waitForScreenChanges(prevEvents); | ||
else await Zemu.sleep(); // A minimum delay is required | ||
if (waitForScreenUpdate) { | ||
await this.waitForScreenChanges(prevEvents); | ||
await this.waitUntilScreenIsNot(prevScreen); | ||
} else { | ||
// A minimum delay is required | ||
await Zemu.sleep(); | ||
} | ||
@@ -727,0 +733,0 @@ return await this.snapshot(filename); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3028930
3042