android - Simplify test step running
parent
e2f57cfb20
commit
9b8ecf8f8c
|
|
@ -29,8 +29,10 @@ let sec = {
|
||||||
|
|
||||||
NRF.getSecurityStatus = () => sec;
|
NRF.getSecurityStatus = () => sec;
|
||||||
|
|
||||||
setTimeout(() => {
|
let teststeps = [];
|
||||||
// add an empty starting point to make the asserts work
|
|
||||||
|
teststeps.push(()=>{
|
||||||
|
// add an empty starting point to make the asserts work
|
||||||
Bangle._PWR={};
|
Bangle._PWR={};
|
||||||
|
|
||||||
print("Not connected, should use internal GPS");
|
print("Not connected, should use internal GPS");
|
||||||
|
|
@ -90,37 +92,49 @@ setTimeout(() => {
|
||||||
NRF.emit("disconnect", {});
|
NRF.emit("disconnect", {});
|
||||||
print("disconnect");
|
print("disconnect");
|
||||||
sec.connected = false;
|
sec.connected = false;
|
||||||
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
teststeps.push(()=>{
|
||||||
|
assertNotEmpty(Bangle._PWR.GPS, "GPS");
|
||||||
|
assertTrue(Bangle.isGPSOn(), "isGPSOn");
|
||||||
|
assertTrue(internalOn(), "Internal GPS on");
|
||||||
|
|
||||||
assertNotEmpty(Bangle._PWR.GPS, "GPS");
|
print("connect");
|
||||||
assertTrue(Bangle.isGPSOn(), "isGPSOn");
|
sec.connected = true;
|
||||||
assertTrue(internalOn(), "Internal GPS on");
|
NRF.emit("connect", {});
|
||||||
|
});
|
||||||
|
|
||||||
print("connect");
|
teststeps.push(()=>{
|
||||||
sec.connected = true;
|
assertNotEmpty(Bangle._PWR.GPS, "GPS");
|
||||||
NRF.emit("connect", {});
|
assertTrue(Bangle.isGPSOn(), "isGPSOn");
|
||||||
|
assertFalse(internalOn(), "Internal GPS off");
|
||||||
|
|
||||||
setTimeout(() => {
|
assertFalse(Bangle.setGPSPower(0, "test"), "Switch GPS off");
|
||||||
assertNotEmpty(Bangle._PWR.GPS, "GPS");
|
|
||||||
assertTrue(Bangle.isGPSOn(), "isGPSOn");
|
|
||||||
assertFalse(internalOn(), "Internal GPS off");
|
|
||||||
|
|
||||||
assertFalse(Bangle.setGPSPower(0, "test"), "Switch GPS off");
|
assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS");
|
||||||
|
assertFalse(Bangle.isGPSOn(), "isGPSOn");
|
||||||
|
assertFalse(internalOn(), "Internal GPS off");
|
||||||
|
});
|
||||||
|
|
||||||
assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS");
|
setTimeout(()=>{
|
||||||
assertFalse(Bangle.isGPSOn(), "isGPSOn");
|
print("Test disconnect without gps on");
|
||||||
assertFalse(internalOn(), "Internal GPS off");
|
|
||||||
|
|
||||||
setTimeout(() => {
|
assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS");
|
||||||
print("Test disconnect without gps on");
|
assertFalse(Bangle.isGPSOn(), "isGPSOn");
|
||||||
|
assertFalse(internalOn(), "Internal GPS off");
|
||||||
|
|
||||||
assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS");
|
print("Result Overall is " + (result ? "OK" : "FAIL"));
|
||||||
assertFalse(Bangle.isGPSOn(), "isGPSOn");
|
});
|
||||||
assertFalse(internalOn(), "Internal GPS off");
|
|
||||||
|
|
||||||
print("Result Overall is " + (result ? "OK" : "FAIL"));
|
let wrap = (functions) => {
|
||||||
}, 0);
|
if (functions.length > 0) {
|
||||||
}, 0);
|
setTimeout(()=>{
|
||||||
}, 0);
|
functions.shift()();
|
||||||
|
wrap(functions);
|
||||||
|
},0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
setTimeout(()=>{
|
||||||
|
wrap(teststeps);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
Loading…
Reference in New Issue