提交 6967b2e5 编写于 作者: L lidanyang16

<lidanyang16@huawei.com>

Signed-off-by: Nlidanyang16 <lidanyang16@huawei.com>
上级 b7f12c2c
...@@ -15,10 +15,12 @@ ...@@ -15,10 +15,12 @@
import VibratorJsTest_misc_1 from './Vibrator_old.test.js' import VibratorJsTest_misc_1 from './Vibrator_old.test.js'
import VibratorJsTest_misc_2 from './Vibrator_new_common.test.js' import VibratorJsTest_misc_2 from './Vibrator_new_common.test.js'
import VibratorJsTest_misc_3 from './Vibrator_newSupplement_common.test.js' import VibratorJsTest_misc_3 from './Vibrator_newSupplement_common.test.js'
import VibratorJsTest_misc_6 from './Vibrator_newSupportTest.js' import VibratorJsTest_misc_6 from './Vibrator_newSupportTest.test.js'
import VibratorJsTest_misc_7 from './Vibrator_options.test.js'
export default function testsuite() { export default function testsuite() {
VibratorJsTest_misc_1() VibratorJsTest_misc_1()
VibratorJsTest_misc_2() VibratorJsTest_misc_2()
VibratorJsTest_misc_3() VibratorJsTest_misc_3()
VibratorJsTest_misc_6() VibratorJsTest_misc_6()
VibratorJsTest_misc_7()
} }
/*
* Copyright (C) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import vibrator from '@ohos.vibrator'
import systemVibrator from '@system.vibrator'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function VibratorJsTest_misc_7() {
describe("VibratorJsTest_misc_7", function () {
let EFFECT_ID = "haptic.clock.timer";
let INVALID_EFFECT_ID = "haptic.xxx.yyy";
beforeAll(function() {
/*
* @tc.setup: setup invoked before all testcases
*/
console.info('beforeAll called')
})
afterAll(function() {
/*
* @tc.teardown: teardown invoked after all testcases
*/
console.info('afterAll called')
})
beforeEach(function() {
/*
* @tc.setup: setup invoked before each testcases
*/
console.info('beforeEach called')
})
afterEach(function() {
/*
* @tc.teardown: teardown invoked after each testcases
*/
vibrator.stop("preset");
vibrator.stop("time");
console.info('afterEach called')
})
const OPERATION_FAIL_CODE = 14600101;
const PERMISSION_ERROR_CODE = 201;
const PARAMETER_ERROR_CODE = 401;
const OPERATION_FAIL_MSG = 'Device operation failed.'
const PERMISSION_ERROR_MSG = 'Permission denied.'
const PARAMETER_ERROR_MSG = 'The parameter invalid.'
/*
* @tc.name:VibratorJsTest076
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0860
*/
it("VibratorJsTest076", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
vibrator.vibrate(1000, undefined).then(() => {
console.log("VibratorJsTest076 vibrate success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest076 vibrate error");
setTimeout(() => {
done();
}, 500);
});
})
/*
* @tc.name:VibratorJsTest077
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0870
*/
it("VibratorJsTest077", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.vibrate(1000, null).then(() => {
console.log("VibratorJsTest077 vibrate success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest077 vibrate error");
setTimeout(() => {
done();
}, 500);
});
})
/*
* @tc.name:VibratorJsTest078
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0880
*/
it("VibratorJsTest078", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.vibrate(1000, "abc").then(() => {
console.log("VibratorJsTest078 vibrate success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest078 vibrate error");
setTimeout(() => {
done();
}, 500);
});
})
/*
* @tc.name:VibratorJsTest079
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0890
*/
it("VibratorJsTest079", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.vibrate(EFFECT_ID, undefined).then(() => {
console.log("VibratorJsTest079 vibrate success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest079 vibrate error");
setTimeout(() => {
done();
}, 500);
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() =>{
return vibratePromise();
}).catch((error)=>{
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest080
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0900
*/
it("VibratorJsTest080", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.vibrate(EFFECT_ID, null).then(() => {
console.log("VibratorJsTest080 vibrate success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest080 vibrate error");
setTimeout(() => {
done();
}, 500);
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() =>{
return vibratePromise();
}).catch((error)=>{
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest081
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0910
*/
it("VibratorJsTest081", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.vibrate(EFFECT_ID, "abc").then(() => {
console.log("VibratorJsTest081 vibrate success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest081 vibrate error");
setTimeout(() => {
done();
}, 500);
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() =>{
return vibratePromise();
}).catch((error)=>{
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest082
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0920
*/
it("VibratorJsTest082", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
systemVibrator.vibrate(undefined);
setTimeout(() => {
expect(true).assertTrue();
done();
}, 500);
})
/*
* @tc.name:VibratorJsTest083
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0930
*/
it("VibratorJsTest083", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
systemVibrator.vibrate(null);
setTimeout(() => {
expect(true).assertTrue();
done();
}, 500);
})
/*
* @tc.name:VibratorJsTest084
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0940
*/
it("VibratorJsTest084", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
systemVibrator.vibrate("abc");
setTimeout(() => {
expect(true).assertTrue();
done();
}, 500);
})
/*
* @tc.name:VibratorJsTest085
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0950
*/
it("VibratorJsTest085", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
systemVibrator.vibrate({
mode: undefined,
success: function() {
expect(true).assertTrue();
console.log('VibratorJsTest085 vibrate is successful');
done();
},
fail: undefined,
complete: undefined
});
})
/*
* @tc.name:VibratorJsTest086
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0960
*/
it("VibratorJsTest086", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
systemVibrator.vibrate({
mode: null,
success: function() {
expect(true).assertTrue();
console.log('VibratorJsTest086 vibrate is successful');
done();
},
fail: null,
complete: null
});
})
/*
* @tc.name:VibratorJsTest087
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0970
*/
it("VibratorJsTest087", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
systemVibrator.vibrate({
mode: 123,
success: function() {
expect(true).assertTrue();
console.log('VibratorJsTest087 vibrate is successful');
done();
},
fail: 123,
complete: 123
});
})
/*
* @tc.name:VibratorJsTest088
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0980
*/
it("VibratorJsTest088", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.vibrate(EFFECT_ID).then(() => {
console.log("VibratorJsTest088 vibrate success");
expect(true).assertTrue();
resolve();
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest088 vibrate error");
reject();
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stop("preset", undefined).then(() => {
console.log("VibratorJsTest088 off success");
expect(true).assertTrue();
setTimeout(() => {
resolve();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest088 off error");
setTimeout(() => {
reject();
}, 500);
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() =>{
return vibratePromise();
}).then(() =>{
return stopPromise();
}).catch((error)=>{
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest089
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0990
*/
it("VibratorJsTest089", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.vibrate(EFFECT_ID).then(() => {
console.log("VibratorJsTest089 vibrate success");
expect(true).assertTrue();
resolve();
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest089 vibrate error");
reject();
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stop("preset", null).then(() => {
console.log("VibratorJsTest089 off success");
expect(true).assertTrue();
setTimeout(() => {
resolve();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest089 off error");
setTimeout(() => {
reject();
}, 500);
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() =>{
return vibratePromise();
}).then(() =>{
return stopPromise();
}).catch((error)=>{
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest090
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1000
*/
it("VibratorJsTest090", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.vibrate(EFFECT_ID).then(() => {
console.log("VibratorJsTest090 vibrate success");
expect(true).assertTrue();
resolve();
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest090 vibrate error");
reject();
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stop("preset", "abc").then(() => {
console.log("VibratorJsTest090 off success");
expect(true).assertTrue();
setTimeout(() => {
resolve();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest090 off error");
setTimeout(() => {
reject();
}, 500);
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() =>{
return vibratePromise();
}).then(() =>{
return stopPromise();
}).catch((error)=>{
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest091
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1010
*/
it("VibratorJsTest091", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try {
vibrator.stopVibration("").then(() => {
console.log("VibratorJsTest091 stop error");
expect(false).assertTrue();
setTimeout(() => {
done();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest091 stop error");
setTimeout(() => {
done();
}, 500);
});
} catch (error) {
console.info(error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.name:VibratorJsTest092
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1020
*/
it("VibratorJsTest092", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.startVibration({
type: "preset",
effectId: EFFECT_ID,
count: 1,
}, {
usage: "unknown"
}, (error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stopVibration((error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() => {
return vibratePromise();
}).then(() => {
return stopPromise();
}).catch((error) => {
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest093
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1030
*/
it("VibratorJsTest093", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.startVibration({
type: "preset",
effectId: EFFECT_ID,
count: 1,
}, {
usage: "notification"
}, (error) => {
if (error) {
expect(false).assertTrue();
reject();
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stopVibration("preset", undefined).then(() => {
console.log("VibratorJsTest093 off success");
expect(true).assertTrue();
setTimeout(() => {
resolve();
}, 500);
}, (error) => {
expect(false).assertTrue();
console.log("VibratorJsTest093 off error");
setTimeout(() => {
reject();
}, 500);
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() =>{
return vibratePromise();
}).then(() =>{
return stopPromise();
}).catch((error)=>{
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest094
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1040
*/
it("VibratorJsTest094", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.startVibration({
type: "preset",
effectId: EFFECT_ID,
count: 3,
}, {
usage: "notification"
}, (error) => {
if (error) {
expect(false).assertTrue();
reject();
} else {
console.log("VibratorJsTest094 vibrator success");
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stopVibration("preset", null).then(() => {
console.log("VibratorJsTest094 off success");
expect(true).assertTrue();
setTimeout(() => {
resolve();
}, 500);
}, (error) => {
expect(true).assertTrue();
console.log("VibratorJsTest094 off error");
setTimeout(() => {
reject();
}, 500);
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, (error, state) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
isSupport = state;
resolve();
}
});
})
await isSupportPromise.then(() =>{
return vibratePromise();
}).then(() =>{
return stopPromise();
}).catch((error)=>{
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest095
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1050
*/
it("VibratorJsTest095", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.startVibration({
type: "preset",
effectId: EFFECT_ID,
count: 1,
}, {
usage: "unknown"
}, (error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stopVibration((error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, "abc").then((state) => {
expect(true).assertTrue();
isSupport = state;
resolve();
}, (error) => {
expect(false).assertTrue();
reject(error);
});
})
await isSupportPromise.then(() => {
return vibratePromise();
}).then(() => {
return stopPromise();
}).catch((error) => {
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest096
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1060
*/
it("VibratorJsTest096", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function stopPromise() {
return new Promise((resolve, reject) => {
vibrator.stopVibration(undefined).then(() => {
expect(true).assertTrue();
resolve();
}, (error) => {
expect(false).assertTrue();
reject(error);
});
})
}
let promise = new Promise((resolve, reject) => {
vibrator.vibrate(2000, (error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
})
await promise.then(() => {
return stopPromise();
}).catch((error) => {
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest097
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1070
*/
it("VibratorJsTest097", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function stopPromise() {
return new Promise((resolve, reject) => {
vibrator.stopVibration(null).then(() => {
expect(true).assertTrue();
resolve();
}, (error) => {
expect(false).assertTrue();
reject(error);
});
})
}
let promise = new Promise((resolve, reject) => {
vibrator.vibrate(2000, (error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
})
await promise.then(() => {
return stopPromise();
}).catch((error) => {
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest098
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1080
*/
it("VibratorJsTest098", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function stopPromise() {
return new Promise((resolve, reject) => {
vibrator.stopVibration(123).then(() => {
expect(true).assertTrue();
resolve();
}, (error) => {
expect(false).assertTrue();
reject(error);
});
})
}
let promise = new Promise((resolve, reject) => {
vibrator.vibrate(2000, (error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
})
await promise.then(() => {
return stopPromise();
}).catch((error) => {
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest099
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1090
*/
it("VibratorJsTest099", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.startVibration({
type: "preset",
effectId: EFFECT_ID,
count: 1,
}, {
usage: "unknown"
}, (error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stopVibration((error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, undefined).then((state) => {
expect(true).assertTrue();
isSupport = state;
resolve();
}, (error) => {
expect(false).assertTrue();
reject(error);
});
})
await isSupportPromise.then(() => {
return vibratePromise();
}).then(() => {
return stopPromise();
}).catch((error) => {
expect(false).assertTrue();
})
done();
})
/*
* @tc.name:VibratorJsTest100
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_1100
*/
it("VibratorJsTest100", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let isSupport = false;
function vibratePromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.startVibration({
type: "preset",
effectId: EFFECT_ID,
count: 1,
}, {
usage: "unknown"
}, (error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
function stopPromise() {
return new Promise((resolve, reject) => {
if (isSupport) {
vibrator.stopVibration((error) => {
if (error) {
expect(false).assertTrue();
reject(error);
} else {
expect(true).assertTrue();
resolve();
}
});
} else {
resolve();
}
})
}
let isSupportPromise = new Promise((resolve, reject) => {
vibrator.isSupportEffect(EFFECT_ID, null).then((state) => {
expect(true).assertTrue();
isSupport = state;
resolve();
}, (error) => {
expect(false).assertTrue();
reject(error);
});
})
await isSupportPromise.then(() => {
return vibratePromise();
}).then(() => {
return stopPromise();
}).catch((error) => {
expect(false).assertTrue();
})
done();
})
})}
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_39", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_39", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_39", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_39", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -71,13 +71,13 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -71,13 +71,13 @@ describe("SensorJsTest_sensor_39", function () {
const SERVICE_EXCEPTION_MSG = 'Service exception.' const SERVICE_EXCEPTION_MSG = 'Service exception.'
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0140 * @tc.number: SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0010
* @tc.name: newAccelerometer_SensorJsTest014 * @tc.name: newAccelerometer_SensorJsTest001
* @tc.desc: Functional Use Cases * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newAccelerometer_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newAccelerometer_SensorJsTest014--------------'); console.info('---------newAccelerometer_SensorJsTest001--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback); sensor.on(sensor.SensorId.ACCELEROMETER, callback);
setTimeout(()=>{ setTimeout(()=>{
sensor.off(sensor.SensorId.ACCELEROMETER); sensor.off(sensor.SensorId.ACCELEROMETER);
...@@ -86,20 +86,20 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -86,20 +86,20 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0020
* @tc.name: newAccelerometer_SensorJsTest015 * @tc.name: newAccelerometer_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newAccelerometer_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAccelerometer_SensorJsTest015--------------'); console.info('---------newAccelerometer_SensorJsTest002--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest015 callback in'); console.info('newAccelerometer_SensorJsTest002 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest015 error:" + error); console.info("newAccelerometer_SensorJsTest002 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -107,30 +107,30 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -107,30 +107,30 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0030
* @tc.name: newAccelerometer_SensorJsTest016 * @tc.name: newAccelerometer_SensorJsTest003
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newAccelerometer_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAccelerometer_SensorJsTest016--------------'); console.info('---------newAccelerometer_SensorJsTest003--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.ACCELEROMETER, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAccelerometer_SensorJsTest016 off in--------------'); console.info('---------newAccelerometer_SensorJsTest003 off in--------------');
sensor.off(sensor.SensorId.ACCELEROMETER); sensor.off(sensor.SensorId.ACCELEROMETER);
console.info('---------newAccelerometer_SensorJsTest016 off end--------------'); console.info('---------newAccelerometer_SensorJsTest003 off end--------------');
done(); done();
}, 1000); }, 1000);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0040
* @tc.name: newAccelerometer_SensorJsTest017 * @tc.name: newAccelerometer_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAccelerometer_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newAccelerometer_SensorJsTest017--------------'); console.info('---------newAccelerometer_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest017 callback in'); console.info('newAccelerometer_SensorJsTest004 callback in');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -139,24 +139,24 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -139,24 +139,24 @@ describe("SensorJsTest_sensor_39", function () {
try { try {
sensor.on(sensor.SensorId.ACCELEROMETER, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.ACCELEROMETER, onSensorCallback, {'interval': 100000000}, 5);
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest017 error:" +error); console.info("newAccelerometer_SensorJsTest004 error:" +error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAccelerometer_SensorJsTest017 off in--------------'); console.info('---------newAccelerometer_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.ACCELEROMETER); sensor.off(sensor.SensorId.ACCELEROMETER);
console.info('---------newAccelerometer_SensorJsTest017 off end--------------'); console.info('---------newAccelerometer_SensorJsTest004 off end--------------');
done(); done();
}, 1000); }, 1000);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0050
* @tc.name: newAccelerometer_SensorJsTest018 * @tc.name: newAccelerometer_SensorJsTest005
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newAccelerometer_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
sensor.once(sensor.SensorId.ACCELEROMETER, callback); sensor.once(sensor.SensorId.ACCELEROMETER, callback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -165,20 +165,20 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -165,20 +165,20 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0060
* @tc.name: newAccelerometer_SensorJsTest019 * @tc.name: newAccelerometer_SensorJsTest006
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Use case of illegal parameter passed into once interface
*/ */
it("newAccelerometer_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest019 callback in'); console.info('newAccelerometer_SensorJsTest006 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest019 error:" +error); console.info("newAccelerometer_SensorJsTest006 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -186,13 +186,13 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -186,13 +186,13 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0070
* @tc.name: newAccelerometer_SensorJsTest020 * @tc.name: newAccelerometer_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAccelerometer_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest020 on error'); console.info('newAccelerometer_SensorJsTest007 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -202,22 +202,22 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -202,22 +202,22 @@ describe("SensorJsTest_sensor_39", function () {
try{ try{
sensor.once(sensor.SensorId.ACCELEROMETER, onceSensorCallback, 5); sensor.once(sensor.SensorId.ACCELEROMETER, onceSensorCallback, 5);
} catch (error) { } catch (error) {
console.info('newAccelerometer_SensorJsTest020 error:' +error); console.info('newAccelerometer_SensorJsTest007 error:' +error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0080
* @tc.name: newAccelerometer_SensorJsTest021 * @tc.name: newAccelerometer_SensorJsTest008
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Use case of illegal parameter passed into off interface
*/ */
it("newAccelerometer_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newAccelerometer_SensorJsTest021 error:' +error); console.info('newAccelerometer_SensorJsTest008 error:' +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -225,13 +225,13 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -225,13 +225,13 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0090
* @tc.name: newAccelerometer_SensorJsTest022 * @tc.name: newAccelerometer_SensorJsTest009
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Unsubscribe directly without waiting after starting subscription
*/ */
it("newAccelerometer_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest022 callback in' + JSON.stringify(data)); console.info('newAccelerometer_SensorJsTest009 callback in' + JSON.stringify(data));
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -244,20 +244,20 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -244,20 +244,20 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0100
* @tc.name: newAccelerometer_SensorJsTest023 * @tc.name: newAccelerometer_SensorJsTest010
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newAccelerometer_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest023 on error' + JSON.stringify(data)); console.info('newAccelerometer_SensorJsTest010 on error' + JSON.stringify(data));
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest023 error:" +error); console.info("newAccelerometer_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -265,40 +265,40 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -265,40 +265,40 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0110
* @tc.name: newAccelerometer_SensorJsTest024 * @tc.name: newAccelerometer_SensorJsTest011
* @tc.desc:Call interface multiple times * @tc.desc:Call interface multiple times
*/ */
it("newAccelerometer_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{
console.info("newAccelerometer_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newAccelerometer_SensorJsTest011 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{
console.info("newAccelerometer_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newAccelerometer_SensorJsTest011 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAccelerometer_SensorJsTest024 off in--------------'); console.info('---------newAccelerometer_SensorJsTest011 off in--------------');
sensor.off(sensor.SensorId.ACCELEROMETER); sensor.off(sensor.SensorId.ACCELEROMETER);
console.info('---------newAccelerometer_SensorJsTest024 off end--------------'); console.info('---------newAccelerometer_SensorJsTest011 off end--------------');
done(); done();
}, 1000); }, 1000);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0120
* @tc.name: newAccelerometer_SensorJsTest025 * @tc.name: newAccelerometer_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAccelerometer_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newAccelerometer_SensorJsTest025--------------'); console.info('---------newAccelerometer_SensorJsTest012--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback); sensor.on(sensor.SensorId.ACCELEROMETER, callback);
setTimeout(()=>{ setTimeout(()=>{
sensor.off(sensor.SensorId.ACCELEROMETER, 5); sensor.off(sensor.SensorId.ACCELEROMETER, 5);
...@@ -307,74 +307,74 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -307,74 +307,74 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0130
* @tc.name: newAccelerometer_SensorJsTest026 * @tc.name: newAccelerometer_SensorJsTest013
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc:Call on interface and once interface respectively, and use an off interface to close
*/ */
it("newAccelerometer_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAccelerometer_SensorJsTest026--------------'); console.info('---------newAccelerometer_SensorJsTest013--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{
console.info("newAccelerometer_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newAccelerometer_SensorJsTest013 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.ACCELEROMETER, (data)=>{ sensor.once(sensor.SensorId.ACCELEROMETER, (data)=>{
console.info("newAccelerometer_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newAccelerometer_SensorJsTest013 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAccelerometer_SensorJsTest026 off in--------------'); console.info('---------newAccelerometer_SensorJsTest013 off in--------------');
sensor.off(sensor.SensorId.ACCELEROMETER); sensor.off(sensor.SensorId.ACCELEROMETER);
console.info('---------newAccelerometer_SensorJsTest026 off end--------------'); console.info('---------newAccelerometer_SensorJsTest013 off end--------------');
done(); done();
}, 1000); }, 1000);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0140
* @tc.name: newAccelerometer_SensorJsTest027 * @tc.name: newAccelerometer_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAccelerometer_SensorJsTest027--------------'); console.info('---------newAccelerometer_SensorJsTest014--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{
console.info("newAccelerometer_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newAccelerometer_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{ sensor.on(sensor.SensorId.ACCELEROMETER, (data)=>{
console.info("newAccelerometer_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newAccelerometer_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAccelerometer_SensorJsTest027 off in--------------'); console.info('---------newAccelerometer_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.ACCELEROMETER); sensor.off(sensor.SensorId.ACCELEROMETER);
console.info('---------newAccelerometer_SensorJsTest027 off end--------------'); console.info('---------newAccelerometer_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0150
* @tc.name: newAccelerometer_SensorJsTest028 * @tc.name: newAccelerometer_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAccelerometer_SensorJsTest028--------------'); console.info('---------newAccelerometer_SensorJsTest015--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest028 on error:" +error); console.info("newAccelerometer_SensorJsTest015 on error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -382,7 +382,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -382,7 +382,7 @@ describe("SensorJsTest_sensor_39", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest028 once error:" +error); console.info("newAccelerometer_SensorJsTest015 once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -390,7 +390,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -390,7 +390,7 @@ describe("SensorJsTest_sensor_39", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest028 off error:" +error); console.info("newAccelerometer_SensorJsTest015 off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -398,55 +398,191 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -398,55 +398,191 @@ describe("SensorJsTest_sensor_39", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ACCELEROMETER_JSTest_0290 * @tc.number: SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0160
* @tc.name: newAccelerometer_SensorJsTest029 * @tc.name: newAccelerometer_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAccelerometer_SensorJsTest029--------------'); console.info('----------------------newAccelerometer_SensorJsTest016--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback); sensor.on(sensor.SensorId.ACCELEROMETER, callback);
sensor.on(sensor.SensorId.ACCELEROMETER, callback2); sensor.on(sensor.SensorId.ACCELEROMETER, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest029 off in--------------'); console.info('----------------------newAccelerometer_SensorJsTest016 off in--------------');
try { try {
sensor.off(sensor.SensorId.ACCELEROMETER, callback); sensor.off(sensor.SensorId.ACCELEROMETER, callback);
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest029 error:" + error); console.info("newAccelerometer_SensorJsTest016 error:" + error);
} }
console.info('----------------------newAccelerometer_SensorJsTest029 off end--------------'); console.info('----------------------newAccelerometer_SensorJsTest016 off end--------------');
}, 1000); }, 1000);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest029 off in--------------'); console.info('----------------------newAccelerometer_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.ACCELEROMETER, callback2); sensor.off(sensor.SensorId.ACCELEROMETER, callback2);
console.info('----------------------newAccelerometer_SensorJsTest029 off end--------------'); console.info('----------------------newAccelerometer_SensorJsTest016 off end--------------');
done(); done();
}, 1000); }, 1000);
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ACCELEROMETER_JSTest_0300 * @tc.number: SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0170
* @tc.name: newAccelerometer_SensorJsTest030 * @tc.name: newAccelerometer_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAccelerometer_SensorJsTest030--------------'); console.info('----------------------newAccelerometer_SensorJsTest017--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.ACCELEROMETER, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.ACCELEROMETER, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.ACCELEROMETER, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest030 off in--------------'); console.info('----------------------newAccelerometer_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.ACCELEROMETER, callback); sensor.off(sensor.SensorId.ACCELEROMETER, callback);
} catch (error) { } catch (error) {
console.info("newAccelerometer_SensorJsTest030 error:" + error); console.info("newAccelerometer_SensorJsTest017 error:" + error);
} }
console console.info('----------------------newAccelerometer_SensorJsTest017 off end--------------');
console.info('----------------------newAccelerometer_SensorJsTest030 off end--------------');
}, 1000); }, 1000);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest030_2 off in--------------'); console.info('----------------------newAccelerometer_SensorJsTest017_2 off in--------------');
sensor.off(sensor.SensorId.ACCELEROMETER, callback2); sensor.off(sensor.SensorId.ACCELEROMETER, callback2);
console.info('----------------------newAccelerometer_SensorJsTest030_2 off end--------------'); console.info('----------------------newAccelerometer_SensorJsTest017_2 off end--------------');
done(); done();
}, 1000); }, 1000);
}) })
/*
* @tc.number: SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0180
* @tc.name: newAccelerometer_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newAccelerometer_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
sensor.on(sensor.SensorId.ACCELEROMETER, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.ACCELEROMETER, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorId.ACCELEROMETER, callback);
sensor.off(sensor.SensorId.ACCELEROMETER, callback2);
} catch (error) {
console.info("newAccelerometer_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newAccelerometer_SensorJsTest018 off end--------------');
done()
}, 1000);
})
/*
* @tc.number: SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0190
* @tc.name: newAccelerometer_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newAccelerometer_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAccelerometer_SensorJsTest019--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback, undefined);
try{
sensor.on(sensor.SensorId.ACCELEROMETER, callback, { 'interval': undefined });
} catch(error){
console.info('newAccelerometer_SensorJsTest019 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest019 off in--------------');
try {
sensor.off(sensor.SensorId.ACCELEROMETER);
} catch (error) {
console.info("newAccelerometer_SensorJsTest019 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
})
/*
* @tc.number: SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0200
* @tc.name: newAccelerometer_SensorJsTest020
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newAccelerometer_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAccelerometer_SensorJsTest020--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback, null);
try{
sensor.on(sensor.SensorId.ACCELEROMETER, callback, { 'interval': null });
} catch(error){
console.info('newAccelerometer_SensorJsTest020 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest020 off in--------------');
try {
sensor.off(sensor.SensorId.ACCELEROMETER);
} catch (error) {
console.info("newAccelerometer_SensorJsTest020 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
})
/*
* @tc.number: SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0210
* @tc.name: newAccelerometer_SensorJsTest021
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newAccelerometer_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAccelerometer_SensorJsTest021--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest021 off in--------------');
try {
sensor.off(sensor.SensorId.ACCELEROMETER);
} catch (error) {
console.info("newAccelerometer_SensorJsTest021 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
})
/*
* @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0220
* @tc.name: newAccelerometer_SensorJsTest022
* @tc.desc: Functional Use Cases
*/
it("newAccelerometer_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAccelerometer_SensorJsTest022--------------');
try {
sensor.off(sensor.SensorId.ACCELEROMETER, null);
setTimeout(() => {
done();
}, 1000);
} catch(error){
console.info('newAccelerometer_SensorJsTest022 error:'+error);
expect(false).assertTrue();
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWACCELEROMETER_JSTest_0230
* @tc.name: newAccelerometer_SensorJsTest023
* @tc.desc: Functional Use Cases
*/
it("newAccelerometer_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAccelerometer_SensorJsTest023--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.ACCELEROMETER, callback, { 'interval': 100000000 });
} catch(error){
console.info("newAccelerometer_SensorJsTest023 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newAccelerometer_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.ACCELEROMETER);
} catch (error) {
console.info("newAccelerometer_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newAccelerometer_SensorJsTest023 off end--------------');
done()
}, 1000);
})
})} })}
...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_40", function () { ...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_40", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_40", function () { ...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_40", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_40", function () { ...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_40", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_40", function () { ...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_40", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_41", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_41", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_41", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_41", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -68,16 +68,16 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -68,16 +68,16 @@ describe("SensorJsTest_sensor_41", function () {
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0140 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0010
* @tc.name: newAmbient_Light_SensorJsTest014 * @tc.name: newAmbient_Light_SensorJsTest001
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newAmbient_Light_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newAmbient_Light_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest014--------------'); console.info('---------newAmbient_Light_SensorJsTest001--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest014 error'); console.info('newAmbient_Light_SensorJsTest001 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback);
...@@ -88,7 +88,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -88,7 +88,7 @@ describe("SensorJsTest_sensor_41", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newAmbient_Light_SensorJsTest014 Device does not support! '); console.info('newAmbient_Light_SensorJsTest001 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -96,20 +96,20 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -96,20 +96,20 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0020
* @tc.name: newAmbient_Light_SensorJsTest015 * @tc.name: newAmbient_Light_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newAmbient_Light_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest015--------------'); console.info('---------newAmbient_Light_SensorJsTest002--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest015 callback in'); console.info('newAmbient_Light_SensorJsTest002 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest015 error:" + error); console.info("newAmbient_Light_SensorJsTest002 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -117,29 +117,29 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -117,29 +117,29 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0030
* @tc.name: newAmbient_Light_SensorJsTest016 * @tc.name: newAmbient_Light_SensorJsTest003
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newAmbient_Light_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest016--------------'); console.info('---------newAmbient_Light_SensorJsTest003--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest016 error'); console.info('newAmbient_Light_SensorJsTest003 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAmbient_Light_SensorJsTest016 off in--------------'); console.info('---------newAmbient_Light_SensorJsTest003 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
console.info('---------newAmbient_Light_SensorJsTest016 off end--------------'); console.info('---------newAmbient_Light_SensorJsTest003 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info('newAmbient_Light_SensorJsTest016 Device does not support! '); console.info('newAmbient_Light_SensorJsTest003 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -147,34 +147,34 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -147,34 +147,34 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0040
* @tc.name: newAmbient_Light_SensorJsTest017 * @tc.name: newAmbient_Light_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAmbient_Light_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newAmbient_Light_SensorJsTest017--------------'); console.info('---------newAmbient_Light_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest017 callback in'); console.info('newAmbient_Light_SensorJsTest004 callback in');
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest017 error'); console.info('newAmbient_Light_SensorJsTest004 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback, {'interval': 100000000}, 5);
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAmbient_Light_SensorJsTest017 off in--------------'); console.info('---------newAmbient_Light_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
console.info('---------newAmbient_Light_SensorJsTest017 off end--------------'); console.info('---------newAmbient_Light_SensorJsTest004 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest017 Device does not support! "); console.info("newAmbient_Light_SensorJsTest004 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -182,15 +182,15 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -182,15 +182,15 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0050
* @tc.name: newAmbient_Light_SensorJsTest018 * @tc.name: newAmbient_Light_SensorJsTest005
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newAmbient_Light_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest018 error'); console.info('newAmbient_Light_SensorJsTest005 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.AMBIENT_LIGHT, callback); sensor.once(sensor.SensorId.AMBIENT_LIGHT, callback);
...@@ -201,7 +201,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -201,7 +201,7 @@ describe("SensorJsTest_sensor_41", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest018 Device does not support! "); console.info("newAmbient_Light_SensorJsTest005 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -209,20 +209,20 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -209,20 +209,20 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0060
* @tc.name: newAmbient_Light_SensorJsTest019 * @tc.name: newAmbient_Light_SensorJsTest006
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Use case of illegal parameter passed into once interface
*/ */
it("newAmbient_Light_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest019 callback in'); console.info('newAmbient_Light_SensorJsTest006 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest019 error:" +error); console.info("newAmbient_Light_SensorJsTest006 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -230,13 +230,13 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -230,13 +230,13 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0070
* @tc.name: newAmbient_Light_SensorJsTest020 * @tc.name: newAmbient_Light_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAmbient_Light_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest020 on error'); console.info('newAmbient_Light_SensorJsTest007 on error');
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
done(); done();
...@@ -244,14 +244,14 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -244,14 +244,14 @@ describe("SensorJsTest_sensor_41", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest020 error'); console.info('newAmbient_Light_SensorJsTest007 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.AMBIENT_LIGHT, onceSensorCallback, 5); sensor.once(sensor.SensorId.AMBIENT_LIGHT, onceSensorCallback, 5);
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest020 error:" +error); console.info("newAmbient_Light_SensorJsTest007 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -259,15 +259,15 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -259,15 +259,15 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0080
* @tc.name: newAmbient_Light_SensorJsTest021 * @tc.name: newAmbient_Light_SensorJsTest008
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Use case of illegal parameter passed into off interface
*/ */
it("newAmbient_Light_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newAmbient_Light_SensorJsTest021 Device does not support! '); console.info('newAmbient_Light_SensorJsTest008 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -275,20 +275,20 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -275,20 +275,20 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0090
* @tc.name: newAmbient_Light_SensorJsTest022 * @tc.name: newAmbient_Light_SensorJsTest009
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Unsubscribe directly without waiting after starting subscription
*/ */
it("newAmbient_Light_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest022 callback in'); console.info('newAmbient_Light_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest022 error'); console.info('newAmbient_Light_SensorJsTest009 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback); sensor.on(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback);
...@@ -300,7 +300,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -300,7 +300,7 @@ describe("SensorJsTest_sensor_41", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest022 error:" +error); console.info("newAmbient_Light_SensorJsTest009 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -308,19 +308,19 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -308,19 +308,19 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0100
* @tc.name: newAmbient_Light_SensorJsTest023 * @tc.name: newAmbient_Light_SensorJsTest010
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newAmbient_Light_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest023 on error'); console.info('newAmbient_Light_SensorJsTest010 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest023 error:" +error); console.info("newAmbient_Light_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -328,37 +328,37 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -328,37 +328,37 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0110
* @tc.name: newAmbient_Light_SensorJsTest024 * @tc.name: newAmbient_Light_SensorJsTest011
* @tc.desc:Call interface multiple times * @tc.desc:Call interface multiple times
*/ */
it("newAmbient_Light_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest024 error'); console.info('newAmbient_Light_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{ sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{
console.info("newAmbient_Light_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newAmbient_Light_SensorJsTest011 callback: " + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{ sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{
console.info("newAmbient_Light_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newAmbient_Light_SensorJsTest011 callback2: " + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAmbient_Light_SensorJsTest024 off in--------------'); console.info('---------newAmbient_Light_SensorJsTest011 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
console.info('---------newAmbient_Light_SensorJsTest024 off end--------------'); console.info('---------newAmbient_Light_SensorJsTest011 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest024 Device does not support! "); console.info("newAmbient_Light_SensorJsTest011 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -366,16 +366,16 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -366,16 +366,16 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0120
* @tc.name: newAmbient_Light_SensorJsTest025 * @tc.name: newAmbient_Light_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newAmbient_Light_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest025--------------'); console.info('---------newAmbient_Light_SensorJsTest012--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest025 error'); console.info('newAmbient_Light_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback);
...@@ -386,7 +386,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -386,7 +386,7 @@ describe("SensorJsTest_sensor_41", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newAmbient_Light_SensorJsTest025 Device does not support! '); console.info('newAmbient_Light_SensorJsTest012 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -394,38 +394,38 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -394,38 +394,38 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0130
* @tc.name: newAmbient_Light_SensorJsTest026 * @tc.name: newAmbient_Light_SensorJsTest013
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc:Call on interface and once interface respectively, and use an off interface to close
*/ */
it("newAmbient_Light_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest026--------------'); console.info('---------newAmbient_Light_SensorJsTest013--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest024 error'); console.info('newAmbient_Light_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{ sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{
console.info("newAmbient_Light_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newAmbient_Light_SensorJsTest013 callback: " + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.AMBIENT_LIGHT, (data)=>{ sensor.once(sensor.SensorId.AMBIENT_LIGHT, (data)=>{
console.info("newAmbient_Light_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newAmbient_Light_SensorJsTest013 callback2: " + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAmbient_Light_SensorJsTest026 off in--------------'); console.info('---------newAmbient_Light_SensorJsTest013 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
console.info('---------newAmbient_Light_SensorJsTest026 off end--------------'); console.info('---------newAmbient_Light_SensorJsTest013 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest026 Device does not support! "); console.info("newAmbient_Light_SensorJsTest013 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -433,39 +433,39 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -433,39 +433,39 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0140
* @tc.name: newAmbient_Light_SensorJsTest027 * @tc.name: newAmbient_Light_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest027--------------'); console.info('---------newAmbient_Light_SensorJsTest014--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest024 error'); console.info('newAmbient_Light_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{ sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{
console.info("newAmbient_Light_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newAmbient_Light_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{ sensor.on(sensor.SensorId.AMBIENT_LIGHT, (data)=>{
console.info("newAmbient_Light_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newAmbient_Light_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newAmbient_Light_SensorJsTest027 off in--------------'); console.info('---------newAmbient_Light_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
console.info('---------newAmbient_Light_SensorJsTest027 off end--------------'); console.info('---------newAmbient_Light_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest027 Device does not support! "); console.info("newAmbient_Light_SensorJsTest014 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -473,16 +473,16 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -473,16 +473,16 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0150
* @tc.name: newAmbient_Light_SensorJsTest028 * @tc.name: newAmbient_Light_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest028--------------'); console.info('---------newAmbient_Light_SensorJsTest015--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest028_on error:" +error); console.info("newAmbient_Light_SensorJsTest015_on error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -490,7 +490,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -490,7 +490,7 @@ describe("SensorJsTest_sensor_41", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest028_once error:" +error); console.info("newAmbient_Light_SensorJsTest015_once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -498,7 +498,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -498,7 +498,7 @@ describe("SensorJsTest_sensor_41", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest028_off error:" +error); console.info("newAmbient_Light_SensorJsTest015_off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -506,39 +506,39 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -506,39 +506,39 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0290 * @tc.number: SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0160
* @tc.name: newAmbient_Light_SensorJsTest029 * @tc.name: newAmbient_Light_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAmbient_Light_SensorJsTest029--------------'); console.info('----------------------newAmbient_Light_SensorJsTest016--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest029 error'); console.info('newAmbient_Light_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback);
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback2); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest029 off in--------------'); console.info('----------------------newAmbient_Light_SensorJsTest016 off in--------------');
try { try {
sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback); sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback);
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest029 error:" + error); console.info("newAmbient_Light_SensorJsTest016 error:" + error);
} }
console.info('----------------------newAmbient_Light_SensorJsTest029 off end--------------'); console.info('----------------------newAmbient_Light_SensorJsTest016 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest029 off in--------------'); console.info('----------------------newAmbient_Light_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback2); sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback2);
console.info('----------------------newAmbient_Light_SensorJsTest029 off end--------------'); console.info('----------------------newAmbient_Light_SensorJsTest016 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest029 Device does not support! "); console.info("newAmbient_Light_SensorJsTest016 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -546,40 +546,39 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -546,40 +546,39 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0300 * @tc.number: SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0170
* @tc.name: newAmbient_Light_SensorJsTest030 * @tc.name: newAmbient_Light_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAmbient_Light_SensorJsTest030--------------'); console.info('----------------------newAmbient_Light_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest029 error'); console.info('newAmbient_Light_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest030 off in--------------'); console.info('----------------------newAmbient_Light_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback); sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback);
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest030 error:" + error); console.info("newAmbient_Light_SensorJsTest017 error:" + error);
} }
console console.info('----------------------newAmbient_Light_SensorJsTest017 off end--------------');
console.info('----------------------newAmbient_Light_SensorJsTest030 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest030_2 off in--------------'); console.info('----------------------newAmbient_Light_SensorJsTest017_2 off in--------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback2); sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback2);
console.info('----------------------newAmbient_Light_SensorJsTest030_2 off end--------------'); console.info('----------------------newAmbient_Light_SensorJsTest017_2 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest030 Device does not support! "); console.info("newAmbient_Light_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -587,24 +586,24 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -587,24 +586,24 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0310 * @tc.number: SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0180
* @tc.name: newAmbient_Light_SensorJsTest031 * @tc.name: newAmbient_Light_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAmbient_Light_SensorJsTest031--------------'); console.info('----------------------newAmbient_Light_SensorJsTest018--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest031 error'); console.info('newAmbient_Light_SensorJsTest018 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
console.info('----------------------newAmbient_Light_SensorJsTest031 off in--------------'); console.info('----------------------newAmbient_Light_SensorJsTest018 off in--------------');
try{ try{
sensor.off(-1, callback); sensor.off(-1, callback);
console.info('----------------------newAmbient_Light_SensorJsTest031 off end--------------'); console.info('----------------------newAmbient_Light_SensorJsTest018 off end--------------');
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest031 error:" + error); console.info("newAmbient_Light_SensorJsTest018 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -612,7 +611,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -612,7 +611,7 @@ describe("SensorJsTest_sensor_41", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest031 Device does not support! "); console.info("newAmbient_Light_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -620,25 +619,25 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -620,25 +619,25 @@ describe("SensorJsTest_sensor_41", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_AMBIENT_LIGHT_JSTest_0320 * @tc.number: SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0190
* @tc.name: newAmbient_Light_SensorJsTest032 * @tc.name: newAmbient_Light_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newAmbient_Light_SensorJsTest032--------------'); console.info('----------------------newAmbient_Light_SensorJsTest019--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) { if (error) {
console.info('newAmbient_Light_SensorJsTest032 error'); console.info('newAmbient_Light_SensorJsTest019 error');
} else { } else {
try { try {
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, {'interval': -100000000}); sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, {'interval': -100000000});
console.info('----------------------newAmbient_Light_SensorJsTest032 off in---------------------------'); console.info('----------------------newAmbient_Light_SensorJsTest019 off in---------------------------');
sensor.off(sensor.SensorId.AMBIENT_LIGHT); sensor.off(sensor.SensorId.AMBIENT_LIGHT);
console.info('----------------------newAmbient_Light_SensorJsTest032 off end---------------------------'); console.info('----------------------newAmbient_Light_SensorJsTest019 off end---------------------------');
done(); done();
} catch (error) { } catch (error) {
console.info('newAmbient_Light_SensorJsTest032 On fail, errCode:' + error.code + ' ,msg:' + error.message); console.info('newAmbient_Light_SensorJsTest019 On fail, errCode:' + error.code + ' ,msg:' + error.message);
expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE);
expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG); expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG);
done(); done();
...@@ -646,10 +645,197 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -646,10 +645,197 @@ describe("SensorJsTest_sensor_41", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newAmbient_Light_SensorJsTest032 Device does not support! "); console.info("newAmbient_Light_SensorJsTest019 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0200
* @tc.name: newAmbient_Light_SensorJsTest020
* @tc.desc: Functional Use Cases
*/
it("newAmbient_Light_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest020--------------');
try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('newAmbient_Light_SensorJsTest020 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest020 off in--------------');
try {
sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback);
sensor.off(sensor.SensorId.AMBIENT_LIGHT, callback2);
} catch (error) {
console.info("newAmbient_Light_SensorJsTest020 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newAmbient_Light_SensorJsTest020 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('newAmbient_Light_SensorJsTest020 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0210
* @tc.name: newAmbient_Light_SensorJsTest021
* @tc.desc: Illegal ID passed in
*/
it("newAmbient_Light_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('newAmbient_Light_SensorJsTest021 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, undefined);
try{
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, { 'interval': undefined });
} catch(error){
console.info('newAmbient_Light_SensorJsTest021 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest021 off in--------------');
try {
sensor.off(sensor.SensorId.AMBIENT_LIGHT);
} catch (error) {
console.info("newAmbient_Light_SensorJsTest021 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newAmbient_Light_SensorJsTest021 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0220
* @tc.name: newAmbient_Light_SensorJsTest022
* @tc.desc: For normal scenarios
*/
it("newAmbient_Light_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest022--------------');
try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('newAmbient_Light_SensorJsTest022 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, null);
try{
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, { 'interval': null });
} catch(error){
console.info('newAmbient_Light_SensorJsTest022 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest022 off in--------------');
try {
sensor.off(sensor.SensorId.AMBIENT_LIGHT);
} catch (error) {
console.info("newAmbient_Light_SensorJsTest022 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newAmbient_Light_SensorJsTest022 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0230
* @tc.name: newAmbient_Light_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newAmbient_Light_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newAmbient_Light_SensorJsTest023--------------');
try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('newAmbient_Light_SensorJsTest023 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.AMBIENT_LIGHT);
} catch (error) {
console.info("newAmbient_Light_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("newAmbient_Light_SensorJsTest023 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWAMBIENT_LIGHT_JSTest_0240
* @tc.name: newAmbient_Light_SensorJsTest024
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("newAmbient_Light_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('newAmbient_Light_SensorJsTest024 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, { 'interval': 100000000 });
} catch(error){
console.info("newAmbient_Light_SensorJsTest024 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newAmbient_Light_SensorJsTest024 off in--------------');
try {
sensor.off(sensor.SensorId.AMBIENT_LIGHT);
} catch (error) {
console.info("newAmbient_Light_SensorJsTest024 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newAmbient_Light_SensorJsTest024 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("newAmbient_Light_SensorJsTest024 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_53", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_53", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_53", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_53", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -68,17 +68,17 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -68,17 +68,17 @@ describe("SensorJsTest_sensor_53", function () {
const SERVICE_EXCEPTION_MSG = 'Service exception.' const SERVICE_EXCEPTION_MSG = 'Service exception.'
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0140 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0010
* @tc.name: newBarometer_SensorJsTest014 * @tc.name: newBarometer_SensorJsTest001
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newBarometer_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newBarometer_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newBarometer_SensorJsTest014--------------'); console.info('---------newBarometer_SensorJsTest001--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest014 error'); console.info('newBarometer_SensorJsTest001 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback); sensor.on(sensor.SensorId.BAROMETER, callback);
...@@ -89,7 +89,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -89,7 +89,7 @@ describe("SensorJsTest_sensor_53", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newBarometer_SensorJsTest014 Device does not support! '); console.info('newBarometer_SensorJsTest001 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -97,20 +97,20 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -97,20 +97,20 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0020
* @tc.name: newBarometer_SensorJsTest015 * @tc.name: newBarometer_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newBarometer_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newBarometer_SensorJsTest015--------------'); console.info('---------newBarometer_SensorJsTest002--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newBarometer_SensorJsTest015 callback in'); console.info('newBarometer_SensorJsTest002 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest015 error:" + error); console.info("newBarometer_SensorJsTest002 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -118,29 +118,29 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -118,29 +118,29 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0030
* @tc.name: newBarometer_SensorJsTest016 * @tc.name: newBarometer_SensorJsTest003
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newBarometer_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newBarometer_SensorJsTest016--------------'); console.info('---------newBarometer_SensorJsTest003--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest016 error'); console.info('newBarometer_SensorJsTest003 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.BAROMETER, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newBarometer_SensorJsTest016 off in--------------'); console.info('---------newBarometer_SensorJsTest003 off in--------------');
sensor.off(sensor.SensorId.BAROMETER); sensor.off(sensor.SensorId.BAROMETER);
console.info('---------newBarometer_SensorJsTest016 off end--------------'); console.info('---------newBarometer_SensorJsTest003 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info('newBarometer_SensorJsTest016 Device does not support! '); console.info('newBarometer_SensorJsTest003 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -148,34 +148,34 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -148,34 +148,34 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0040
* @tc.name: newBarometer_SensorJsTest017 * @tc.name: newBarometer_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newBarometer_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newBarometer_SensorJsTest017--------------'); console.info('---------newBarometer_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newBarometer_SensorJsTest017 callback in'); console.info('newBarometer_SensorJsTest004 callback in');
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest017 error'); console.info('newBarometer_SensorJsTest004 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.BAROMETER, onSensorCallback, {'interval': 100000000}, 5);
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newBarometer_SensorJsTest017 off in--------------'); console.info('---------newBarometer_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.BAROMETER); sensor.off(sensor.SensorId.BAROMETER);
console.info('---------newBarometer_SensorJsTest017 off end--------------'); console.info('---------newBarometer_SensorJsTest004 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest017 Device does not support! "); console.info("newBarometer_SensorJsTest004 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -183,15 +183,15 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -183,15 +183,15 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0050
* @tc.name: newBarometer_SensorJsTest018 * @tc.name: newBarometer_SensorJsTest005
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newBarometer_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest018 error'); console.info('newBarometer_SensorJsTest005 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.BAROMETER, callback); sensor.once(sensor.SensorId.BAROMETER, callback);
...@@ -202,7 +202,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -202,7 +202,7 @@ describe("SensorJsTest_sensor_53", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest018 Device does not support! "); console.info("newBarometer_SensorJsTest005 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -210,20 +210,20 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -210,20 +210,20 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0060
* @tc.name: newBarometer_SensorJsTest019 * @tc.name: newBarometer_SensorJsTest006
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Use case of illegal parameter passed into once interface
*/ */
it("newBarometer_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newBarometer_SensorJsTest019 callback in'); console.info('newBarometer_SensorJsTest006 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest019 error:" +error); console.info("newBarometer_SensorJsTest006 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -231,13 +231,13 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -231,13 +231,13 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0070
* @tc.name: newBarometer_SensorJsTest020 * @tc.name: newBarometer_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newBarometer_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newBarometer_SensorJsTest020 on error'); console.info('newBarometer_SensorJsTest007 on error');
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
done(); done();
...@@ -245,14 +245,14 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -245,14 +245,14 @@ describe("SensorJsTest_sensor_53", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest020 error'); console.info('newBarometer_SensorJsTest007 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.BAROMETER, onceSensorCallback, 5); sensor.once(sensor.SensorId.BAROMETER, onceSensorCallback, 5);
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest020 error:" +error); console.info("newBarometer_SensorJsTest007 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -260,15 +260,15 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -260,15 +260,15 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0080
* @tc.name: newBarometer_SensorJsTest021 * @tc.name: newBarometer_SensorJsTest008
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Use case of illegal parameter passed into off interface
*/ */
it("newBarometer_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newBarometer_SensorJsTest021 Device does not support! '); console.info('newBarometer_SensorJsTest008 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -276,20 +276,20 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -276,20 +276,20 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0090
* @tc.name: newBarometer_SensorJsTest022 * @tc.name: newBarometer_SensorJsTest009
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Unsubscribe directly without waiting after starting subscription
*/ */
it("newBarometer_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newBarometer_SensorJsTest022 callback in'); console.info('newBarometer_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest022 error'); console.info('newBarometer_SensorJsTest009 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, onSensorCallback); sensor.on(sensor.SensorId.BAROMETER, onSensorCallback);
...@@ -301,7 +301,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -301,7 +301,7 @@ describe("SensorJsTest_sensor_53", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest022 error:" +error); console.info("newBarometer_SensorJsTest009 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -309,19 +309,19 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -309,19 +309,19 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0100
* @tc.name: newBarometer_SensorJsTest023 * @tc.name: newBarometer_SensorJsTest010
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newBarometer_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newBarometer_SensorJsTest023 on error'); console.info('newBarometer_SensorJsTest010 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest023 error:" +error); console.info("newBarometer_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -329,37 +329,37 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -329,37 +329,37 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0110
* @tc.name: newBarometer_SensorJsTest024 * @tc.name: newBarometer_SensorJsTest011
* @tc.desc:Call interface multiple times * @tc.desc:Call interface multiple times
*/ */
it("newBarometer_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest024 error'); console.info('newBarometer_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, (data)=>{ sensor.on(sensor.SensorId.BAROMETER, (data)=>{
console.info("newBarometer_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newBarometer_SensorJsTest011 callback: " + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.BAROMETER, (data)=>{ sensor.on(sensor.SensorId.BAROMETER, (data)=>{
console.info("newBarometer_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newBarometer_SensorJsTest011 callback2: " + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newBarometer_SensorJsTest024 off in--------------'); console.info('---------newBarometer_SensorJsTest011 off in--------------');
sensor.off(sensor.SensorId.BAROMETER); sensor.off(sensor.SensorId.BAROMETER);
console.info('---------newBarometer_SensorJsTest024 off end--------------'); console.info('---------newBarometer_SensorJsTest011 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest024 Device does not support! "); console.info("newBarometer_SensorJsTest011 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -367,16 +367,16 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -367,16 +367,16 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0120
* @tc.name: newBarometer_SensorJsTest025 * @tc.name: newBarometer_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newBarometer_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newBarometer_SensorJsTest025--------------'); console.info('---------newBarometer_SensorJsTest012--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest025 error'); console.info('newBarometer_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback); sensor.on(sensor.SensorId.BAROMETER, callback);
...@@ -387,7 +387,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -387,7 +387,7 @@ describe("SensorJsTest_sensor_53", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newBarometer_SensorJsTest025 Device does not support! '); console.info('newBarometer_SensorJsTest012 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -395,38 +395,38 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -395,38 +395,38 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0130
* @tc.name: newBarometer_SensorJsTest026 * @tc.name: newBarometer_SensorJsTest013
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc:Call on interface and once interface respectively, and use an off interface to close
*/ */
it("newBarometer_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newBarometer_SensorJsTest026--------------'); console.info('---------newBarometer_SensorJsTest013--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest024 error'); console.info('newBarometer_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, (data)=>{ sensor.on(sensor.SensorId.BAROMETER, (data)=>{
console.info("newBarometer_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newBarometer_SensorJsTest013 callback: " + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.BAROMETER, (data)=>{ sensor.once(sensor.SensorId.BAROMETER, (data)=>{
console.info("newBarometer_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newBarometer_SensorJsTest013 callback2: " + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newBarometer_SensorJsTest026 off in--------------'); console.info('---------newBarometer_SensorJsTest013 off in--------------');
sensor.off(sensor.SensorId.BAROMETER); sensor.off(sensor.SensorId.BAROMETER);
console.info('---------newBarometer_SensorJsTest026 off end--------------'); console.info('---------newBarometer_SensorJsTest013 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest026 Device does not support! "); console.info("newBarometer_SensorJsTest013 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -434,38 +434,38 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -434,38 +434,38 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0140
* @tc.name: newBarometer_SensorJsTest027 * @tc.name: newBarometer_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newBarometer_SensorJsTest027--------------'); console.info('---------newBarometer_SensorJsTest014--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest024 error'); console.info('newBarometer_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, (data)=>{ sensor.on(sensor.SensorId.BAROMETER, (data)=>{
console.info("newBarometer_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newBarometer_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.BAROMETER, (data)=>{ sensor.on(sensor.SensorId.BAROMETER, (data)=>{
console.info("newBarometer_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newBarometer_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newBarometer_SensorJsTest027 off in--------------'); console.info('---------newBarometer_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.BAROMETER); sensor.off(sensor.SensorId.BAROMETER);
console.info('---------newBarometer_SensorJsTest027 off end--------------'); console.info('---------newBarometer_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest027 Device does not support! "); console.info("newBarometer_SensorJsTest014 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -473,16 +473,16 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -473,16 +473,16 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0150
* @tc.name: newBarometer_SensorJsTest028 * @tc.name: newBarometer_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newBarometer_SensorJsTest028--------------'); console.info('---------newBarometer_SensorJsTest015--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest028_on error:" +error); console.info("newBarometer_SensorJsTest015_on error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -490,7 +490,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -490,7 +490,7 @@ describe("SensorJsTest_sensor_53", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest028_once error:" +error); console.info("newBarometer_SensorJsTest015_once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -498,7 +498,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -498,7 +498,7 @@ describe("SensorJsTest_sensor_53", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest028_off error:" +error); console.info("newBarometer_SensorJsTest015_off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -506,39 +506,39 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -506,39 +506,39 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_BAROMETER_JSTest_0290 * @tc.number: SUB_SensorsSystem_NEWBAROMETER_JSTest_0160
* @tc.name: newBarometer_SensorJsTest029 * @tc.name: newBarometer_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newBarometer_SensorJsTest029--------------'); console.info('----------------------newBarometer_SensorJsTest016--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest029 error'); console.info('newBarometer_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback); sensor.on(sensor.SensorId.BAROMETER, callback);
sensor.on(sensor.SensorId.BAROMETER, callback2); sensor.on(sensor.SensorId.BAROMETER, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest029 off in--------------'); console.info('----------------------newBarometer_SensorJsTest016 off in--------------');
try { try {
sensor.off(sensor.SensorId.BAROMETER, callback); sensor.off(sensor.SensorId.BAROMETER, callback);
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest029 error:" + error); console.info("newBarometer_SensorJsTest016 error:" + error);
} }
console.info('----------------------newBarometer_SensorJsTest029 off end--------------'); console.info('----------------------newBarometer_SensorJsTest016 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest029 off in--------------'); console.info('----------------------newBarometer_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.BAROMETER, callback2); sensor.off(sensor.SensorId.BAROMETER, callback2);
console.info('----------------------newBarometer_SensorJsTest029 off end--------------'); console.info('----------------------newBarometer_SensorJsTest016 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest029 Device does not support! "); console.info("newBarometer_SensorJsTest016 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -546,40 +546,39 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -546,40 +546,39 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_BAROMETER_JSTest_0300 * @tc.number: SUB_SensorsSystem_NEWBAROMETER_JSTest_0170
* @tc.name: newBarometer_SensorJsTest030 * @tc.name: newBarometer_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newBarometer_SensorJsTest030--------------'); console.info('----------------------newBarometer_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest029 error'); console.info('newBarometer_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.BAROMETER, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.BAROMETER, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.BAROMETER, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest030 off in--------------'); console.info('----------------------newBarometer_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.BAROMETER, callback); sensor.off(sensor.SensorId.BAROMETER, callback);
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest030 error:" + error); console.info("newBarometer_SensorJsTest017 error:" + error);
} }
console console.info('----------------------newBarometer_SensorJsTest017 off end--------------');
console.info('----------------------newBarometer_SensorJsTest030 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest030_2 off in--------------'); console.info('----------------------newBarometer_SensorJsTest017_2 off in--------------');
sensor.off(sensor.SensorId.BAROMETER, callback2); sensor.off(sensor.SensorId.BAROMETER, callback2);
console.info('----------------------newBarometer_SensorJsTest030_2 off end--------------'); console.info('----------------------newBarometer_SensorJsTest017_2 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest030 Device does not support! "); console.info("newBarometer_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -587,24 +586,24 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -587,24 +586,24 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_BAROMETER_JSTest_0310 * @tc.number: SUB_SensorsSystem_NEWBAROMETER_JSTest_0180
* @tc.name: newBarometer_SensorJsTest031 * @tc.name: newBarometer_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newBarometer_SensorJsTest031--------------'); console.info('----------------------newBarometer_SensorJsTest018--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest031 error'); console.info('newBarometer_SensorJsTest018 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
console.info('----------------------newBarometer_SensorJsTest031 off in--------------'); console.info('----------------------newBarometer_SensorJsTest018 off in--------------');
try{ try{
sensor.off(-1, callback); sensor.off(-1, callback);
console.info('----------------------newBarometer_SensorJsTest031 off end--------------'); console.info('----------------------newBarometer_SensorJsTest018 off end--------------');
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest031 error:" + error); console.info("newBarometer_SensorJsTest018 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -612,7 +611,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -612,7 +611,7 @@ describe("SensorJsTest_sensor_53", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest031 Device does not support! "); console.info("newBarometer_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -620,25 +619,25 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -620,25 +619,25 @@ describe("SensorJsTest_sensor_53", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_BAROMETER_JSTest_0320 * @tc.number: SUB_SensorsSystem_NEWBAROMETER_JSTest_0190
* @tc.name: newBarometer_SensorJsTest032 * @tc.name: newBarometer_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newBarometer_SensorJsTest032--------------'); console.info('----------------------newBarometer_SensorJsTest019--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) { if (error) {
console.info('newBarometer_SensorJsTest032 error'); console.info('newBarometer_SensorJsTest019 error');
} else { } else {
try { try {
sensor.on(sensor.SensorId.BAROMETER, callback, {'interval': -100000000}); sensor.on(sensor.SensorId.BAROMETER, callback, {'interval': -100000000});
console.info('----------------------newBarometer_SensorJsTest032 off in---------------------------'); console.info('----------------------newBarometer_SensorJsTest019 off in---------------------------');
sensor.off(sensor.SensorId.BAROMETER); sensor.off(sensor.SensorId.BAROMETER);
console.info('----------------------newBarometer_SensorJsTest032 off end---------------------------'); console.info('----------------------newBarometer_SensorJsTest019 off end---------------------------');
done(); done();
} catch (error) { } catch (error) {
console.info('newBarometer_SensorJsTest032 On fail, errCode:' + error.code + ' ,msg:' + error.message); console.info('newBarometer_SensorJsTest019 On fail, errCode:' + error.code + ' ,msg:' + error.message);
expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE);
expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG); expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG);
done(); done();
...@@ -646,10 +645,197 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -646,10 +645,197 @@ describe("SensorJsTest_sensor_53", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newBarometer_SensorJsTest032 Device does not support! "); console.info("newBarometer_SensorJsTest019 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0200
* @tc.name: newBarometer_SensorJsTest020
* @tc.desc: Functional Use Cases
*/
it("newBarometer_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newBarometer_SensorJsTest020--------------');
try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) {
console.info('newBarometer_SensorJsTest020 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.BAROMETER, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest020 off in--------------');
try {
sensor.off(sensor.SensorId.BAROMETER, callback);
sensor.off(sensor.SensorId.BAROMETER, callback2);
} catch (error) {
console.info("newBarometer_SensorJsTest020 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newBarometer_SensorJsTest020 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('newBarometer_SensorJsTest020 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0210
* @tc.name: newBarometer_SensorJsTest021
* @tc.desc: Illegal ID passed in
*/
it("newBarometer_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) {
console.info('newBarometer_SensorJsTest021 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback, undefined);
try{
sensor.on(sensor.SensorId.BAROMETER, callback, { 'interval': undefined });
} catch(error){
console.info('newBarometer_SensorJsTest021 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest021 off in--------------');
try {
sensor.off(sensor.SensorId.BAROMETER);
} catch (error) {
console.info("newBarometer_SensorJsTest021 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newBarometer_SensorJsTest021 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0220
* @tc.name: newBarometer_SensorJsTest022
* @tc.desc: For normal scenarios
*/
it("newBarometer_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newBarometer_SensorJsTest022--------------');
try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) {
console.info('newBarometer_SensorJsTest022 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback, null);
try{
sensor.on(sensor.SensorId.BAROMETER, callback, { 'interval': null });
} catch(error){
console.info('newBarometer_SensorJsTest022 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest022 off in--------------');
try {
sensor.off(sensor.SensorId.BAROMETER);
} catch (error) {
console.info("newBarometer_SensorJsTest022 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newBarometer_SensorJsTest022 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0230
* @tc.name: newBarometer_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newBarometer_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newBarometer_SensorJsTest023--------------');
try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) {
console.info('newBarometer_SensorJsTest023 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.BAROMETER);
} catch (error) {
console.info("newBarometer_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("newBarometer_SensorJsTest023 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWBAROMETER_JSTest_0240
* @tc.name: newBarometer_SensorJsTest024
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("newBarometer_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
if (error) {
console.info('newBarometer_SensorJsTest024 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.BAROMETER, callback, { 'interval': 100000000 });
} catch(error){
console.info("newBarometer_SensorJsTest024 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newBarometer_SensorJsTest024 off in--------------');
try {
sensor.off(sensor.SensorId.BAROMETER);
} catch (error) {
console.info("newBarometer_SensorJsTest024 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newBarometer_SensorJsTest024 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("newBarometer_SensorJsTest024 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_35", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_35", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_35", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_35", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_35", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_35", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_35", function () { ...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_35", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let errMessage; let errMessage;
...@@ -63,7 +63,6 @@ describe("SensorJsTest_sensor_35", function () { ...@@ -63,7 +63,6 @@ describe("SensorJsTest_sensor_35", function () {
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("getSensorLists_SensorJsTest001",TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("getSensorLists_SensorJsTest001",TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info("---------------------------getSensorLists_SensorJsTest001----------------------------------");
sensor.getSensorList().then((data) => { sensor.getSensorList().then((data) => {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest001 " + JSON.stringify(data[i])); console.info("getSensorLists_SensorJsTest001 " + JSON.stringify(data[i]));
...@@ -81,7 +80,6 @@ describe("SensorJsTest_sensor_35", function () { ...@@ -81,7 +80,6 @@ describe("SensorJsTest_sensor_35", function () {
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("---------------------------getSensorLists_SensorJsTest002----------------------------------");
sensor.getSensorList((error, data) => { sensor.getSensorList((error, data) => {
if (error) { if (error) {
console.info('getSensorLists_SensorJsTest002 error'); console.info('getSensorLists_SensorJsTest002 error');
...@@ -101,9 +99,8 @@ describe("SensorJsTest_sensor_35", function () { ...@@ -101,9 +99,8 @@ describe("SensorJsTest_sensor_35", function () {
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("getSensorLists_SensorJsTest003", 0, async function (done) { it("getSensorLists_SensorJsTest003", 0, async function (done) {
console.info("---------------------------getSensorLists_SensorJsTest003----------------------------------");
sensor.getSensorList(null).then(data => { sensor.getSensorList(null).then(data => {
console.info("---------------------------getSensorLists_SensorJsTest003 callback in-----------" + data.length); console.info("--getSensorLists_SensorJsTest003 callback in--" + data.length);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest003 " + JSON.stringify(data[i])); console.info("getSensorLists_SensorJsTest003 " + JSON.stringify(data[i]));
} }
...@@ -122,9 +119,8 @@ describe("SensorJsTest_sensor_35", function () { ...@@ -122,9 +119,8 @@ describe("SensorJsTest_sensor_35", function () {
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("getSensorLists_SensorJsTest004", 0, async function (done) { it("getSensorLists_SensorJsTest004", 0, async function (done) {
console.info("---------------------------getSensorLists_SensorJsTest004----------------------------------");
sensor.getSensorList(errMessage).then(data => { sensor.getSensorList(errMessage).then(data => {
console.info("---------------------------getSensorLists_SensorJsTest004 callback in-----------" + data.length); console.info("--getSensorLists_SensorJsTest004 callback in--" + data.length);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest004 " + JSON.stringify(data[i])); console.info("getSensorLists_SensorJsTest004 " + JSON.stringify(data[i]));
} }
...@@ -143,9 +139,8 @@ it("getSensorLists_SensorJsTest004", 0, async function (done) { ...@@ -143,9 +139,8 @@ it("getSensorLists_SensorJsTest004", 0, async function (done) {
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("getSensorLists_SensorJsTest005", 0, async function (done) { it("getSensorLists_SensorJsTest005", 0, async function (done) {
console.info("---------------------------getSensorLists_SensorJsTest005----------------------------------");
sensor.getSensorList('xxx').then(data => { sensor.getSensorList('xxx').then(data => {
console.info("---------------------------getSensorLists_SensorJsTest005 callback in-----------" + data.length); console.info("--getSensorLists_SensorJsTest005 callback in--" + data.length);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest005 " + JSON.stringify(data[i])); console.info("getSensorLists_SensorJsTest005 " + JSON.stringify(data[i]));
} }
...@@ -164,16 +159,15 @@ it("getSensorLists_SensorJsTest005", 0, async function (done) { ...@@ -164,16 +159,15 @@ it("getSensorLists_SensorJsTest005", 0, async function (done) {
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("getSensorLists_SensorJsTest006", 0, async function (done) { it("getSensorLists_SensorJsTest006", 0, async function (done) {
console.info("---------------------------getSensorLists_SensorJsTest006----------------------------------");
sensor.getSensorList(invild).then(data => { sensor.getSensorList(invild).then(data => {
console.info("---------------------------getSensorLists_SensorJsTest006 callback in-----------" + data.length); console.info("--getSensorLists_SensorJsTest006 callback in--" + data.length);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest006 " + JSON.stringify(data[i])); console.info("getSensorLists_SensorJsTest006 " + JSON.stringify(data[i]));
} }
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}, (error) => { }, (error) => {
console.info('getSensorLists_SensorJsTest006 failed'); console.info('getSensorLists_SensorJsTest006 failed'+error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
...@@ -185,7 +179,6 @@ it("getSensorLists_SensorJsTest005", 0, async function (done) { ...@@ -185,7 +179,6 @@ it("getSensorLists_SensorJsTest005", 0, async function (done) {
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("getSensorLists_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("getSensorLists_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("---------------------------getSensorLists_SensorJsTest007----------------------------------");
try { try {
sensor.getSensorList(invild).then(data => { sensor.getSensorList(invild).then(data => {
console.info("getSensorLists_SensorJsTest007 " + JSON.stringify(data)); console.info("getSensorLists_SensorJsTest007 " + JSON.stringify(data));
...@@ -203,4 +196,44 @@ it("getSensorLists_SensorJsTest005", 0, async function (done) { ...@@ -203,4 +196,44 @@ it("getSensorLists_SensorJsTest005", 0, async function (done) {
done(); done();
} }
}) })
/**
* @tc.number:SUB_SensorsSystem_GetSensorLists_JSTest_0080
* @tc.name: getSensorLists_SensorJsTest008
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it("getSensorLists_SensorJsTest008", 0, async function (done) {
sensor.getSensorList(undefined).then((data) => {
console.info("--getSensorLists_SensorJsTest008 callback in--" + data.length);
for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest008 " + JSON.stringify(data[i]));
}
expect(true).assertTrue();
done();
}, (error) => {
console.info('getSensorLists_SensorJsTest008 failed');
expect(false).assertTrue();
done();
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSensorLists_JSTest_0090
* @tc.name: getSensorLists_SensorJsTest009
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it("getSensorLists_SensorJsTest009", 0, async function (done) {
sensor.getSensorList(null).then((data) => {
console.info("----------getSensorLists_SensorJsTest009 callback in-----" + data.length);
for (let i = 0; i < data.length; i++) {
console.info("getSensorLists_SensorJsTest009 " + JSON.stringify(data[i]));
}
expect(true).assertTrue();
done();
}, (error) => {
console.info('getSensorLists_SensorJsTest009 failed');
expect(false).assertTrue();
done();
});
})
})} })}
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_36", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_36", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_36", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_36", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let invild; let invild;
...@@ -90,10 +90,10 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -90,10 +90,10 @@ describe("SensorJsTest_sensor_36", function () {
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0020 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0020
* @tc.name: GetSingleSensor_JSTest_002 * @tc.name: GetSingleSensor_JSTest_002
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it('GetSingleSensor_JSTest_002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('GetSingleSensor_JSTest_002', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("------------------GetSingleSensor_JSTest_002-------------------------"); console.info("------------------GetSingleSensor_JSTest_002-------------------------");
try { try {
...@@ -107,10 +107,10 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -107,10 +107,10 @@ describe("SensorJsTest_sensor_36", function () {
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0030 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0030
* @tc.name: GetSingleSensor_JSTest_003 * @tc.name: GetSingleSensor_JSTest_003
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it('GetSingleSensor_JSTest_003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('GetSingleSensor_JSTest_003', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("------------------GetSingleSensor_JSTest_003-------------------------"); console.info("------------------GetSingleSensor_JSTest_003-------------------------");
try { try {
...@@ -143,11 +143,11 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -143,11 +143,11 @@ describe("SensorJsTest_sensor_36", function () {
} }
}) })
/** /**
* @tc.number: SUB_SensorsSystem_GetSingleSensor_JSTest_0040 * @tc.number: SUB_SensorsSystem_GetSingleSensor_JSTest_0040
* @tc.name: GetSingleSensor_JSTest_004 * @tc.name: GetSingleSensor_JSTest_004
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it('GetSingleSensor_JSTest_004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('GetSingleSensor_JSTest_004', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("------------------GetSingleSensor_JSTest_004-------------------------"); console.info("------------------GetSingleSensor_JSTest_004-------------------------");
try { try {
...@@ -180,11 +180,11 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -180,11 +180,11 @@ describe("SensorJsTest_sensor_36", function () {
} }
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0050 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0050
* @tc.name: GetSingleSensor_JSTest_005 * @tc.name: GetSingleSensor_JSTest_005
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it('GetSingleSensor_JSTest_005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('GetSingleSensor_JSTest_005', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("------------------GetSingleSensor_JSTest_005-------------------------"); console.info("------------------GetSingleSensor_JSTest_005-------------------------");
try { try {
...@@ -207,11 +207,11 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -207,11 +207,11 @@ describe("SensorJsTest_sensor_36", function () {
} }
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0060 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0060
* @tc.name: GetSingleSensor_JSTest_006 * @tc.name: GetSingleSensor_JSTest_006
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it('GetSingleSensor_JSTest_006', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('GetSingleSensor_JSTest_006', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("------------------GetSingleSensor_JSTest_006-------------------------"); console.info("------------------GetSingleSensor_JSTest_006-------------------------");
try { try {
...@@ -225,10 +225,10 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -225,10 +225,10 @@ describe("SensorJsTest_sensor_36", function () {
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0070 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0070
* @tc.name: GetSingleSensor_JSTest_007 * @tc.name: GetSingleSensor_JSTest_007
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it('GetSingleSensor_JSTest_007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('GetSingleSensor_JSTest_007', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("------------------GetSingleSensor_JSTest_007-------------------------"); console.info("------------------GetSingleSensor_JSTest_007-------------------------");
try { try {
...@@ -260,11 +260,11 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -260,11 +260,11 @@ describe("SensorJsTest_sensor_36", function () {
} }
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0080 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0080
* @tc.name: GetSingleSensor_JSTest_008 * @tc.name: GetSingleSensor_JSTest_008
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("GetSingleSensor_JSTest_008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("GetSingleSensor_JSTest_008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("------------------------GetSingleSensor_JSTest_008------------------"); console.info("------------------------GetSingleSensor_JSTest_008------------------");
try { try {
...@@ -284,11 +284,11 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -284,11 +284,11 @@ describe("SensorJsTest_sensor_36", function () {
} }
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0090 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0090
* @tc.name: GetSingleSensor_JSTest_009 * @tc.name: GetSingleSensor_JSTest_009
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("GetSingleSensor_JSTest_009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("GetSingleSensor_JSTest_009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("-------------------GetSingleSensor_JSTest_009----------------------"); console.info("-------------------GetSingleSensor_JSTest_009----------------------");
sensor.getSingleSensor(sensor.SensorId.ACCELEROMETER).then((data) => { sensor.getSingleSensor(sensor.SensorId.ACCELEROMETER).then((data) => {
...@@ -310,11 +310,11 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -310,11 +310,11 @@ describe("SensorJsTest_sensor_36", function () {
}); });
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0100 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0100
* @tc.name: GetSingleSensor_JSTest_010 * @tc.name: GetSingleSensor_JSTest_010
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("GetSingleSensor_JSTest_010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("GetSingleSensor_JSTest_010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("----------------GetSingleSensor_JSTest_010-----------------------"); console.info("----------------GetSingleSensor_JSTest_010-----------------------");
try { try {
...@@ -332,11 +332,11 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -332,11 +332,11 @@ describe("SensorJsTest_sensor_36", function () {
} }
}) })
/** /**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0110 * @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0110
* @tc.name: GetSingleSensor_JSTest_011 * @tc.name: GetSingleSensor_JSTest_011
* @tc.desc: Verification results of the incorrect parameters of the test interface. * @tc.desc: Verification results of the incorrect parameters of the test interface.
*/ */
it("GetSingleSensor_JSTest_011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("GetSingleSensor_JSTest_011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info("-------------------GetSingleSensor_JSTest_011----------------------"); console.info("-------------------GetSingleSensor_JSTest_011----------------------");
try { try {
...@@ -348,4 +348,55 @@ describe("SensorJsTest_sensor_36", function () { ...@@ -348,4 +348,55 @@ describe("SensorJsTest_sensor_36", function () {
done(); done();
} }
}) })
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0120
* @tc.name: GetSingleSensor_JSTest_012
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it("GetSingleSensor_JSTest_012", 0, async function (done) {
sensor.getSingleSensor(sensor.SensorId.ACCELEROMETER, undefined).then((data) => {
console.info("GetSingleSensor_JSTest_012 " + JSON.stringify(data));
expect(true).assertTrue();
done();
}, (error) => {
console.info('GetSingleSensor_JSTest_012 failed');
expect(false).assertTrue();
done();
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0130
* @tc.name: GetSingleSensor_JSTest_013
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it("GetSingleSensor_JSTest_013", 0, async function (done) {
sensor.getSingleSensor(sensor.SensorId.ACCELEROMETER, null).then((data) => {
console.info("GetSingleSensor_JSTest_013 " + JSON.stringify(data));
expect(true).assertTrue();
done();
}, (error) => {
console.info('GetSingleSensor_JSTest_013 failed');
expect(false).assertTrue();
done();
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0140
* @tc.name: GetSingleSensor_JSTest_014
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it("GetSingleSensor_JSTest_014", 0, async function (done) {
sensor.getSingleSensor(sensor.SensorId.ACCELEROMETER, "abc").then((data) => {
console.info("GetSingleSensor_JSTest_014 " + JSON.stringify(data));
expect(true).assertTrue();
done();
}, (error) => {
console.info('GetSingleSensor_JSTest_014 failed');
expect(false).assertTrue();
done();
});
})
})} })}
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_42", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_42", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_42", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_42", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -72,12 +72,12 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -72,12 +72,12 @@ describe("SensorJsTest_sensor_42", function () {
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JsTest_0140 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0010
* @tc.name: newGravity_SensorJsTest014 * @tc.name: newGravity_SensorJsTest001
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newGravity_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newGravity_SensorJsTest014--------------'); console.info('---------newGravity_SensorJsTest001--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
sensor.on(sensor.SensorId.GRAVITY, callback); sensor.on(sensor.SensorId.GRAVITY, callback);
...@@ -87,7 +87,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -87,7 +87,7 @@ describe("SensorJsTest_sensor_42", function () {
}, 500); }, 500);
}) })
} catch (error) { } catch (error) {
console.info('newGravity_SensorJsTest014 Device does not support! '); console.info('newGravity_SensorJsTest001 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -95,16 +95,16 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -95,16 +95,16 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0020
* @tc.name: newGravity_SensorJsTest015 * @tc.name: newGravity_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest015--------------'); console.info('---------newGravity_SensorJsTest002--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest014 error'); console.info('newGravity_SensorJsTest002 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback); sensor.on(sensor.SensorId.GRAVITY, callback);
...@@ -115,7 +115,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -115,7 +115,7 @@ describe("SensorJsTest_sensor_42", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newGravity_SensorJsTest014 Device does not support! '); console.info('newGravity_SensorJsTest002 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -123,20 +123,20 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -123,20 +123,20 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0030
* @tc.name: newGravity_SensorJsTest015 * @tc.name: newGravity_SensorJsTest003
* @tc.desc: Illegal ID passed in * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest015--------------'); console.info('---------newGravity_SensorJsTest003--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGravity_SensorJsTest015 callback in'); console.info('newGravity_SensorJsTest003 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest015 error:" + error); console.info("newGravity_SensorJsTest003 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -144,29 +144,29 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -144,29 +144,29 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0040
* @tc.name: newGravity_SensorJsTest016 * @tc.name: newGravity_SensorJsTest004
* @tc.desc: For normal scenarios * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest016--------------'); console.info('---------newGravity_SensorJsTest004--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest016 error'); console.info('newGravity_SensorJsTest004 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.GRAVITY, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGravity_SensorJsTest016 off in--------------'); console.info('---------newGravity_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.GRAVITY); sensor.off(sensor.SensorId.GRAVITY);
console.info('---------newGravity_SensorJsTest016 off end--------------'); console.info('---------newGravity_SensorJsTest004 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info('newGravity_SensorJsTest016 Device does not support! '); console.info('newGravity_SensorJsTest004 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -174,14 +174,14 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -174,14 +174,14 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0050
* @tc.name: newGravity_SensorJsTest017 * @tc.name: newGravity_SensorJsTest005
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGravity_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newGravity_SensorJsTest017--------------'); console.info('---------newGravity_SensorJsTest005--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGravity_SensorJsTest017 callback in'); console.info('newGravity_SensorJsTest005 callback in');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -190,20 +190,20 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -190,20 +190,20 @@ describe("SensorJsTest_sensor_42", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest017 error'); console.info('newGravity_SensorJsTest005 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.GRAVITY, onSensorCallback, {'interval': 100000000}, 5);
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGravity_SensorJsTest017 off in--------------'); console.info('---------newGravity_SensorJsTest005 off in--------------');
sensor.off(sensor.SensorId.GRAVITY); sensor.off(sensor.SensorId.GRAVITY);
console.info('---------newGravity_SensorJsTest017 off end--------------'); console.info('---------newGravity_SensorJsTest005 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest017 Device does not support! "); console.info("newGravity_SensorJsTest005 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -211,15 +211,15 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -211,15 +211,15 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0060
* @tc.name: newGravity_SensorJsTest018 * @tc.name: newGravity_SensorJsTest006
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest018 error'); console.info('newGravity_SensorJsTest006 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.GRAVITY, callback); sensor.once(sensor.SensorId.GRAVITY, callback);
...@@ -230,7 +230,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -230,7 +230,7 @@ describe("SensorJsTest_sensor_42", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest018 Device does not support! "); console.info("newGravity_SensorJsTest006 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -238,20 +238,20 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -238,20 +238,20 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0070
* @tc.name: newGravity_SensorJsTest019 * @tc.name: newGravity_SensorJsTest007
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newGravity_SensorJsTest019 callback in'); console.info('newGravity_SensorJsTest007 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest019 error:" +error); console.info("newGravity_SensorJsTest007 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -259,13 +259,13 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -259,13 +259,13 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0080
* @tc.name: newGravity_SensorJsTest020 * @tc.name: newGravity_SensorJsTest008
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGravity_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newGravity_SensorJsTest020 on error'); console.info('newGravity_SensorJsTest008 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -275,14 +275,14 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -275,14 +275,14 @@ describe("SensorJsTest_sensor_42", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest020 error'); console.info('newGravity_SensorJsTest008 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.GRAVITY, onceSensorCallback, 5); sensor.once(sensor.SensorId.GRAVITY, onceSensorCallback, 5);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest020 error:" +error); console.info("newGravity_SensorJsTest008 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -290,15 +290,15 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -290,15 +290,15 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0090
* @tc.name: newGravity_SensorJsTest021 * @tc.name: newGravity_SensorJsTest009
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newGravity_SensorJsTest021 Device does not support! '); console.info('newGravity_SensorJsTest009 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -306,20 +306,20 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -306,20 +306,20 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0100
* @tc.name: newGravity_SensorJsTest022 * @tc.name: newGravity_SensorJsTest010
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGravity_SensorJsTest022 callback in'); console.info('newGravity_SensorJsTest010 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest022 error'); console.info('newGravity_SensorJsTest010 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, onSensorCallback); sensor.on(sensor.SensorId.GRAVITY, onSensorCallback);
...@@ -331,7 +331,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -331,7 +331,7 @@ describe("SensorJsTest_sensor_42", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest022 error:" +error); console.info("newGravity_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -339,19 +339,19 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -339,19 +339,19 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0110
* @tc.name: newGravity_SensorJsTest023 * @tc.name: newGravity_SensorJsTest011
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGravity_SensorJsTest023 on error'); console.info('newGravity_SensorJsTest011 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest023 error:" +error); console.info("newGravity_SensorJsTest011 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -359,41 +359,41 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -359,41 +359,41 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0120
* @tc.name: newGravity_SensorJsTest024 * @tc.name: newGravity_SensorJsTest012
* @tc.desc:Call interface multiple times * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest024 error'); console.info('newGravity_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, (data)=>{ sensor.on(sensor.SensorId.GRAVITY, (data)=>{
console.info("newGravity_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest012 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.GRAVITY, (data)=>{ sensor.on(sensor.SensorId.GRAVITY, (data)=>{
console.info("newGravity_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest012 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGravity_SensorJsTest024 off in--------------'); console.info('---------newGravity_SensorJsTest012 off in--------------');
sensor.off(sensor.SensorId.GRAVITY); sensor.off(sensor.SensorId.GRAVITY);
console.info('---------newGravity_SensorJsTest024 off end--------------'); console.info('---------newGravity_SensorJsTest012 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest024 Device does not support! "); console.info("newGravity_SensorJsTest012 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -401,12 +401,12 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -401,12 +401,12 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0130
* @tc.name: newGravity_SensorJsTest025 * @tc.name: newGravity_SensorJsTest013
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newGravity_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newGravity_SensorJsTest025--------------'); console.info('---------newGravity_SensorJsTest013--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
sensor.on(sensor.SensorId.GRAVITY, callback); sensor.on(sensor.SensorId.GRAVITY, callback);
...@@ -416,7 +416,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -416,7 +416,7 @@ describe("SensorJsTest_sensor_42", function () {
}, 500); }, 500);
}) })
} catch (error) { } catch (error) {
console.info('newGravity_SensorJsTest025 Device does not support! '); console.info('newGravity_SensorJsTest013 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -424,42 +424,42 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -424,42 +424,42 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0140
* @tc.name: newGravity_SensorJsTest026 * @tc.name: newGravity_SensorJsTest014
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest026--------------'); console.info('---------newGravity_SensorJsTest014--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest024 error'); console.info('newGravity_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, (data)=>{ sensor.on(sensor.SensorId.GRAVITY, (data)=>{
console.info("newGravity_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.GRAVITY, (data)=>{ sensor.once(sensor.SensorId.GRAVITY, (data)=>{
console.info("newGravity_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGravity_SensorJsTest026 off in--------------'); console.info('---------newGravity_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.GRAVITY); sensor.off(sensor.SensorId.GRAVITY);
console.info('---------newGravity_SensorJsTest026 off end--------------'); console.info('---------newGravity_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest026 Device does not support! "); console.info("newGravity_SensorJsTest014 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -467,42 +467,42 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -467,42 +467,42 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0150
* @tc.name: newGravity_SensorJsTest027 * @tc.name: newGravity_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest027--------------'); console.info('---------newGravity_SensorJsTest015--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest024 error'); console.info('newGravity_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, (data)=>{ sensor.on(sensor.SensorId.GRAVITY, (data)=>{
console.info("newGravity_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest015 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.GRAVITY, (data)=>{ sensor.on(sensor.SensorId.GRAVITY, (data)=>{
console.info("newGravity_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest015 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGravity_SensorJsTest027 off in--------------'); console.info('---------newGravity_SensorJsTest015 off in--------------');
sensor.off(sensor.SensorId.GRAVITY); sensor.off(sensor.SensorId.GRAVITY);
console.info('---------newGravity_SensorJsTest027 off end--------------'); console.info('---------newGravity_SensorJsTest015 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest027 Device does not support! "); console.info("newGravity_SensorJsTest015 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -510,16 +510,16 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -510,16 +510,16 @@ describe("SensorJsTest_sensor_42", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0160
* @tc.name: newGravity_SensorJsTest028 * @tc.name: newGravity_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest028--------------'); console.info('---------newGravity_SensorJsTest016--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest028_on error:" +error); console.info("newGravity_SensorJsTest016 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -527,7 +527,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -527,7 +527,7 @@ describe("SensorJsTest_sensor_42", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest028_once error:" +error); console.info("newGravity_SensorJsTest016_once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -535,113 +535,112 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -535,113 +535,112 @@ describe("SensorJsTest_sensor_42", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest028_off error:" +error); console.info("newGravity_SensorJsTest016_off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/* /*
* @tc.number: SUB_SensorsSystem_GRAVITY_JSTest_0290 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0170
* @tc.name: newGravity_SensorJsTest029 * @tc.name: newGravity_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newGravity_SensorJsTest029--------------'); console.info('----------------------newGravity_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest029 error'); console.info('newGravity_SensorJsTest017 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback); sensor.on(sensor.SensorId.GRAVITY, callback);
sensor.on(sensor.SensorId.GRAVITY, callback2); sensor.on(sensor.SensorId.GRAVITY, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest029 off in--------------'); console.info('----------------------newGravity_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.GRAVITY, callback); sensor.off(sensor.SensorId.GRAVITY, callback);
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest029 error:" + error); console.info("newGravity_SensorJsTest017 error:" + error);
} }
console.info('----------------------newGravity_SensorJsTest029 off end--------------'); console.info('----------------------newGravity_SensorJsTest017 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest029 off in--------------'); console.info('----------------------newGravity_SensorJsTest017 off in--------------');
sensor.off(sensor.SensorId.GRAVITY, callback2); sensor.off(sensor.SensorId.GRAVITY, callback2);
console.info('----------------------newGravity_SensorJsTest029 off end--------------'); console.info('----------------------newGravity_SensorJsTest017 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest029 Device does not support! "); console.info("newGravity_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/* /*
* @tc.number: SUB_SensorsSystem_GRAVITY_JSTest_0300 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0180
* @tc.name: newGravity_SensorJsTest030 * @tc.name: newGravity_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newGravity_SensorJsTest030--------------'); console.info('----------------------newGravity_SensorJsTest018--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest029 error'); console.info('newGravity_SensorJsTest018 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.GRAVITY, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.GRAVITY, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.GRAVITY, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest030 off in--------------'); console.info('----------------------newGravity_SensorJsTest018 off in--------------');
try { try {
sensor.off(sensor.SensorId.GRAVITY, callback); sensor.off(sensor.SensorId.GRAVITY, callback);
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest030 error:" + error); console.info("newGravity_SensorJsTest018 error:" + error);
} }
console console.info('----------------------newGravity_SensorJsTest018 off end--------------');
console.info('----------------------newGravity_SensorJsTest030 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest030_2 off in--------------'); console.info('----------------------newGravity_SensorJsTest018_2 off in--------------');
sensor.off(sensor.SensorId.GRAVITY, callback2); sensor.off(sensor.SensorId.GRAVITY, callback2);
console.info('----------------------newGravity_SensorJsTest030_2 off end--------------'); console.info('----------------------newGravity_SensorJsTest018_2 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest030 Device does not support! "); console.info("newGravity_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/* /*
* @tc.number: SUB_SensorsSystem_GRAVITY_JSTest_0310 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0190
* @tc.name: newGravity_SensorJsTest031 * @tc.name: newGravity_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newGravity_SensorJsTest031--------------'); console.info('----------------------newGravity_SensorJsTest019--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest031 error'); console.info('newGravity_SensorJsTest019 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
console.info('----------------------newGravity_SensorJsTest031 off in--------------'); console.info('----------------------newGravity_SensorJsTest019 off in--------------');
try{ try{
sensor.off(-1, callback); sensor.off(-1, callback);
console.info('----------------------newGravity_SensorJsTest031 off end--------------'); console.info('----------------------newGravity_SensorJsTest019 off end--------------');
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest031 error:" + error); console.info("newGravity_SensorJsTest019 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -649,33 +648,33 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -649,33 +648,33 @@ describe("SensorJsTest_sensor_42", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest031 Device does not support! "); console.info("newGravity_SensorJsTest019 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/* /*
* @tc.number: SUB_SensorsSystem_GRAVITY_JSTest_0320 * @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0200
* @tc.name: newGravity_SensorJsTest032 * @tc.name: newGravity_SensorJsTest020
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newGravity_SensorJsTest032--------------'); console.info('----------------------newGravity_SensorJsTest020--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) { if (error) {
console.info('newGravity_SensorJsTest032 error'); console.info('newGravity_SensorJsTest020 error');
} else { } else {
try { try {
sensor.on(sensor.SensorId.GRAVITY, callback, {'interval': -100000000}); sensor.on(sensor.SensorId.GRAVITY, callback, {'interval': -100000000});
console.info('----------------------newGravity_SensorJsTest032 off in---------------------------'); console.info('----------------------newGravity_SensorJsTest020 off in---------------------------');
sensor.off(sensor.SensorId.GRAVITY); sensor.off(sensor.SensorId.GRAVITY);
console.info('----------------------newGravity_SensorJsTest032 off end---------------------------'); console.info('----------------------newGravity_SensorJsTest020 off end---------------------------');
done(); done();
} catch (error) { } catch (error) {
console.info('newGravity_SensorJsTest032 On fail, errCode:' + error.code + ' ,msg:' + error.message); console.info('newGravity_SensorJsTest020 On fail, errCode:' + error.code + ' ,msg:' + error.message);
expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE);
expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG); expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG);
done(); done();
...@@ -683,10 +682,220 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -683,10 +682,220 @@ describe("SensorJsTest_sensor_42", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newGravity_SensorJsTest032 Device does not support! "); console.info("newGravity_SensorJsTest020 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0210
* @tc.name: newGravity_SensorJsTest021
* @tc.desc: Functional Use Cases
*/
it("newGravity_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newGravity_SensorJsTest021--------------');
try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
sensor.on(sensor.SensorId.GRAVITY, callback);
setTimeout(()=>{
sensor.off(sensor.SensorId.GRAVITY);
done();
}, 500);
})
} catch (error) {
console.info('newGravity_SensorJsTest021 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0220
* @tc.name: newGravity_SensorJsTest022
* @tc.desc: Functional Use Cases
*/
it("newGravity_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) {
console.info('newGravity_SensorJsTest022 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback, undefined);
try{
sensor.on(sensor.SensorId.GRAVITY, callback, { 'interval': undefined });
} catch(error){
console.info('newGravity_SensorJsTest022 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest022 off in--------------');
try {
sensor.off(sensor.SensorId.GRAVITY);
} catch (error) {
console.info("newGravity_SensorJsTest022 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newGravity_SensorJsTest022 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0230
* @tc.name: newGravity_SensorJsTest023
* @tc.desc: Functional Use Cases
*/
it("newGravity_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest023--------------');
try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) {
console.info('newGravity_SensorJsTest023 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback, null);
try{
sensor.on(sensor.SensorId.GRAVITY, callback, { 'interval': null });
} catch(error){
console.info('newGravity_SensorJsTest023 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.GRAVITY);
} catch (error) {
console.info("newGravity_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newGravity_SensorJsTest023 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0240
* @tc.name: newGravity_SensorJsTest024
* @tc.desc: Functional Use Cases
*/
it("newGravity_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newGravity_SensorJsTest024--------------');
try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) {
console.info('newGravity_SensorJsTest024 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest024 off in--------------');
try {
sensor.off(sensor.SensorId.GRAVITY);
} catch (error) {
console.info("newGravity_SensorJsTest024 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("newGravity_SensorJsTest024 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0250
* @tc.name: newGravity_SensorJsTest025
* @tc.desc: Functional Use Cases
*/
it("newGravity_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) {
console.info('newGravity_SensorJsTest025 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.GRAVITY, callback, { 'interval': 100000000 });
} catch(error){
console.info("newGravity_SensorJsTest025 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest025 off in--------------');
try {
sensor.off(sensor.SensorId.GRAVITY);
} catch (error) {
console.info("newGravity_SensorJsTest025 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newGravity_SensorJsTest025 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("newGravity_SensorJsTest025 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGRAVITY_JsTest_0260
* @tc.name: newGravity_SensorJsTest026
* @tc.desc: Functional Use Cases
*/
it("newGravity_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newGravity_SensorJsTest026--------------');
try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
if (error) {
console.info('newGravity_SensorJsTest026 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.GRAVITY, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newGravity_SensorJsTest026 off in--------------');
try {
sensor.off(sensor.SensorId.GRAVITY, callback);
sensor.off(sensor.SensorId.GRAVITY, callback2);
} catch (error) {
console.info("newGravity_SensorJsTest026 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newGravity_SensorJsTest026 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('newGravity_SensorJsTest026 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_43", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_43", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_43", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_43", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -72,16 +72,16 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -72,16 +72,16 @@ describe("SensorJsTest_sensor_43", function () {
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0140 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0010
* @tc.name: newGyroScope_SensorJsTest014 * @tc.name: newGyroScope_SensorJsTest001
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newGyroScope_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newGyroScope_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newGyroScope_SensorJsTest014--------------'); console.info('---------newGyroScope_SensorJsTest001--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest014 error'); console.info('newGyroScope_SensorJsTest001 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback); sensor.on(sensor.SensorId.GYROSCOPE, callback);
...@@ -92,7 +92,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -92,7 +92,7 @@ describe("SensorJsTest_sensor_43", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newGyroScope_SensorJsTest014 Device does not support! '); console.info('newGyroScope_SensorJsTest001 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -100,20 +100,20 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -100,20 +100,20 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0020
* @tc.name: newGyroScope_SensorJsTest015 * @tc.name: newGyroScope_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newGyroScope_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGyroScope_SensorJsTest015--------------'); console.info('---------newGyroScope_SensorJsTest002--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGyroScope_SensorJsTest015 callback in'); console.info('newGyroScope_SensorJsTest002 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest015 error:" + error); console.info("newGyroScope_SensorJsTest002 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -121,29 +121,29 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -121,29 +121,29 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0030
* @tc.name: newGyroScope_SensorJsTest016 * @tc.name: newGyroScope_SensorJsTest003
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newGyroScope_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGyroScope_SensorJsTest016--------------'); console.info('---------newGyroScope_SensorJsTest003--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest016 error'); console.info('newGyroScope_SensorJsTest003 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.GYROSCOPE, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGyroScope_SensorJsTest016 off in--------------'); console.info('---------newGyroScope_SensorJsTest003 off in--------------');
sensor.off(sensor.SensorId.GYROSCOPE); sensor.off(sensor.SensorId.GYROSCOPE);
console.info('---------newGyroScope_SensorJsTest016 off end--------------'); console.info('---------newGyroScope_SensorJsTest003 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info('newGyroScope_SensorJsTest016 Device does not support! '); console.info('newGyroScope_SensorJsTest003 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -151,14 +151,14 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -151,14 +151,14 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0040
* @tc.name: newGyroScope_SensorJsTest017 * @tc.name: newGyroScope_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGyroScope_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newGyroScope_SensorJsTest017--------------'); console.info('---------newGyroScope_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGyroScope_SensorJsTest017 callback in'); console.info('newGyroScope_SensorJsTest004 callback in');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -167,20 +167,20 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -167,20 +167,20 @@ describe("SensorJsTest_sensor_43", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest017 error'); console.info('newGyroScope_SensorJsTest004 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.GYROSCOPE, onSensorCallback, {'interval': 100000000}, 5);
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGyroScope_SensorJsTest017 off in--------------'); console.info('---------newGyroScope_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.GYROSCOPE); sensor.off(sensor.SensorId.GYROSCOPE);
console.info('---------newGyroScope_SensorJsTest017 off end--------------'); console.info('---------newGyroScope_SensorJsTest004 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest017 Device does not support! "); console.info("newGyroScope_SensorJsTest004 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -188,15 +188,15 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -188,15 +188,15 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0050
* @tc.name: newGyroScope_SensorJsTest018 * @tc.name: newGyroScope_SensorJsTest005
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newGyroScope_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest018 error'); console.info('newGyroScope_SensorJsTest005 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.GYROSCOPE, callback); sensor.once(sensor.SensorId.GYROSCOPE, callback);
...@@ -207,7 +207,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -207,7 +207,7 @@ describe("SensorJsTest_sensor_43", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest018 Device does not support! "); console.info("newGyroScope_SensorJsTest005 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -215,20 +215,20 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -215,20 +215,20 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0060
* @tc.name: newGyroScope_SensorJsTest019 * @tc.name: newGyroScope_SensorJsTest006
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Use case of illegal parameter passed into once interface
*/ */
it("newGyroScope_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newGyroScope_SensorJsTest019 callback in'); console.info('newGyroScope_SensorJsTest006 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest019 error:" +error); console.info("newGyroScope_SensorJsTest006 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -236,13 +236,13 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -236,13 +236,13 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0070
* @tc.name: newGyroScope_SensorJsTest020 * @tc.name: newGyroScope_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGyroScope_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newGyroScope_SensorJsTest020 on error'); console.info('newGyroScope_SensorJsTest007 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -252,14 +252,14 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -252,14 +252,14 @@ describe("SensorJsTest_sensor_43", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest020 error'); console.info('newGyroScope_SensorJsTest007 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.GYROSCOPE, onceSensorCallback, 5); sensor.once(sensor.SensorId.GYROSCOPE, onceSensorCallback, 5);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest020 error:" +error); console.info("newGyroScope_SensorJsTest007 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -267,15 +267,15 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -267,15 +267,15 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0080
* @tc.name: newGyroScope_SensorJsTest021 * @tc.name: newGyroScope_SensorJsTest008
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Use case of illegal parameter passed into off interface
*/ */
it("newGyroScope_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newGyroScope_SensorJsTest021 Device does not support! '); console.info('newGyroScope_SensorJsTest008 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -283,20 +283,20 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -283,20 +283,20 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0090
* @tc.name: newGyroScope_SensorJsTest022 * @tc.name: newGyroScope_SensorJsTest009
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Unsubscribe directly without waiting after starting subscription
*/ */
it("newGyroScope_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGyroScope_SensorJsTest022 callback in'); console.info('newGyroScope_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest022 error'); console.info('newGyroScope_SensorJsTest009 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, onSensorCallback); sensor.on(sensor.SensorId.GYROSCOPE, onSensorCallback);
...@@ -308,7 +308,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -308,7 +308,7 @@ describe("SensorJsTest_sensor_43", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest022 error:" +error); console.info("newGyroScope_SensorJsTest009 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -316,19 +316,19 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -316,19 +316,19 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0100
* @tc.name: newGyroScope_SensorJsTest023 * @tc.name: newGyroScope_SensorJsTest010
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newGyroScope_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGyroScope_SensorJsTest023 on error'); console.info('newGyroScope_SensorJsTest010 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest023 error:" +error); console.info("newGyroScope_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -336,41 +336,41 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -336,41 +336,41 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0110
* @tc.name: newGyroScope_SensorJsTest024 * @tc.name: newGyroScope_SensorJsTest011
* @tc.desc:Call interface multiple times * @tc.desc:Call interface multiple times
*/ */
it("newGyroScope_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest024 error'); console.info('newGyroScope_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{ sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{
console.info("newGyroScope_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newGyroScope_SensorJsTest011 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{ sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{
console.info("newGyroScope_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newGyroScope_SensorJsTest011 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGyroScope_SensorJsTest024 off in--------------'); console.info('---------newGyroScope_SensorJsTest011 off in--------------');
sensor.off(sensor.SensorId.GYROSCOPE); sensor.off(sensor.SensorId.GYROSCOPE);
console.info('---------newGyroScope_SensorJsTest024 off end--------------'); console.info('---------newGyroScope_SensorJsTest011 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest024 Device does not support! "); console.info("newGyroScope_SensorJsTest011 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -378,16 +378,16 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -378,16 +378,16 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0120
* @tc.name: newGyroScope_SensorJsTest025 * @tc.name: newGravity_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newGravity_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newGyroScope_SensorJsTest025--------------'); console.info('---------newGravity_SensorJsTest012--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest025 error'); console.info('newGravity_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback); sensor.on(sensor.SensorId.GYROSCOPE, callback);
...@@ -398,7 +398,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -398,7 +398,7 @@ describe("SensorJsTest_sensor_43", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newGyroScope_SensorJsTest025 Device does not support! '); console.info('newGravity_SensorJsTest012 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -406,42 +406,42 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -406,42 +406,42 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0130
* @tc.name: newGyroScope_SensorJsTest026 * @tc.name: newGravity_SensorJsTest013
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc:Call on interface and once interface respectively, and use an off interface to close
*/ */
it("newGyroScope_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGyroScope_SensorJsTest026--------------'); console.info('---------newGravity_SensorJsTest013--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest024 error'); console.info('newGyroScope_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{ sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{
console.info("newGyroScope_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest013 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.GYROSCOPE, (data)=>{ sensor.once(sensor.SensorId.GYROSCOPE, (data)=>{
console.info("newGyroScope_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest013 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGyroScope_SensorJsTest026 off in--------------'); console.info('---------newGravity_SensorJsTest013 off in--------------');
sensor.off(sensor.SensorId.GYROSCOPE); sensor.off(sensor.SensorId.GYROSCOPE);
console.info('---------newGyroScope_SensorJsTest026 off end--------------'); console.info('---------newGravity_SensorJsTest013 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest026 Device does not support! "); console.info("newGravity_SensorJsTest013 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -449,42 +449,42 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -449,42 +449,42 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0140
* @tc.name: newGyroScope_SensorJsTest027 * @tc.name: newGravity_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGyroScope_SensorJsTest027--------------'); console.info('---------newGravity_SensorJsTest014--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest024 error'); console.info('newGyroScope_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{ sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{
console.info("newGyroScope_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{ sensor.on(sensor.SensorId.GYROSCOPE, (data)=>{
console.info("newGyroScope_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newGravity_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newGyroScope_SensorJsTest027 off in--------------'); console.info('---------newGravity_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.GYROSCOPE); sensor.off(sensor.SensorId.GYROSCOPE);
console.info('---------newGyroScope_SensorJsTest027 off end--------------'); console.info('---------newGravity_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest027 Device does not support! "); console.info("newGravity_SensorJsTest014 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -492,16 +492,16 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -492,16 +492,16 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0150
* @tc.name: newGyroScope_SensorJsTest028 * @tc.name: newGravity_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGyroScope_SensorJsTest028--------------'); console.info('---------newGravity_SensorJsTest015--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest028_on error:" +error); console.info("newGravity_SensorJsTest015_on error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -509,7 +509,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -509,7 +509,7 @@ describe("SensorJsTest_sensor_43", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest028_once error:" +error); console.info("newGravity_SensorJsTest015_once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -517,7 +517,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -517,7 +517,7 @@ describe("SensorJsTest_sensor_43", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest028_off error:" +error); console.info("newGravity_SensorJsTest015_off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -525,39 +525,39 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -525,39 +525,39 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_GYROSCOPE_JSTest_0290 * @tc.number: SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0160
* @tc.name: newGyroScope_SensorJsTest029 * @tc.name: newGravity_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newGyroScope_SensorJsTest029--------------'); console.info('----------------------newGravity_SensorJsTest016--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest029 error'); console.info('newGravity_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback); sensor.on(sensor.SensorId.GYROSCOPE, callback);
sensor.on(sensor.SensorId.GYROSCOPE, callback2); sensor.on(sensor.SensorId.GYROSCOPE, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest029 off in--------------'); console.info('----------------------newGravity_SensorJsTest016 off in--------------');
try { try {
sensor.off(sensor.SensorId.GYROSCOPE, callback); sensor.off(sensor.SensorId.GYROSCOPE, callback);
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest029 error:" + error); console.info("newGravity_SensorJsTest016 error:" + error);
} }
console.info('----------------------newGyroScope_SensorJsTest029 off end--------------'); console.info('----------------------newGravity_SensorJsTest016 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest029 off in--------------'); console.info('----------------------newGravity_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.GYROSCOPE, callback2); sensor.off(sensor.SensorId.GYROSCOPE, callback2);
console.info('----------------------newGyroScope_SensorJsTest029 off end--------------'); console.info('----------------------newGravity_SensorJsTest016 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest029 Device does not support! "); console.info("newGravity_SensorJsTest016 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -565,40 +565,39 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -565,40 +565,39 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_GYROSCOPE_JSTest_0300 * @tc.number: SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0170
* @tc.name: newGyroScope_SensorJsTest030 * @tc.name: newGravity_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newGyroScope_SensorJsTest030--------------'); console.info('----------------------newGravity_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest029 error'); console.info('newGravity_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.GYROSCOPE, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.GYROSCOPE, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.GYROSCOPE, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest030 off in--------------'); console.info('----------------------newGravity_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.GYROSCOPE, callback); sensor.off(sensor.SensorId.GYROSCOPE, callback);
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest030 error:" + error); console.info("newGravity_SensorJsTest017 error:" + error);
} }
console console.info('----------------------newGravity_SensorJsTest017 off end--------------');
console.info('----------------------newGyroScope_SensorJsTest030 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest030_2 off in--------------'); console.info('----------------------newGravity_SensorJsTest017_2 off in--------------');
sensor.off(sensor.SensorId.GYROSCOPE, callback2); sensor.off(sensor.SensorId.GYROSCOPE, callback2);
console.info('----------------------newGyroScope_SensorJsTest030_2 off end--------------'); console.info('----------------------newGravity_SensorJsTest017_2 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest030 Device does not support! "); console.info("newGravity_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -606,24 +605,24 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -606,24 +605,24 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_GYROSCOPE_JSTest_0310 * @tc.number: SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0180
* @tc.name: newGyroScope_SensorJsTest031 * @tc.name: newGravity_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newGyroScope_SensorJsTest031--------------'); console.info('----------------------newGravity_SensorJsTest018--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest031 error'); console.info('newGravity_SensorJsTest018 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
console.info('----------------------newGyroScope_SensorJsTest031 off in--------------'); console.info('----------------------newGravity_SensorJsTest018 off in--------------');
try{ try{
sensor.off(-1, callback); sensor.off(-1, callback);
console.info('----------------------newGyroScope_SensorJsTest031 off end--------------'); console.info('----------------------newGravity_SensorJsTest018 off end--------------');
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest031 error:" + error); console.info("newGravity_SensorJsTest018 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -631,7 +630,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -631,7 +630,7 @@ describe("SensorJsTest_sensor_43", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest031 Device does not support! "); console.info("newGravity_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -639,25 +638,25 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -639,25 +638,25 @@ describe("SensorJsTest_sensor_43", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_GYROSCOPE_JSTest_0320 * @tc.number: SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0190
* @tc.name: newGyroScope_SensorJsTest032 * @tc.name: newGravity_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newGyroScope_SensorJsTest032--------------'); console.info('----------------------newGravity_SensorJsTest019--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) { if (error) {
console.info('newGyroScope_SensorJsTest032 error'); console.info('newGravity_SensorJsTest019 error');
} else { } else {
try { try {
sensor.on(sensor.SensorId.GYROSCOPE, callback, {'interval': -100000000}); sensor.on(sensor.SensorId.GYROSCOPE, callback, {'interval': -100000000});
console.info('----------------------newGyroScope_SensorJsTest032 off in---------------------------'); console.info('----------------------newGravity_SensorJsTest019 off in---------------------------');
sensor.off(sensor.SensorId.GYROSCOPE); sensor.off(sensor.SensorId.GYROSCOPE);
console.info('----------------------newGyroScope_SensorJsTest032 off end---------------------------'); console.info('----------------------newGravity_SensorJsTest019 off end---------------------------');
done(); done();
} catch (error) { } catch (error) {
console.info('newGyroScope_SensorJsTest032 On fail, errCode:' + error.code + ' ,msg:' + error.message); console.info('newGravity_SensorJsTest019 On fail, errCode:' + error.code + ' ,msg:' + error.message);
expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE);
expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG); expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG);
done(); done();
...@@ -665,10 +664,197 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -665,10 +664,197 @@ describe("SensorJsTest_sensor_43", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newGyroScope_SensorJsTest032 Device does not support! "); console.info("newGravity_SensorJsTest019 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0200
* @tc.name: newGyroScope_SensorJsTest020
* @tc.desc: Functional Use Cases
*/
it("newGyroScope_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newGyroScope_SensorJsTest020--------------');
try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) {
console.info('newGyroScope_SensorJsTest020 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.GYROSCOPE, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest020 off in--------------');
try {
sensor.off(sensor.SensorId.GYROSCOPE, callback);
sensor.off(sensor.SensorId.GYROSCOPE, callback2);
} catch (error) {
console.info("newGyroScope_SensorJsTest020 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newGyroScope_SensorJsTest020 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('newGyroScope_SensorJsTest020 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0210
* @tc.name: newGyroScope_SensorJsTest021
* @tc.desc: Illegal ID passed in
*/
it("newGyroScope_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) {
console.info('newGyroScope_SensorJsTest021 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback, undefined);
try{
sensor.on(sensor.SensorId.GYROSCOPE, callback, { 'interval': undefined });
} catch(error){
console.info('newGyroScope_SensorJsTest021 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest021 off in--------------');
try {
sensor.off(sensor.SensorId.GYROSCOPE);
} catch (error) {
console.info("newGyroScope_SensorJsTest021 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newGyroScope_SensorJsTest021 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0220
* @tc.name: newGyroScope_SensorJsTest022
* @tc.desc: For normal scenarios
*/
it("newGyroScope_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGyroScope_SensorJsTest022--------------');
try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) {
console.info('newGyroScope_SensorJsTest022 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback, null);
try{
sensor.on(sensor.SensorId.GYROSCOPE, callback, { 'interval': null });
} catch(error){
console.info('newGyroScope_SensorJsTest022 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest022 off in--------------');
try {
sensor.off(sensor.SensorId.GYROSCOPE);
} catch (error) {
console.info("newGyroScope_SensorJsTest022 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newGyroScope_SensorJsTest022 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0230
* @tc.name: newGyroScope_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newGyroScope_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newGyroScope_SensorJsTest023--------------');
try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) {
console.info('newGyroScope_SensorJsTest023 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.GYROSCOPE);
} catch (error) {
console.info("newGyroScope_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("newGyroScope_SensorJsTest023 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWGYROSCOPE_JSTest_0240
* @tc.name: newGyroScope_SensorJsTest024
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("newGyroScope_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
if (error) {
console.info('newGyroScope_SensorJsTest024 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.GYROSCOPE, callback, { 'interval': 100000000 });
} catch(error){
console.info("newGyroScope_SensorJsTest024 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newGyroScope_SensorJsTest024 off in--------------');
try {
sensor.off(sensor.SensorId.GYROSCOPE);
} catch (error) {
console.info("newGyroScope_SensorJsTest024 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newGyroScope_SensorJsTest024 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("newGyroScope_SensorJsTest024 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_44", function () { ...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_44", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_44", function () { ...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_44", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_44", function () { ...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_44", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_44", function () { ...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_44", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_45", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_45", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_45", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_45", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -68,16 +68,16 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -68,16 +68,16 @@ describe("SensorJsTest_sensor_45", function () {
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0140 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0010
* @tc.name: newHall_SensorJsTest014 * @tc.name: newHall_SensorJsTest001
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newHall_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newHall_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newHall_SensorJsTest014--------------'); console.info('---------newHall_SensorJsTest001--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest014 error'); console.info('newHall_SensorJsTest001 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback); sensor.on(sensor.SensorId.HALL, callback);
...@@ -88,7 +88,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -88,7 +88,7 @@ describe("SensorJsTest_sensor_45", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newHall_SensorJsTest014 Device does not support! '); console.info('newHall_SensorJsTest001 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -96,20 +96,20 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -96,20 +96,20 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0020
* @tc.name: newHall_SensorJsTest015 * @tc.name: newHall_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newHall_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newHall_SensorJsTest015--------------'); console.info('---------newHall_SensorJsTest002--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newHall_SensorJsTest015 callback in'); console.info('newHall_SensorJsTest002 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest015 error:" + error); console.info("newHall_SensorJsTest002 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -117,29 +117,29 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -117,29 +117,29 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0030
* @tc.name: newHall_SensorJsTest016 * @tc.name: newHall_SensorJsTest003
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newHall_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newHall_SensorJsTest016--------------'); console.info('---------newHall_SensorJsTest003--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest016 error'); console.info('newHall_SensorJsTest003 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.HALL, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newHall_SensorJsTest016 off in--------------'); console.info('---------newHall_SensorJsTest003 off in--------------');
sensor.off(sensor.SensorId.HALL); sensor.off(sensor.SensorId.HALL);
console.info('---------newHall_SensorJsTest016 off end--------------'); console.info('---------newHall_SensorJsTest003 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info('newHall_SensorJsTest016 Device does not support! '); console.info('newHall_SensorJsTest003 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -147,34 +147,34 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -147,34 +147,34 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0040
* @tc.name: newHall_SensorJsTest017 * @tc.name: newHall_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newHall_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newHall_SensorJsTest017--------------'); console.info('---------newHall_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newHall_SensorJsTest017 callback in'); console.info('newHall_SensorJsTest004 callback in');
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest017 error'); console.info('newHall_SensorJsTest004 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.HALL, onSensorCallback, {'interval': 100000000}, 5);
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newHall_SensorJsTest017 off in--------------'); console.info('---------newHall_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.HALL); sensor.off(sensor.SensorId.HALL);
console.info('---------newHall_SensorJsTest017 off end--------------'); console.info('---------newHall_SensorJsTest004 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest017 Device does not support! "); console.info("newHall_SensorJsTest004 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -182,15 +182,15 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -182,15 +182,15 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0050
* @tc.name: newHall_SensorJsTest018 * @tc.name: newHall_SensorJsTest005
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newHall_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest018 error'); console.info('newHall_SensorJsTest005 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.HALL, callback); sensor.once(sensor.SensorId.HALL, callback);
...@@ -201,7 +201,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -201,7 +201,7 @@ describe("SensorJsTest_sensor_45", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest018 Device does not support! "); console.info("newHall_SensorJsTest005 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -209,20 +209,20 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -209,20 +209,20 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0060
* @tc.name: newHall_SensorJsTest019 * @tc.name: newHall_SensorJsTest006
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Use case of illegal parameter passed into once interface
*/ */
it("newHall_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newHall_SensorJsTest019 callback in'); console.info('newHall_SensorJsTest006 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest019 error:" +error); console.info("newHall_SensorJsTest006 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -230,13 +230,13 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -230,13 +230,13 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0070
* @tc.name: newHall_SensorJsTest020 * @tc.name: newHall_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newHall_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newHall_SensorJsTest020 on error'); console.info('newHall_SensorJsTest007 on error');
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
done(); done();
...@@ -244,14 +244,14 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -244,14 +244,14 @@ describe("SensorJsTest_sensor_45", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest020 error'); console.info('newHall_SensorJsTest007 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.HALL, onceSensorCallback, 5); sensor.once(sensor.SensorId.HALL, onceSensorCallback, 5);
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest020 error:" +error); console.info("newHall_SensorJsTest007 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -259,15 +259,15 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -259,15 +259,15 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0080
* @tc.name: newHall_SensorJsTest021 * @tc.name: newHall_SensorJsTest008
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Use case of illegal parameter passed into off interface
*/ */
it("newHall_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newHall_SensorJsTest021 Device does not support! '); console.info('newHall_SensorJsTest008 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -275,20 +275,20 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -275,20 +275,20 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0090
* @tc.name: newHall_SensorJsTest022 * @tc.name: newHall_SensorJsTest009
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Unsubscribe directly without waiting after starting subscription
*/ */
it("newHall_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newHall_SensorJsTest022 callback in'); console.info('newHall_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest022 error'); console.info('newHall_SensorJsTest009 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, onSensorCallback); sensor.on(sensor.SensorId.HALL, onSensorCallback);
...@@ -300,7 +300,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -300,7 +300,7 @@ describe("SensorJsTest_sensor_45", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest022 error:" +error); console.info("newHall_SensorJsTest009 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -308,19 +308,19 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -308,19 +308,19 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0100
* @tc.name: newHall_SensorJsTest023 * @tc.name: newHall_SensorJsTest010
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newHall_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newHall_SensorJsTest023 on error'); console.info('newHall_SensorJsTest010 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest023 error:" +error); console.info("newHall_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -328,37 +328,37 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -328,37 +328,37 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0110
* @tc.name: newHall_SensorJsTest024 * @tc.name: newHall_SensorJsTest011
* @tc.desc:Call interface multiple times * @tc.desc:Call interface multiple times
*/ */
it("newHall_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest024 error'); console.info('newHall_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, (data)=>{ sensor.on(sensor.SensorId.HALL, (data)=>{
console.info("newHall_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newHall_SensorJsTest011 callback: " + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.HALL, (data)=>{ sensor.on(sensor.SensorId.HALL, (data)=>{
console.info("newHall_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newHall_SensorJsTest011 callback2: " + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newHall_SensorJsTest024 off in--------------'); console.info('---------newHall_SensorJsTest011 off in--------------');
sensor.off(sensor.SensorId.HALL); sensor.off(sensor.SensorId.HALL);
console.info('---------newHall_SensorJsTest024 off end--------------'); console.info('---------newHall_SensorJsTest011 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest024 Device does not support! "); console.info("newHall_SensorJsTest011 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -366,16 +366,16 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -366,16 +366,16 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0120
* @tc.name: newHall_SensorJsTest025 * @tc.name: newHall_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newHall_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newHall_SensorJsTest025--------------'); console.info('---------newHall_SensorJsTest012--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest025 error'); console.info('newHall_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback); sensor.on(sensor.SensorId.HALL, callback);
...@@ -386,7 +386,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -386,7 +386,7 @@ describe("SensorJsTest_sensor_45", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newHall_SensorJsTest025 Device does not support! '); console.info('newHall_SensorJsTest012 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -394,38 +394,38 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -394,38 +394,38 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0130
* @tc.name: newHall_SensorJsTest026 * @tc.name: newHall_SensorJsTest013
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc:Call on interface and once interface respectively, and use an off interface to close
*/ */
it("newHall_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newHall_SensorJsTest026--------------'); console.info('---------newHall_SensorJsTest013--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest024 error'); console.info('newHall_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, (data)=>{ sensor.on(sensor.SensorId.HALL, (data)=>{
console.info("newHall_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newHall_SensorJsTest013 callback: " + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.HALL, (data)=>{ sensor.once(sensor.SensorId.HALL, (data)=>{
console.info("newHall_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newHall_SensorJsTest013 callback2: " + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newHall_SensorJsTest026 off in--------------'); console.info('---------newHall_SensorJsTest013 off in--------------');
sensor.off(sensor.SensorId.HALL); sensor.off(sensor.SensorId.HALL);
console.info('---------newHall_SensorJsTest026 off end--------------'); console.info('---------newHall_SensorJsTest013 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest026 Device does not support! "); console.info("newHall_SensorJsTest013 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -433,38 +433,38 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -433,38 +433,38 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0140
* @tc.name: newHall_SensorJsTest027 * @tc.name: newHall_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newHall_SensorJsTest027--------------'); console.info('---------newHall_SensorJsTest014--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest024 error'); console.info('newHall_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, (data)=>{ sensor.on(sensor.SensorId.HALL, (data)=>{
console.info("newHall_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newHall_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.HALL, (data)=>{ sensor.on(sensor.SensorId.HALL, (data)=>{
console.info("newHall_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newHall_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newHall_SensorJsTest027 off in--------------'); console.info('---------newHall_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.HALL); sensor.off(sensor.SensorId.HALL);
console.info('---------newHall_SensorJsTest027 off end--------------'); console.info('---------newHall_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest027 Device does not support! "); console.info("newHall_SensorJsTest014 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -472,16 +472,16 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -472,16 +472,16 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0150
* @tc.name: newHall_SensorJsTest028 * @tc.name: newHall_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newHall_SensorJsTest028--------------'); console.info('---------newHall_SensorJsTest015--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest028_on error:" +error); console.info("newHall_SensorJsTest015_on error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -489,7 +489,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -489,7 +489,7 @@ describe("SensorJsTest_sensor_45", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest028_once error:" +error); console.info("newHall_SensorJsTest015_once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -497,7 +497,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -497,7 +497,7 @@ describe("SensorJsTest_sensor_45", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest028_off error:" +error); console.info("newHall_SensorJsTest015_off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -505,39 +505,39 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -505,39 +505,39 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_HALL_JSTest_0290 * @tc.number: SUB_SensorsSystem_NEWHALL_JSTest_0160
* @tc.name: newHall_SensorJsTest029 * @tc.name: newHall_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newHall_SensorJsTest029--------------'); console.info('----------------------newHall_SensorJsTest016--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest029 error'); console.info('newHall_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback); sensor.on(sensor.SensorId.HALL, callback);
sensor.on(sensor.SensorId.HALL, callback2); sensor.on(sensor.SensorId.HALL, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newHall_SensorJsTest029 off in--------------'); console.info('----------------------newHall_SensorJsTest016 off in--------------');
try { try {
sensor.off(sensor.SensorId.HALL, callback); sensor.off(sensor.SensorId.HALL, callback);
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest029 error:" + error); console.info("newHall_SensorJsTest016 error:" + error);
} }
console.info('----------------------newHall_SensorJsTest029 off end--------------'); console.info('----------------------newHall_SensorJsTest016 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newHall_SensorJsTest029 off in--------------'); console.info('----------------------newHall_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.HALL, callback2); sensor.off(sensor.SensorId.HALL, callback2);
console.info('----------------------newHall_SensorJsTest029 off end--------------'); console.info('----------------------newHall_SensorJsTest016 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest029 Device does not support! "); console.info("newHall_SensorJsTest016 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -545,40 +545,39 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -545,40 +545,39 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_HALL_JSTest_0300 * @tc.number: SUB_SensorsSystem_NEWHALL_JSTest_0170
* @tc.name: newHall_SensorJsTest030 * @tc.name: newHall_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newHall_SensorJsTest030--------------'); console.info('----------------------newHall_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest029 error'); console.info('newHall_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.HALL, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.HALL, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.HALL, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newHall_SensorJsTest030 off in--------------'); console.info('----------------------newHall_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.HALL, callback); sensor.off(sensor.SensorId.HALL, callback);
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest030 error:" + error); console.info("newHall_SensorJsTest017 error:" + error);
} }
console console.info('----------------------newHall_SensorJsTest017 off end--------------');
console.info('----------------------newHall_SensorJsTest030 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newHall_SensorJsTest030_2 off in--------------'); console.info('----------------------newHall_SensorJsTest017_2 off in--------------');
sensor.off(sensor.SensorId.HALL, callback2); sensor.off(sensor.SensorId.HALL, callback2);
console.info('----------------------newHall_SensorJsTest030_2 off end--------------'); console.info('----------------------newHall_SensorJsTest017_2 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest030 Device does not support! "); console.info("newHall_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -586,24 +585,24 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -586,24 +585,24 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_HALL_JSTest_0310 * @tc.number: SUB_SensorsSystem_NEWHALL_JSTest_0180
* @tc.name: newHall_SensorJsTest031 * @tc.name: newHall_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newHall_SensorJsTest031--------------'); console.info('----------------------newHall_SensorJsTest018--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest031 error'); console.info('newHall_SensorJsTest018 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
console.info('----------------------newHall_SensorJsTest031 off in--------------'); console.info('----------------------newHall_SensorJsTest018 off in--------------');
try{ try{
sensor.off(-1, callback); sensor.off(-1, callback);
console.info('----------------------newHall_SensorJsTest031 off end--------------'); console.info('----------------------newHall_SensorJsTest018 off end--------------');
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest031 error:" + error); console.info("newHall_SensorJsTest018 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -611,7 +610,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -611,7 +610,7 @@ describe("SensorJsTest_sensor_45", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest031 Device does not support! "); console.info("newHall_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -619,25 +618,25 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -619,25 +618,25 @@ describe("SensorJsTest_sensor_45", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_HALL_JSTest_0320 * @tc.number: SUB_SensorsSystem_NEWHALL_JSTest_0190
* @tc.name: newHall_SensorJsTest032 * @tc.name: newHall_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newHall_SensorJsTest032--------------'); console.info('----------------------newHall_SensorJsTest019--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) { if (error) {
console.info('newHall_SensorJsTest032 error'); console.info('newHall_SensorJsTest019 error');
} else { } else {
try { try {
sensor.on(sensor.SensorId.HALL, callback, {'interval': -100000000}); sensor.on(sensor.SensorId.HALL, callback, {'interval': -100000000});
console.info('----------------------newHall_SensorJsTest032 off in---------------------------'); console.info('----------------------newHall_SensorJsTest019 off in---------------------------');
sensor.off(sensor.SensorId.HALL); sensor.off(sensor.SensorId.HALL);
console.info('----------------------newHall_SensorJsTest032 off end---------------------------'); console.info('----------------------newHall_SensorJsTest019 off end---------------------------');
done(); done();
} catch (error) { } catch (error) {
console.info('newHall_SensorJsTest032 On fail, errCode:' + error.code + ' ,msg:' + error.message); console.info('newHall_SensorJsTest019 On fail, errCode:' + error.code + ' ,msg:' + error.message);
expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE);
expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG); expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG);
done(); done();
...@@ -645,10 +644,197 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -645,10 +644,197 @@ describe("SensorJsTest_sensor_45", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newHall_SensorJsTest032 Device does not support! "); console.info("newHall_SensorJsTest019 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0200
* @tc.name: newHall_SensorJsTest020
* @tc.desc: Functional Use Cases
*/
it("newHall_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newHall_SensorJsTest020--------------');
try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) {
console.info('newHall_SensorJsTest020 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.HALL, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newHall_SensorJsTest020 off in--------------');
try {
sensor.off(sensor.SensorId.HALL, callback);
sensor.off(sensor.SensorId.HALL, callback2);
} catch (error) {
console.info("newHall_SensorJsTest020 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newHall_SensorJsTest020 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('newHall_SensorJsTest020 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0210
* @tc.name: newHall_SensorJsTest021
* @tc.desc: Illegal ID passed in
*/
it("newHall_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) {
console.info('newHall_SensorJsTest021 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback, undefined);
try{
sensor.on(sensor.SensorId.HALL, callback, { 'interval': undefined });
} catch(error){
console.info('newHall_SensorJsTest021 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newHall_SensorJsTest021 off in--------------');
try {
sensor.off(sensor.SensorId.HALL);
} catch (error) {
console.info("newHall_SensorJsTest021 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newHall_SensorJsTest021 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0220
* @tc.name: newHall_SensorJsTest022
* @tc.desc: For normal scenarios
*/
it("newHall_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newHall_SensorJsTest022--------------');
try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) {
console.info('newHall_SensorJsTest022 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback, null);
try{
sensor.on(sensor.SensorId.HALL, callback, { 'interval': null });
} catch(error){
console.info('newHall_SensorJsTest022 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newHall_SensorJsTest022 off in--------------');
try {
sensor.off(sensor.SensorId.HALL);
} catch (error) {
console.info("newHall_SensorJsTest022 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newHall_SensorJsTest022 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0230
* @tc.name: newHall_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newHall_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newHall_SensorJsTest023--------------');
try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) {
console.info('newHall_SensorJsTest023 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newHall_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.HALL);
} catch (error) {
console.info("newHall_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("newHall_SensorJsTest023 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWHALL_JSTest_0240
* @tc.name: newHall_SensorJsTest024
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("newHall_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
if (error) {
console.info('newHall_SensorJsTest024 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.HALL, callback, { 'interval': 100000000 });
} catch(error){
console.info("newHall_SensorJsTest024 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newHall_SensorJsTest024 off in--------------');
try {
sensor.off(sensor.SensorId.HALL);
} catch (error) {
console.info("newHall_SensorJsTest024 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newHall_SensorJsTest024 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("newHall_SensorJsTest024 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_52", function () { ...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_52", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_52", function () { ...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_52", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_52", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_52", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_52", function () { ...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_52", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_55", function () { ...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_55", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_55", function () { ...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_55", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_55", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_55", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_55", function () { ...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_55", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_51", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_51", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_51", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_51", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_51", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_51", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_51", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_51", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_37", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_37", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_37", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_37", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -72,12 +72,12 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -72,12 +72,12 @@ describe("SensorJsTest_sensor_37", function () {
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorSystem_MAGNETIC_FIELD_JsTest_0140 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0010
* @tc.name: newMagneticField_SensorJsTest014 * @tc.name: newMagneticField_SensorJsTest001
* @tc.desc: Functional Use Cases * @tc.desc: Illegal ID passed in
*/ */
it("newMagneticField_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newMagneticField_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newMagneticField_SensorJsTest014--------------'); console.info('---------newMagneticField_SensorJsTest001--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback);
...@@ -87,7 +87,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -87,7 +87,7 @@ describe("SensorJsTest_sensor_37", function () {
}, 500); }, 500);
}) })
} catch (error) { } catch (error) {
console.info('newMagneticField_SensorJsTest014 Device does not support! '); console.info('newMagneticField_SensorJsTest001 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -95,16 +95,16 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -95,16 +95,16 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0020
* @tc.name: newMagneticField_SensorJsTest015 * @tc.name: newMagneticField_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newMagneticField_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newMagneticField_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newMagneticField_SensorJsTest014--------------'); console.info('---------newMagneticField_SensorJsTest002--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest014 error'); console.info('newMagneticField_SensorJsTest002 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback);
...@@ -115,7 +115,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -115,7 +115,7 @@ describe("SensorJsTest_sensor_37", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newMagneticField_SensorJsTest014 Device does not support! '); console.info('newMagneticField_SensorJsTest002 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -123,20 +123,20 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -123,20 +123,20 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0030
* @tc.name: newMagneticField_SensorJsTest015 * @tc.name: newMagneticField_SensorJsTest003
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newMagneticField_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newMagneticField_SensorJsTest015--------------'); console.info('---------newMagneticField_SensorJsTest003--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newMagneticField_SensorJsTest015 callback in'); console.info('newMagneticField_SensorJsTest003 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest015 error:" + error); console.info("newMagneticField_SensorJsTest003 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -144,29 +144,29 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -144,29 +144,29 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0040
* @tc.name: newMagneticField_SensorJsTest016 * @tc.name: newMagneticField_SensorJsTest004
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newMagneticField_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newMagneticField_SensorJsTest016--------------'); console.info('---------newMagneticField_SensorJsTest004--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest016 error'); console.info('newMagneticField_SensorJsTest004 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newMagneticField_SensorJsTest016 off in--------------'); console.info('---------newMagneticField_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.MAGNETIC_FIELD); sensor.off(sensor.SensorId.MAGNETIC_FIELD);
console.info('---------newMagneticField_SensorJsTest016 off end--------------'); console.info('---------newMagneticField_SensorJsTest004 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info('newMagneticField_SensorJsTest016 Device does not support! '); console.info('newMagneticField_SensorJsTest004 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -174,14 +174,14 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -174,14 +174,14 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0050
* @tc.name: newMagneticField_SensorJsTest017 * @tc.name: newMagneticField_SensorJsTest005
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newMagneticField_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newMagneticField_SensorJsTest017--------------'); console.info('---------newMagneticField_SensorJsTest005--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newMagneticField_SensorJsTest017 callback in'); console.info('newMagneticField_SensorJsTest005 callback in');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -190,20 +190,20 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -190,20 +190,20 @@ describe("SensorJsTest_sensor_37", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest017 error'); console.info('newMagneticField_SensorJsTest005 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.MAGNETIC_FIELD, onSensorCallback, {'interval': 100000000}, 5);
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newMagneticField_SensorJsTest017 off in--------------'); console.info('---------newMagneticField_SensorJsTest005 off in--------------');
sensor.off(sensor.SensorId.MAGNETIC_FIELD); sensor.off(sensor.SensorId.MAGNETIC_FIELD);
console.info('---------newMagneticField_SensorJsTest017 off end--------------'); console.info('---------newMagneticField_SensorJsTest005 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest017 Device does not support! "); console.info("newMagneticField_SensorJsTest005 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -211,15 +211,15 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -211,15 +211,15 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0060
* @tc.name: newMagneticField_SensorJsTest018 * @tc.name: newMagneticField_SensorJsTest006
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newMagneticField_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest018 error'); console.info('newMagneticField_SensorJsTest006 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.MAGNETIC_FIELD, callback); sensor.once(sensor.SensorId.MAGNETIC_FIELD, callback);
...@@ -230,7 +230,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -230,7 +230,7 @@ describe("SensorJsTest_sensor_37", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest018 Device does not support! "); console.info("newMagneticField_SensorJsTest006 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -238,20 +238,20 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -238,20 +238,20 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0070
* @tc.name: newMagneticField_SensorJsTest019 * @tc.name: newMagneticField_SensorJsTest007
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Use case of illegal parameter passed into once interface
*/ */
it("newMagneticField_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newMagneticField_SensorJsTest019 callback in'); console.info('newMagneticField_SensorJsTest007 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest019 error:" +error); console.info("newMagneticField_SensorJsTest007 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -259,13 +259,13 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -259,13 +259,13 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0080
* @tc.name: newMagneticField_SensorJsTest020 * @tc.name: newMagneticField_SensorJsTest008
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newMagneticField_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newMagneticField_SensorJsTest020 on error'); console.info('newMagneticField_SensorJsTest008 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -275,14 +275,14 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -275,14 +275,14 @@ describe("SensorJsTest_sensor_37", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest020 error'); console.info('newMagneticField_SensorJsTest008 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.MAGNETIC_FIELD, onceSensorCallback, 5); sensor.once(sensor.SensorId.MAGNETIC_FIELD, onceSensorCallback, 5);
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest020 error:" +error); console.info("newMagneticField_SensorJsTest008 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -290,15 +290,15 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -290,15 +290,15 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0090
* @tc.name: newMagneticField_SensorJsTest021 * @tc.name: newMagneticField_SensorJsTest009
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Use case of illegal parameter passed into off interface
*/ */
it("newMagneticField_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newMagneticField_SensorJsTest021 Device does not support! '); console.info('newMagneticField_SensorJsTest009 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -306,20 +306,20 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -306,20 +306,20 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0100
* @tc.name: newMagneticField_SensorJsTest022 * @tc.name: newMagneticField_SensorJsTest010
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Unsubscribe directly without waiting after starting subscription
*/ */
it("newMagneticField_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newMagneticField_SensorJsTest022 callback in'); console.info('newMagneticField_SensorJsTest010 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest022 error'); console.info('newMagneticField_SensorJsTest010 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, onSensorCallback); sensor.on(sensor.SensorId.MAGNETIC_FIELD, onSensorCallback);
...@@ -331,7 +331,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -331,7 +331,7 @@ describe("SensorJsTest_sensor_37", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest022 error:" +error); console.info("newMagneticField_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -339,19 +339,19 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -339,19 +339,19 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0110
* @tc.name: newMagneticField_SensorJsTest023 * @tc.name: newMagneticField_SensorJsTest011
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newMagneticField_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newMagneticField_SensorJsTest023 on error'); console.info('newMagneticField_SensorJsTest011 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest023 error:" +error); console.info("newMagneticField_SensorJsTest011 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -359,41 +359,41 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -359,41 +359,41 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0120
* @tc.name: newMagneticField_SensorJsTest024 * @tc.name: newMagneticField_SensorJsTest012
* @tc.desc:Call interface multiple times * @tc.desc:Call interface multiple times
*/ */
it("newMagneticField_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest024 error'); console.info('newMagneticField_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{ sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{
console.info("newMagneticField_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newMagneticField_SensorJsTest012 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{ sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{
console.info("newMagneticField_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newMagneticField_SensorJsTest012 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newMagneticField_SensorJsTest024 off in--------------'); console.info('---------newMagneticField_SensorJsTest012 off in--------------');
sensor.off(sensor.SensorId.MAGNETIC_FIELD); sensor.off(sensor.SensorId.MAGNETIC_FIELD);
console.info('---------newMagneticField_SensorJsTest024 off end--------------'); console.info('---------newMagneticField_SensorJsTest012 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest024 Device does not support! "); console.info("newMagneticField_SensorJsTest012 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -401,12 +401,12 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -401,12 +401,12 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0130
* @tc.name: newMagneticField_SensorJsTest025 * @tc.name: newMagneticField_SensorJsTest013
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newMagneticField_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newMagneticField_SensorJsTest025--------------'); console.info('---------newMagneticField_SensorJsTest013--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback);
...@@ -416,7 +416,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -416,7 +416,7 @@ describe("SensorJsTest_sensor_37", function () {
}, 500); }, 500);
}) })
} catch (error) { } catch (error) {
console.info('newMagneticField_SensorJsTest025 Device does not support! '); console.info('newMagneticField_SensorJsTest013 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -424,42 +424,42 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -424,42 +424,42 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0140
* @tc.name: newMagneticField_SensorJsTest026 * @tc.name: newMagneticField_SensorJsTest014
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc:Call on interface and once interface respectively, and use an off interface to close
*/ */
it("newMagneticField_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newMagneticField_SensorJsTest026--------------'); console.info('---------newMagneticField_SensorJsTest014--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest024 error'); console.info('newMagneticField_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{ sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{
console.info("newMagneticField_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newMagneticField_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.MAGNETIC_FIELD, (data)=>{ sensor.once(sensor.SensorId.MAGNETIC_FIELD, (data)=>{
console.info("newMagneticField_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newMagneticField_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newMagneticField_SensorJsTest026 off in--------------'); console.info('---------newMagneticField_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.MAGNETIC_FIELD); sensor.off(sensor.SensorId.MAGNETIC_FIELD);
console.info('---------newMagneticField_SensorJsTest026 off end--------------'); console.info('---------newMagneticField_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest026 Device does not support! "); console.info("newMagneticField_SensorJsTest014 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -467,42 +467,42 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -467,42 +467,42 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0150
* @tc.name: newMagneticField_SensorJsTest027 * @tc.name: newMagneticField_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newMagneticField_SensorJsTest027--------------'); console.info('---------newMagneticField_SensorJsTest015--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest024 error'); console.info('newMagneticField_SensorJsTest015 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{ sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{
console.info("newMagneticField_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newMagneticField_SensorJsTest015 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{ sensor.on(sensor.SensorId.MAGNETIC_FIELD, (data)=>{
console.info("newMagneticField_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newMagneticField_SensorJsTest015 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newMagneticField_SensorJsTest027 off in--------------'); console.info('---------newMagneticField_SensorJsTest015 off in--------------');
sensor.off(sensor.SensorId.MAGNETIC_FIELD); sensor.off(sensor.SensorId.MAGNETIC_FIELD);
console.info('---------newMagneticField_SensorJsTest027 off end--------------'); console.info('---------newMagneticField_SensorJsTest015 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest027 Device does not support! "); console.info("newMagneticField_SensorJsTest015 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -510,16 +510,16 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -510,16 +510,16 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0160
* @tc.name: newMagneticField_SensorJsTest028 * @tc.name: newMagneticField_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newMagneticField_SensorJsTest028--------------'); console.info('---------newMagneticField_SensorJsTest016--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest028_on error:" +error); console.info("newMagneticField_SensorJsTest016_on error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -527,7 +527,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -527,7 +527,7 @@ describe("SensorJsTest_sensor_37", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest028_once error:" +error); console.info("newMagneticField_SensorJsTest016_once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -535,7 +535,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -535,7 +535,7 @@ describe("SensorJsTest_sensor_37", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest028_off error:" +error); console.info("newMagneticField_SensorJsTest016_off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -543,39 +543,39 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -543,39 +543,39 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0290 * @tc.number: SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0170
* @tc.name: newMagneticField_SensorJsTest029 * @tc.name: newMagneticField_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newMagneticField_SensorJsTest029--------------'); console.info('----------------------newMagneticField_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest029 error'); console.info('newMagneticField_SensorJsTest017 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback);
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback2); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest029 off in--------------'); console.info('----------------------newMagneticField_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback); sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback);
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest029 error:" + error); console.info("newMagneticField_SensorJsTest017 error:" + error);
} }
console.info('----------------------newMagneticField_SensorJsTest029 off end--------------'); console.info('----------------------newMagneticField_SensorJsTest017 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest029 off in--------------'); console.info('----------------------newMagneticField_SensorJsTest017 off in--------------');
sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback2); sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback2);
console.info('----------------------newMagneticField_SensorJsTest029 off end--------------'); console.info('----------------------newMagneticField_SensorJsTest017 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest029 Device does not support! "); console.info("newMagneticField_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -583,40 +583,39 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -583,40 +583,39 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0300 * @tc.number: SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0180
* @tc.name: newMagneticField_SensorJsTest030 * @tc.name: newMagneticField_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newMagneticField_SensorJsTest030--------------'); console.info('----------------------newMagneticField_SensorJsTest018--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest029 error'); console.info('newMagneticField_SensorJsTest017 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest030 off in--------------'); console.info('----------------------newMagneticField_SensorJsTest018 off in--------------');
try { try {
sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback); sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback);
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest030 error:" + error); console.info("newMagneticField_SensorJsTest018 error:" + error);
} }
console console.info('----------------------newMagneticField_SensorJsTest018 off end--------------');
console.info('----------------------newMagneticField_SensorJsTest030 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest030_2 off in--------------'); console.info('----------------------newMagneticField_SensorJsTest018_2 off in--------------');
sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback2); sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback2);
console.info('----------------------newMagneticField_SensorJsTest030_2 off end--------------'); console.info('----------------------newMagneticField_SensorJsTest018_2 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest030 Device does not support! "); console.info("newMagneticField_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -624,24 +623,24 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -624,24 +623,24 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0310 * @tc.number: SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0190
* @tc.name: newMagneticField_SensorJsTest031 * @tc.name: newMagneticField_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newMagneticField_SensorJsTest031--------------'); console.info('----------------------newMagneticField_SensorJsTest019--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest031 error'); console.info('newMagneticField_SensorJsTest019 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
console.info('----------------------newMagneticField_SensorJsTest031 off in--------------'); console.info('----------------------newMagneticField_SensorJsTest019 off in--------------');
try{ try{
sensor.off(-1, callback); sensor.off(-1, callback);
console.info('----------------------newMagneticField_SensorJsTest031 off end--------------'); console.info('----------------------newMagneticField_SensorJsTest019 off end--------------');
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest031 error:" + error); console.info("newMagneticField_SensorJsTest019 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -649,7 +648,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -649,7 +648,7 @@ describe("SensorJsTest_sensor_37", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest031 Device does not support! "); console.info("newMagneticField_SensorJsTest019 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -657,25 +656,25 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -657,25 +656,25 @@ describe("SensorJsTest_sensor_37", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_MAGNETIC_FIELD_JSTest_0320 * @tc.number: SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0200
* @tc.name: newMagneticField_SensorJsTest032 * @tc.name: newMagneticField_SensorJsTest020
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newMagneticField_SensorJsTest032--------------'); console.info('----------------------newMagneticField_SensorJsTest020--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) { if (error) {
console.info('newMagneticField_SensorJsTest032 error'); console.info('newMagneticField_SensorJsTest020 error');
} else { } else {
try { try {
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, {'interval': -100000000}); sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, {'interval': -100000000});
console.info('----------------------newMagneticField_SensorJsTest032 off in---------------------------'); console.info('----------------------newMagneticField_SensorJsTest020 off in---------------------------');
sensor.off(sensor.SensorId.MAGNETIC_FIELD); sensor.off(sensor.SensorId.MAGNETIC_FIELD);
console.info('----------------------newMagneticField_SensorJsTest032 off end---------------------------'); console.info('----------------------newMagneticField_SensorJsTest020 off end---------------------------');
done(); done();
} catch (error) { } catch (error) {
console.info('newMagneticField_SensorJsTest032 On fail, errCode:' + error.code + ' ,msg:' + error.message); console.info('newMagneticField_SensorJsTest020 On fail, errCode:' + error.code + ' ,msg:' + error.message);
expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE);
expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG); expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG);
done(); done();
...@@ -683,10 +682,198 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -683,10 +682,198 @@ describe("SensorJsTest_sensor_37", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newMagneticField_SensorJsTest032 Device does not support! "); console.info("newMagneticField_SensorJsTest020 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0210
* @tc.name: newMagneticField_SensorJsTest021
* @tc.desc: Illegal ID passed in
*/
it("newMagneticField_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('newMagneticField_SensorJsTest021 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, undefined);
try{
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, { 'interval': undefined });
} catch(error){
console.info('newMagneticField_SensorJsTest021 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest021 off in--------------');
try {
sensor.off(sensor.SensorId.MAGNETIC_FIELD);
} catch (error) {
console.info("newMagneticField_SensorJsTest021 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newMagneticField_SensorJsTest021 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0220
* @tc.name: newMagneticField_SensorJsTest022
* @tc.desc: For normal scenarios
*/
it("newMagneticField_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newMagneticField_SensorJsTest022--------------');
try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('newMagneticField_SensorJsTest022 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, null);
try{
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, { 'interval': null });
} catch(error){
console.info('newMagneticField_SensorJsTest022 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest022 off in--------------');
try {
sensor.off(sensor.SensorId.MAGNETIC_FIELD);
} catch (error) {
console.info("newMagneticField_SensorJsTest022 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newMagneticField_SensorJsTest022 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0230
* @tc.name: newMagneticField_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newMagneticField_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newMagneticField_SensorJsTest023--------------');
try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('newMagneticField_SensorJsTest023 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.MAGNETIC_FIELD);
} catch (error) {
console.info("newMagneticField_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("newMagneticField_SensorJsTest023 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0240
* @tc.name: newMagneticField_SensorJsTest024
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("newMagneticField_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('newMagneticField_SensorJsTest024 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, { 'interval': 100000000 });
} catch(error){
console.info("newMagneticField_SensorJsTest024 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest024 off in--------------');
try {
sensor.off(sensor.SensorId.MAGNETIC_FIELD);
} catch (error) {
console.info("newMagneticField_SensorJsTest024 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newMagneticField_SensorJsTest024 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("newMagneticField_SensorJsTest024 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWMAGNETIC_FIELD_JSTest_0250
* @tc.name: newMagneticField_SensorJsTest025
* @tc.desc: Functional Use Cases
*/
it("newMagneticField_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newMagneticField_SensorJsTest025--------------');
try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('newMagneticField_SensorJsTest025 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.MAGNETIC_FIELD, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newMagneticField_SensorJsTest025 off in--------------');
try {
sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback);
sensor.off(sensor.SensorId.MAGNETIC_FIELD, callback2);
} catch (error) {
console.info("newMagneticField_SensorJsTest025 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newMagneticField_SensorJsTest025 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('newMagneticField_SensorJsTest025 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_47", function () { ...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_47", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_47", function () { ...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_47", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_47", function () { ...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_47", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_47", function () { ...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_47", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_48", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_48", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_48", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_48", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -72,16 +72,16 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -72,16 +72,16 @@ describe("SensorJsTest_sensor_48", function () {
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0140 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0010
* @tc.name: newOrientating_SensorJsTest014 * @tc.name: newOrientating_SensorJsTest001
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newOrientating_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newOrientating_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newOrientating_SensorJsTest014--------------'); console.info('---------newOrientating_SensorJsTest001--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest014 error'); console.info('newOrientating_SensorJsTest001 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback); sensor.on(sensor.SensorId.ORIENTATION, callback);
...@@ -92,7 +92,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -92,7 +92,7 @@ describe("SensorJsTest_sensor_48", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newOrientating_SensorJsTest014 Device does not support! '); console.info('newOrientating_SensorJsTest001 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -100,20 +100,20 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -100,20 +100,20 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0020
* @tc.name: newOrientating_SensorJsTest015 * @tc.name: newOrientating_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newOrientating_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newOrientating_SensorJsTest015--------------'); console.info('---------newOrientating_SensorJsTest002--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newOrientating_SensorJsTest015 callback in'); console.info('newOrientating_SensorJsTest002 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest015 error:" + error); console.info("newOrientating_SensorJsTest002 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -121,29 +121,29 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -121,29 +121,29 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0030
* @tc.name: newOrientating_SensorJsTest016 * @tc.name: newOrientating_SensorJsTest003
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newOrientating_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newOrientating_SensorJsTest016--------------'); console.info('---------newOrientating_SensorJsTest003--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest016 error'); console.info('newOrientating_SensorJsTest003 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.ORIENTATION, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newOrientating_SensorJsTest016 off in--------------'); console.info('---------newOrientating_SensorJsTest003 off in--------------');
sensor.off(sensor.SensorId.ORIENTATION); sensor.off(sensor.SensorId.ORIENTATION);
console.info('---------newOrientating_SensorJsTest016 off end--------------'); console.info('---------newOrientating_SensorJsTest003 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info('newOrientating_SensorJsTest016 Device does not support! '); console.info('newOrientating_SensorJsTest003 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -151,14 +151,14 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -151,14 +151,14 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0040
* @tc.name: newOrientating_SensorJsTest017 * @tc.name: newOrientating_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newOrientating_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newOrientating_SensorJsTest017--------------'); console.info('---------newOrientating_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newOrientating_SensorJsTest017 callback in'); console.info('newOrientating_SensorJsTest004 callback in');
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
...@@ -167,20 +167,20 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -167,20 +167,20 @@ describe("SensorJsTest_sensor_48", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest017 error'); console.info('newOrientating_SensorJsTest004 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.ORIENTATION, onSensorCallback, {'interval': 100000000}, 5);
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newOrientating_SensorJsTest017 off in--------------'); console.info('---------newOrientating_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.ORIENTATION); sensor.off(sensor.SensorId.ORIENTATION);
console.info('---------newOrientating_SensorJsTest017 off end--------------'); console.info('---------newOrientating_SensorJsTest004 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest017 Device does not support! "); console.info("newOrientating_SensorJsTest004 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -188,15 +188,15 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -188,15 +188,15 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0050
* @tc.name: newOrientating_SensorJsTest018 * @tc.name: newOrientating_SensorJsTest005
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newOrientating_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest018 error'); console.info('newOrientating_SensorJsTest005 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.ORIENTATION, callback); sensor.once(sensor.SensorId.ORIENTATION, callback);
...@@ -207,7 +207,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -207,7 +207,7 @@ describe("SensorJsTest_sensor_48", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest018 Device does not support! "); console.info("newOrientating_SensorJsTest005 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -215,20 +215,20 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -215,20 +215,20 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0060
* @tc.name: newOrientating_SensorJsTest019 * @tc.name: newOrientating_SensorJsTest006
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Use case of illegal parameter passed into once interface
*/ */
it("newOrientating_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newOrientating_SensorJsTest019 callback in'); console.info('newOrientating_SensorJsTest006 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest019 error:" +error); console.info("newOrientating_SensorJsTest006 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -236,13 +236,13 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -236,13 +236,13 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0070
* @tc.name: newOrientating_SensorJsTest020 * @tc.name: newOrientating_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newOrientating_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newOrientating_SensorJsTest020 on error'); console.info('newOrientating_SensorJsTest007 on error');
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
...@@ -252,14 +252,14 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -252,14 +252,14 @@ describe("SensorJsTest_sensor_48", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest020 error'); console.info('newOrientating_SensorJsTest007 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.ORIENTATION, onceSensorCallback, 5); sensor.once(sensor.SensorId.ORIENTATION, onceSensorCallback, 5);
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest020 error:" +error); console.info("newOrientating_SensorJsTest007 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -267,15 +267,15 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -267,15 +267,15 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0080
* @tc.name: newOrientating_SensorJsTest021 * @tc.name: newOrientating_SensorJsTest008
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Use case of illegal parameter passed into off interface
*/ */
it("newOrientating_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newOrientating_SensorJsTest021 Device does not support! '); console.info('newOrientating_SensorJsTest008 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -283,20 +283,20 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -283,20 +283,20 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0090
* @tc.name: newOrientating_SensorJsTest022 * @tc.name: newOrientating_SensorJsTest009
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Unsubscribe directly without waiting after starting subscription
*/ */
it("newOrientating_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newOrientating_SensorJsTest022 callback in'); console.info('newOrientating_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest022 error'); console.info('newOrientating_SensorJsTest009 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, onSensorCallback); sensor.on(sensor.SensorId.ORIENTATION, onSensorCallback);
...@@ -308,7 +308,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -308,7 +308,7 @@ describe("SensorJsTest_sensor_48", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest022 error:" +error); console.info("newOrientating_SensorJsTest009 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -316,19 +316,19 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -316,19 +316,19 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0100
* @tc.name: newOrientating_SensorJsTest023 * @tc.name: newOrientating_SensorJsTest010
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newOrientating_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newOrientating_SensorJsTest023 on error'); console.info('newOrientating_SensorJsTest010 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest023 error:" +error); console.info("newOrientating_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -336,41 +336,41 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -336,41 +336,41 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0110
* @tc.name: newOrientating_SensorJsTest024 * @tc.name: newOrientating_SensorJsTest011
* @tc.desc:Call interface multiple times * @tc.desc:Call interface multiple times
*/ */
it("newOrientating_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest024 error'); console.info('newOrientating_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, (data)=>{ sensor.on(sensor.SensorId.ORIENTATION, (data)=>{
console.info("newOrientating_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newOrientating_SensorJsTest011 callback: " + JSON.stringify(data));
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.ORIENTATION, (data)=>{ sensor.on(sensor.SensorId.ORIENTATION, (data)=>{
console.info("newOrientating_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newOrientating_SensorJsTest011 callback2: " + JSON.stringify(data));
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newOrientating_SensorJsTest024 off in--------------'); console.info('---------newOrientating_SensorJsTest011 off in--------------');
sensor.off(sensor.SensorId.ORIENTATION); sensor.off(sensor.SensorId.ORIENTATION);
console.info('---------newOrientating_SensorJsTest024 off end--------------'); console.info('---------newOrientating_SensorJsTest011 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest024 Device does not support! "); console.info("newOrientating_SensorJsTest011 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -378,16 +378,16 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -378,16 +378,16 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0120
* @tc.name: newOrientating_SensorJsTest025 * @tc.name: newOrientating_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newOrientating_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newOrientating_SensorJsTest025--------------'); console.info('---------newOrientating_SensorJsTest012--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest025 error'); console.info('newOrientating_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback); sensor.on(sensor.SensorId.ORIENTATION, callback);
...@@ -398,7 +398,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -398,7 +398,7 @@ describe("SensorJsTest_sensor_48", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newOrientating_SensorJsTest025 Device does not support! '); console.info('newOrientating_SensorJsTest012 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -406,42 +406,42 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -406,42 +406,42 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0130
* @tc.name: newOrientating_SensorJsTest026 * @tc.name: newOrientating_SensorJsTest013
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc:Call on interface and once interface respectively, and use an off interface to close
*/ */
it("newOrientating_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newOrientating_SensorJsTest026--------------'); console.info('---------newOrientating_SensorJsTest013--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest024 error'); console.info('newOrientating_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, (data)=>{ sensor.on(sensor.SensorId.ORIENTATION, (data)=>{
console.info("newOrientating_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newOrientating_SensorJsTest013 callback: " + JSON.stringify(data));
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.ORIENTATION, (data)=>{ sensor.once(sensor.SensorId.ORIENTATION, (data)=>{
console.info("newOrientating_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newOrientating_SensorJsTest013 callback2: " + JSON.stringify(data));
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newOrientating_SensorJsTest026 off in--------------'); console.info('---------newOrientating_SensorJsTest013 off in--------------');
sensor.off(sensor.SensorId.ORIENTATION); sensor.off(sensor.SensorId.ORIENTATION);
console.info('---------newOrientating_SensorJsTest026 off end--------------'); console.info('---------newOrientating_SensorJsTest013 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest026 Device does not support! "); console.info("newOrientating_SensorJsTest013 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -449,42 +449,42 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -449,42 +449,42 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0140
* @tc.name: newOrientating_SensorJsTest027 * @tc.name: newOrientating_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newOrientating_SensorJsTest027--------------'); console.info('---------newOrientating_SensorJsTest014--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest024 error'); console.info('newOrientating_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, (data)=>{ sensor.on(sensor.SensorId.ORIENTATION, (data)=>{
console.info("newOrientating_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newOrientating_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.ORIENTATION, (data)=>{ sensor.on(sensor.SensorId.ORIENTATION, (data)=>{
console.info("newOrientating_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newOrientating_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newOrientating_SensorJsTest027 off in--------------'); console.info('---------newOrientating_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.ORIENTATION); sensor.off(sensor.SensorId.ORIENTATION);
console.info('---------newOrientating_SensorJsTest027 off end--------------'); console.info('---------newOrientating_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest027 Device does not support! "); console.info("newOrientating_SensorJsTest014 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -492,16 +492,16 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -492,16 +492,16 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0150
* @tc.name: newOrientating_SensorJsTest028 * @tc.name: newOrientating_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newOrientating_SensorJsTest028--------------'); console.info('---------newOrientating_SensorJsTest015--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest028_on error:" +error); console.info("newOrientating_SensorJsTest015_on error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -509,7 +509,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -509,7 +509,7 @@ describe("SensorJsTest_sensor_48", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest028_once error:" +error); console.info("newOrientating_SensorJsTest015_once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -517,7 +517,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -517,7 +517,7 @@ describe("SensorJsTest_sensor_48", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest028_off error:" +error); console.info("newOrientating_SensorJsTest015_off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -525,39 +525,39 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -525,39 +525,39 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ORIENTATION_JSTest_0290 * @tc.number: SUB_SensorsSystem_NEWORIENTATION_JSTest_0160
* @tc.name: newOrientating_SensorJsTest029 * @tc.name: newOrientating_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newOrientating_SensorJsTest029--------------'); console.info('----------------------newOrientating_SensorJsTest016--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest029 error'); console.info('newOrientating_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback); sensor.on(sensor.SensorId.ORIENTATION, callback);
sensor.on(sensor.SensorId.ORIENTATION, callback2); sensor.on(sensor.SensorId.ORIENTATION, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest029 off in--------------'); console.info('----------------------newOrientating_SensorJsTest016 off in--------------');
try { try {
sensor.off(sensor.SensorId.ORIENTATION, callback); sensor.off(sensor.SensorId.ORIENTATION, callback);
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest029 error:" + error); console.info("newOrientating_SensorJsTest016 error:" + error);
} }
console.info('----------------------newOrientating_SensorJsTest029 off end--------------'); console.info('----------------------newOrientating_SensorJsTest016 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest029 off in--------------'); console.info('----------------------newOrientating_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.ORIENTATION, callback2); sensor.off(sensor.SensorId.ORIENTATION, callback2);
console.info('----------------------newOrientating_SensorJsTest029 off end--------------'); console.info('----------------------newOrientating_SensorJsTest016 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest029 Device does not support! "); console.info("newOrientating_SensorJsTest016 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -565,40 +565,39 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -565,40 +565,39 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ORIENTATION_JSTest_0300 * @tc.number: SUB_SensorsSystem_NEWORIENTATION_JSTest_0170
* @tc.name: newOrientating_SensorJsTest030 * @tc.name: newOrientating_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newOrientating_SensorJsTest030--------------'); console.info('----------------------newOrientating_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest029 error'); console.info('newOrientating_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.ORIENTATION, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.ORIENTATION, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.ORIENTATION, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest030 off in--------------'); console.info('----------------------newOrientating_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.ORIENTATION, callback); sensor.off(sensor.SensorId.ORIENTATION, callback);
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest030 error:" + error); console.info("newOrientating_SensorJsTest017 error:" + error);
} }
console console.info('----------------------newOrientating_SensorJsTest017 off end--------------');
console.info('----------------------newOrientating_SensorJsTest030 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest030_2 off in--------------'); console.info('----------------------newOrientating_SensorJsTest017_2 off in--------------');
sensor.off(sensor.SensorId.ORIENTATION, callback2); sensor.off(sensor.SensorId.ORIENTATION, callback2);
console.info('----------------------newOrientating_SensorJsTest030_2 off end--------------'); console.info('----------------------newOrientating_SensorJsTest017_2 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest030 Device does not support! "); console.info("newOrientating_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -606,24 +605,24 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -606,24 +605,24 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ORIENTATION_JSTest_0310 * @tc.number: SUB_SensorsSystem_NEWORIENTATION_JSTest_0180
* @tc.name: newOrientating_SensorJsTest031 * @tc.name: newOrientating_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newOrientating_SensorJsTest031--------------'); console.info('----------------------newOrientating_SensorJsTest018--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest031 error'); console.info('newOrientating_SensorJsTest018 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
console.info('----------------------newOrientating_SensorJsTest031 off in--------------'); console.info('----------------------newOrientating_SensorJsTest018 off in--------------');
try{ try{
sensor.off(-1, callback); sensor.off(-1, callback);
console.info('----------------------newOrientating_SensorJsTest031 off end--------------'); console.info('----------------------newOrientating_SensorJsTest018 off end--------------');
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest031 error:" + error); console.info("newOrientating_SensorJsTest018 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -631,7 +630,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -631,7 +630,7 @@ describe("SensorJsTest_sensor_48", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest031 Device does not support! "); console.info("newOrientating_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -639,25 +638,25 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -639,25 +638,25 @@ describe("SensorJsTest_sensor_48", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ORIENTATION_JSTest_0320 * @tc.number: SUB_SensorsSystem_NEWORIENTATION_JSTest_0190
* @tc.name: newOrientating_SensorJsTest032 * @tc.name: newOrientating_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newOrientating_SensorJsTest032--------------'); console.info('----------------------newOrientating_SensorJsTest019--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) { if (error) {
console.info('newOrientating_SensorJsTest032 error'); console.info('newOrientating_SensorJsTest019 error');
} else { } else {
try { try {
sensor.on(sensor.SensorId.ORIENTATION, callback, {'interval': -100000000}); sensor.on(sensor.SensorId.ORIENTATION, callback, {'interval': -100000000});
console.info('----------------------newOrientating_SensorJsTest032 off in---------------------------'); console.info('----------------------newOrientating_SensorJsTest019 off in---------------------------');
sensor.off(sensor.SensorId.ORIENTATION); sensor.off(sensor.SensorId.ORIENTATION);
console.info('----------------------newOrientating_SensorJsTest032 off end---------------------------'); console.info('----------------------newOrientating_SensorJsTest019 off end---------------------------');
done(); done();
} catch (error) { } catch (error) {
console.info('newOrientating_SensorJsTest032 On fail, errCode:' + error.code + ' ,msg:' + error.message); console.info('newOrientating_SensorJsTest019 On fail, errCode:' + error.code + ' ,msg:' + error.message);
expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE);
expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG); expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG);
done(); done();
...@@ -665,10 +664,226 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -665,10 +664,226 @@ describe("SensorJsTest_sensor_48", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newOrientating_SensorJsTest032 Device does not support! "); console.info("newOrientating_SensorJsTest019 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0200
* @tc.name: newOrientating_SensorJsTest020
* @tc.desc: Functional Use Cases
*/
it("newOrientating_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newOrientating_SensorJsTest020--------------');
try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) {
console.info('newOrientating_SensorJsTest020 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback);
setTimeout(()=>{
sensor.off(sensor.SensorId.ORIENTATION);
done();
}, 500);
}
})
} catch (error) {
console.info('newOrientating_SensorJsTest020 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0210
* @tc.name: newOrientating_SensorJsTest021
* @tc.desc: Functional Use Cases
*/
it("newOrientating_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newOrientating_SensorJsTest021--------------');
try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) {
console.info('newOrientating_SensorJsTest021 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.ORIENTATION, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest021 off in--------------');
try {
sensor.off(sensor.SensorId.ORIENTATION, callback);
sensor.off(sensor.SensorId.ORIENTATION, callback2);
} catch (error) {
console.info("newOrientating_SensorJsTest021 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newOrientating_SensorJsTest021 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('newOrientating_SensorJsTest021 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0220
* @tc.name: newOrientating_SensorJsTest022
* @tc.desc: Illegal ID passed in
*/
it("newOrientating_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) {
console.info('newOrientating_SensorJsTest022 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback, undefined);
try{
sensor.on(sensor.SensorId.ORIENTATION, callback, { 'interval': undefined });
} catch(error){
console.info('newOrientating_SensorJsTest022 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest022 off in--------------');
try {
sensor.off(sensor.SensorId.ORIENTATION);
} catch (error) {
console.info("newOrientating_SensorJsTest022 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newOrientating_SensorJsTest022 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0230
* @tc.name: newOrientating_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newOrientating_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newOrientating_SensorJsTest023--------------');
try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) {
console.info('newOrientating_SensorJsTest023 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.ORIENTATION);
} catch (error) {
console.info("newOrientating_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("newOrientating_SensorJsTest023 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0240
* @tc.name: newOrientating_SensorJsTest024
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("newOrientating_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) {
console.info('newOrientating_SensorJsTest024 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.ORIENTATION, callback, { 'interval': 100000000 });
} catch(error){
console.info("newOrientating_SensorJsTest024 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest024 off in--------------');
try {
sensor.off(sensor.SensorId.ORIENTATION);
} catch (error) {
console.info("newOrientating_SensorJsTest024 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newOrientating_SensorJsTest024 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("newOrientating_SensorJsTest024 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWORIENTATION_JSTest_0250
* @tc.name: newOrientating_SensorJsTest025
* @tc.desc: For normal scenarios
*/
it("newOrientating_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newOrientating_SensorJsTest025--------------');
try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
if (error) {
console.info('newOrientating_SensorJsTest025 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, callback, null);
try{
sensor.on(sensor.SensorId.ORIENTATION, callback, { 'interval': null });
} catch(error){
console.info('newOrientating_SensorJsTest025 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newOrientating_SensorJsTest025 off in--------------');
try {
sensor.off(sensor.SensorId.ORIENTATION);
} catch (error) {
console.info("newOrientating_SensorJsTest025 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newOrientating_SensorJsTest025 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_56", function () { ...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_56", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_56", function () { ...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_56", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_56", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_56", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_56", function () { ...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_56", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -829,5 +829,229 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -829,5 +829,229 @@ describe("SensorJsTest_sensor_57", function () {
console.error('newPedometerDetection_SensorJsTest017 error:' + JSON.stringify(error)); console.error('newPedometerDetection_SensorJsTest017 error:' + JSON.stringify(error));
done(); done();
}) })
}) })
/*
* @tc.number:SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0180
* @tc.name: newPedometerDetection_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest018---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('newPedometerDetection_SensorJsTest018 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback, { 'interval': undefined });
setTimeout(() => {
sensor.off(sensor.SensorId.PEDOMETER_DETECTION);
done();
}, 4000);
} catch (error) {
console.error('newPedometerDetection_SensorJsTest018 On fail, errorCode:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('newPedometerDetection_SensorJsTest018 Sensor is not support');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest018 error:' + JSON.stringify(error));
done();
})
})
/*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0190
* @tc.name: newPedometerDetection_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest019---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('newPedometerDetection_SensorJsTest019 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback2, { 'interval': undefined });
setTimeout(()=>{
sensor.off(sensor.SensorId.PEDOMETER_DETECTION);
done();
}, 4000);
} catch (error) {
console.error('newPedometerDetection_SensorJsTest019 On fail, errorCode:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('newPedometerDetection_SensorJsTest019 Sensor is not support');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest019 error:' + JSON.stringify(error));
done();
})
})
/*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0200
* @tc.name: newPedometerDetection_SensorJsTest020
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest020---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('newPedometerDetection_SensorJsTest020 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback, { 'interval': null });
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback2, { 'interval': null });
setTimeout(() => {
sensor.off(sensor.SensorId.PEDOMETER_DETECTION, callback);
}, 4000);
setTimeout(() => {
sensor.off(sensor.SensorId.PEDOMETER_DETECTION, callback2);
done();
}, 4000);
} catch (error) {
console.error('newPedometerDetection_SensorJsTest020 On fail, errorCode:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('newPedometerDetection_SensorJsTest020 Sensor is not support');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest020 error:' + JSON.stringify(error));
done();
})
})
/*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0210
* @tc.name: newPedometerDetection_SensorJsTest021
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest021---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('newPedometerDetection_SensorJsTest021 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback);
try{
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback, undefined);
} catch(error){
console.info('newPedometerDetection_SensorJsTest021 Repeat subscription'+error);
}
setTimeout(() => {
sensor.off(sensor.SensorId.PEDOMETER_DETECTION);
done();
}, 4000);
} catch (error) {
console.error('newPedometerDetection_SensorJsTest021 On fail, errorCode:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('newPedometerDetection_SensorJsTest021 Sensor is not support');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest021 error:' + JSON.stringify(error));
done();
})
})
/*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0220
* @tc.name: newPedometerDetection_SensorJsTest022
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('newPedometerDetection_SensorJsTest022 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback);
setTimeout(() => {
sensor.off(sensor.SensorId.PEDOMETER_DETECTION, null);
done();
}, 4000);
} catch (error) {
console.error('newPedometerDetection_SensorJsTest022 catch error:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('newPedometerDetection_SensorJsTest022 Sensor is not support'+error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest022 error:' + JSON.stringify(error));
done();
})
})
})} })}
...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_54", function () { ...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_54", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_54", function () { ...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_54", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_54", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_54", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_54", function () { ...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_54", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -40,7 +40,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -40,7 +40,7 @@ describe("SensorJsTest_sensor_49", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -48,7 +48,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -48,7 +48,7 @@ describe("SensorJsTest_sensor_49", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -56,7 +56,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -56,7 +56,7 @@ describe("SensorJsTest_sensor_49", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -64,7 +64,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -64,7 +64,7 @@ describe("SensorJsTest_sensor_49", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -74,16 +74,16 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -74,16 +74,16 @@ describe("SensorJsTest_sensor_49", function () {
let invalid = -1; let invalid = -1;
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0140 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0010
* @tc.name: newRotatingVector_SensorJsTest014 * @tc.name: newRotatingVector_SensorJsTest001
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newRotatingVector_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newRotatingVector_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newRotatingVector_SensorJsTest014--------------'); console.info('---------newRotatingVector_SensorJsTest001--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest014 error'); console.info('newRotatingVector_SensorJsTest001 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback);
...@@ -94,7 +94,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -94,7 +94,7 @@ describe("SensorJsTest_sensor_49", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newRotatingVector_SensorJsTest014 Device does not support! '); console.info('newRotatingVector_SensorJsTest001 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -102,20 +102,20 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -102,20 +102,20 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0150 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0020
* @tc.name: newRotatingVector_SensorJsTest015 * @tc.name: newRotatingVector_SensorJsTest002
* @tc.desc: Illegal ID passed in * @tc.desc: Illegal ID passed in
*/ */
it("newRotatingVector_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest015--------------'); console.info('---------newRotatingVector_SensorJsTest002--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest015 callback in'); console.info('newRotatingVector_SensorJsTest002 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.on(invalid, onSensorCallback); sensor.on(invalid, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest015 error:" + error); console.info("newRotatingVector_SensorJsTest002 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -123,29 +123,29 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -123,29 +123,29 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0160 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0030
* @tc.name: newRotatingVector_SensorJsTest016 * @tc.name: newRotatingVector_SensorJsTest003
* @tc.desc: For normal scenarios * @tc.desc: For normal scenarios
*/ */
it("newRotatingVector_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest016--------------'); console.info('---------newRotatingVector_SensorJsTest003--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest016 error'); console.info('newRotatingVector_SensorJsTest003 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, {'interval': 100000000}); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newRotatingVector_SensorJsTest016 off in--------------'); console.info('---------newRotatingVector_SensorJsTest003 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
console.info('---------newRotatingVector_SensorJsTest016 off end--------------'); console.info('---------newRotatingVector_SensorJsTest003 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info('newRotatingVector_SensorJsTest016 Device does not support! '); console.info('newRotatingVector_SensorJsTest003 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -153,14 +153,14 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -153,14 +153,14 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0170 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0040
* @tc.name: newRotatingVector_SensorJsTest017 * @tc.name: newRotatingVector_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newRotatingVector_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newRotatingVector_SensorJsTest017--------------'); console.info('---------newRotatingVector_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest017 callback in'); console.info('newRotatingVector_SensorJsTest004 callback in');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -169,20 +169,20 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -169,20 +169,20 @@ describe("SensorJsTest_sensor_49", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest017 error'); console.info('newRotatingVector_SensorJsTest004 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, onSensorCallback, {'interval': 100000000}, 5); sensor.on(sensor.SensorId.ROTATION_VECTOR, onSensorCallback, {'interval': 100000000}, 5);
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newRotatingVector_SensorJsTest017 off in--------------'); console.info('---------newRotatingVector_SensorJsTest004 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
console.info('---------newRotatingVector_SensorJsTest017 off end--------------'); console.info('---------newRotatingVector_SensorJsTest004 off end--------------');
done(); done();
}, 500); }, 500);
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest017 Device does not support! "); console.info("newRotatingVector_SensorJsTest004 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -190,15 +190,15 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -190,15 +190,15 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0180 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0050
* @tc.name: newRotatingVector_SensorJsTest018 * @tc.name: newRotatingVector_SensorJsTest005
* @tc.desc: Once Normal Subscription Scenario Use Case * @tc.desc: Once Normal Subscription Scenario Use Case
*/ */
it("newRotatingVector_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest018 error'); console.info('newRotatingVector_SensorJsTest005 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.ROTATION_VECTOR, callback); sensor.once(sensor.SensorId.ROTATION_VECTOR, callback);
...@@ -209,7 +209,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -209,7 +209,7 @@ describe("SensorJsTest_sensor_49", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest018 Device does not support! "); console.info("newRotatingVector_SensorJsTest005 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -217,20 +217,20 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -217,20 +217,20 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0190 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0060
* @tc.name: newRotatingVector_SensorJsTest019 * @tc.name: newRotatingVector_SensorJsTest006
* @tc.desc: Use case of illegal parameter passed into once interface * @tc.desc: Use case of illegal parameter passed into once interface
*/ */
it("newRotatingVector_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest019 callback in'); console.info('newRotatingVector_SensorJsTest006 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try { try {
sensor.once(invalid, onceSensorCallback); sensor.once(invalid, onceSensorCallback);
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest019 error:" +error); console.info("newRotatingVector_SensorJsTest006 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -238,13 +238,13 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -238,13 +238,13 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0200 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0070
* @tc.name: newRotatingVector_SensorJsTest020 * @tc.name: newRotatingVector_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newRotatingVector_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest020 on error'); console.info('newRotatingVector_SensorJsTest007 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -255,14 +255,14 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -255,14 +255,14 @@ describe("SensorJsTest_sensor_49", function () {
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest020 error'); console.info('newRotatingVector_SensorJsTest007 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.once(sensor.SensorId.ROTATION_VECTOR, onceSensorCallback, 5); sensor.once(sensor.SensorId.ROTATION_VECTOR, onceSensorCallback, 5);
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest020 error:" +error); console.info("newRotatingVector_SensorJsTest007 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -270,15 +270,15 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -270,15 +270,15 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0210 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0080
* @tc.name: newRotatingVector_SensorJsTest021 * @tc.name: newRotatingVector_SensorJsTest008
* @tc.desc: Use case of illegal parameter passed into off interface * @tc.desc: Use case of illegal parameter passed into off interface
*/ */
it("newRotatingVector_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(invalid, callback); sensor.off(invalid, callback);
} catch (error) { } catch (error) {
console.info('newRotatingVector_SensorJsTest021 Device does not support! '); console.info('newRotatingVector_SensorJsTest008 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -286,20 +286,20 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -286,20 +286,20 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0220 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0090
* @tc.name: newRotatingVector_SensorJsTest022 * @tc.name: newRotatingVector_SensorJsTest009
* @tc.desc: Unsubscribe directly without waiting after starting subscription * @tc.desc: Unsubscribe directly without waiting after starting subscription
*/ */
it("newRotatingVector_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest022 callback in'); console.info('newRotatingVector_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest022 error'); console.info('newRotatingVector_SensorJsTest009 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, onSensorCallback); sensor.on(sensor.SensorId.ROTATION_VECTOR, onSensorCallback);
...@@ -311,7 +311,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -311,7 +311,7 @@ describe("SensorJsTest_sensor_49", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest022 error:" +error); console.info("newRotatingVector_SensorJsTest009 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -319,19 +319,19 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -319,19 +319,19 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0230 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0100
* @tc.name: newRotatingVector_SensorJsTest023 * @tc.name: newRotatingVector_SensorJsTest010
* @tc.desc:SensorId1000000 of incoming exception * @tc.desc:SensorId1000000 of incoming exception
*/ */
it("newRotatingVector_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest023 on error'); console.info('newRotatingVector_SensorJsTest010 on error');
expect(false).assertTrue(); expect(false).assertTrue();
} }
try { try {
sensor.off(1000000, onSensorCallback); sensor.off(1000000, onSensorCallback);
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest023 error:" +error); console.info("newRotatingVector_SensorJsTest010 error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE) expect(error.code).assertEqual(PARAMETER_ERROR_CODE)
expect(error.message).assertEqual(PARAMETER_ERROR_MSG) expect(error.message).assertEqual(PARAMETER_ERROR_MSG)
done(); done();
...@@ -339,19 +339,19 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -339,19 +339,19 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0240 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0110
* @tc.name: newRotatingVector_SensorJsTest024 * @tc.name: newRotatingVector_SensorJsTest011
* @tc.desc:Call interface multiple times * @tc.desc:Call interface multiple times
*/ */
it("newRotatingVector_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest024 error'); console.info('newRotatingVector_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{
console.info("newRotatingVector_SensorJsTest024 callback: " + JSON.stringify(data)); console.info("newRotatingVector_SensorJsTest011 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -359,7 +359,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -359,7 +359,7 @@ describe("SensorJsTest_sensor_49", function () {
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{
console.info("newRotatingVector_SensorJsTest024 callback2: " + JSON.stringify(data)); console.info("newRotatingVector_SensorJsTest011 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -367,15 +367,15 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -367,15 +367,15 @@ describe("SensorJsTest_sensor_49", function () {
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newRotatingVector_SensorJsTest024 off in--------------'); console.info('---------newRotatingVector_SensorJsTest011 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
console.info('---------newRotatingVector_SensorJsTest024 off end--------------'); console.info('---------newRotatingVector_SensorJsTest011 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest024 Device does not support! "); console.info("newRotatingVector_SensorJsTest011 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -383,16 +383,16 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -383,16 +383,16 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0250 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0120
* @tc.name: newRotatingVector_SensorJsTest025 * @tc.name: newRotatingVector_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newRotatingVector_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newRotatingVector_SensorJsTest025--------------'); console.info('---------newRotatingVector_SensorJsTest012--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest025 error'); console.info('newRotatingVector_SensorJsTest012 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback);
...@@ -403,7 +403,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -403,7 +403,7 @@ describe("SensorJsTest_sensor_49", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info('newRotatingVector_SensorJsTest025 Device does not support! '); console.info('newRotatingVector_SensorJsTest012 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -411,20 +411,20 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -411,20 +411,20 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0260 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0130
* @tc.name: newRotatingVector_SensorJsTest026 * @tc.name: newRotatingVector_SensorJsTest013
* @tc.desc:Call on interface and once interface respectively, and use an off interface to close * @tc.desc:Call on interface and once interface respectively, and use an off interface to close
*/ */
it("newRotatingVector_SensorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest026--------------'); console.info('---------newRotatingVector_SensorJsTest013--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest024 error'); console.info('newRotatingVector_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{
console.info("newRotatingVector_SensorJsTest026 callback: " + JSON.stringify(data)); console.info("newRotatingVector_SensorJsTest013 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -432,7 +432,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -432,7 +432,7 @@ describe("SensorJsTest_sensor_49", function () {
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.once(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.once(sensor.SensorId.ROTATION_VECTOR, (data)=>{
console.info("newRotatingVector_SensorJsTest026 callback2: " + JSON.stringify(data)); console.info("newRotatingVector_SensorJsTest013 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -440,15 +440,15 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -440,15 +440,15 @@ describe("SensorJsTest_sensor_49", function () {
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}); });
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newRotatingVector_SensorJsTest026 off in--------------'); console.info('---------newRotatingVector_SensorJsTest013 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
console.info('---------newRotatingVector_SensorJsTest026 off end--------------'); console.info('---------newRotatingVector_SensorJsTest013 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest026 Device does not support! "); console.info("newRotatingVector_SensorJsTest013 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -456,20 +456,20 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -456,20 +456,20 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0270 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0140
* @tc.name: newRotatingVector_SensorJsTest027 * @tc.name: newRotatingVector_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest027--------------'); console.info('---------newRotatingVector_SensorJsTest014--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest024 error'); console.info('newRotatingVector_SensorJsTest011 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{
console.info("newRotatingVector_SensorJsTest027 callback: " + JSON.stringify(data)); console.info("newRotatingVector_SensorJsTest014 callback: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -477,7 +477,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -477,7 +477,7 @@ describe("SensorJsTest_sensor_49", function () {
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{ sensor.on(sensor.SensorId.ROTATION_VECTOR, (data)=>{
console.info("newRotatingVector_SensorJsTest027 callback2: " + JSON.stringify(data)); console.info("newRotatingVector_SensorJsTest014 callback2: " + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -485,15 +485,15 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -485,15 +485,15 @@ describe("SensorJsTest_sensor_49", function () {
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
}, {'interval': 100000000}); }, {'interval': 100000000});
setTimeout(()=>{ setTimeout(()=>{
console.info('---------newRotatingVector_SensorJsTest027 off in--------------'); console.info('---------newRotatingVector_SensorJsTest014 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
console.info('---------newRotatingVector_SensorJsTest027 off end--------------'); console.info('---------newRotatingVector_SensorJsTest014 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest027 Device does not support! "); console.info("newRotatingVector_SensorJsTest014 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -501,16 +501,16 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -501,16 +501,16 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0280 * @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0150
* @tc.name: newRotatingVector_SensorJsTest028 * @tc.name: newRotatingVector_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest028--------------'); console.info('---------newRotatingVector_SensorJsTest015--------------');
try { try {
sensor.on(); sensor.on();
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest028_on error:" +error); console.info("newRotatingVector_SensorJsTest015_on error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -518,7 +518,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -518,7 +518,7 @@ describe("SensorJsTest_sensor_49", function () {
try { try {
sensor.once(); sensor.once();
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest028_once error:" +error); console.info("newRotatingVector_SensorJsTest015_once error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -526,7 +526,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -526,7 +526,7 @@ describe("SensorJsTest_sensor_49", function () {
try { try {
sensor.off(); sensor.off();
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest028_off error:" +error); console.info("newRotatingVector_SensorJsTest015_off error:" +error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -534,39 +534,39 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -534,39 +534,39 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0290 * @tc.number: SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0160
* @tc.name: newRotatingVector_SensorJsTest029 * @tc.name: newRotatingVector_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newRotatingVector_SensorJsTest029--------------'); console.info('----------------------newRotatingVector_SensorJsTest016--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest029 error'); console.info('newRotatingVector_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback);
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback2); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback2);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest029 off in--------------'); console.info('----------------------newRotatingVector_SensorJsTest016 off in--------------');
try { try {
sensor.off(sensor.SensorId.ROTATION_VECTOR, callback); sensor.off(sensor.SensorId.ROTATION_VECTOR, callback);
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest029 error:" + error); console.info("newRotatingVector_SensorJsTest016 error:" + error);
} }
console.info('----------------------newRotatingVector_SensorJsTest029 off end--------------'); console.info('----------------------newRotatingVector_SensorJsTest016 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest029 off in--------------'); console.info('----------------------newRotatingVector_SensorJsTest016 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR, callback2); sensor.off(sensor.SensorId.ROTATION_VECTOR, callback2);
console.info('----------------------newRotatingVector_SensorJsTest029 off end--------------'); console.info('----------------------newRotatingVector_SensorJsTest016 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest029 Device does not support! "); console.info("newRotatingVector_SensorJsTest016 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -574,40 +574,39 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -574,40 +574,39 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0300 * @tc.number: SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_017
* @tc.name: newRotatingVector_SensorJsTest030 * @tc.name: newRotatingVector_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newRotatingVector_SensorJsTest030--------------'); console.info('----------------------newRotatingVector_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest029 error'); console.info('newRotatingVector_SensorJsTest016 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, { 'interval': 100000000 }); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, { 'interval': 100000000 });
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback2, { 'interval': 100000000 }); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback2, { 'interval': 100000000 });
setTimeout(() => { setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest030 off in--------------'); console.info('----------------------newRotatingVector_SensorJsTest017 off in--------------');
try { try {
sensor.off(sensor.SensorId.ROTATION_VECTOR, callback); sensor.off(sensor.SensorId.ROTATION_VECTOR, callback);
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest030 error:" + error); console.info("newRotatingVector_SensorJsTest017 error:" + error);
} }
console console.info('----------------------newRotatingVector_SensorJsTest017 off end--------------');
console.info('----------------------newRotatingVector_SensorJsTest030 off end--------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest030_2 off in--------------'); console.info('----------------------newRotatingVector_SensorJsTest017_2 off in--------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR, callback2); sensor.off(sensor.SensorId.ROTATION_VECTOR, callback2);
console.info('----------------------newRotatingVector_SensorJsTest030_2 off end--------------'); console.info('----------------------newRotatingVector_SensorJsTest017_2 off end--------------');
done(); done();
}, 1000); }, 1000);
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest030 Device does not support! "); console.info("newRotatingVector_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -615,24 +614,24 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -615,24 +614,24 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0310 * @tc.number: SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0180
* @tc.name: newRotatingVector_SensorJsTest031 * @tc.name: newRotatingVector_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newRotatingVector_SensorJsTest031--------------'); console.info('----------------------newRotatingVector_SensorJsTest018--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest031 error'); console.info('newRotatingVector_SensorJsTest018 error');
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
console.info('----------------------newRotatingVector_SensorJsTest031 off in--------------'); console.info('----------------------newRotatingVector_SensorJsTest018 off in--------------');
try{ try{
sensor.off(-1, callback); sensor.off(-1, callback);
console.info('----------------------newRotatingVector_SensorJsTest031 off end--------------'); console.info('----------------------newRotatingVector_SensorJsTest018 off end--------------');
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest031 error:" + error); console.info("newRotatingVector_SensorJsTest018 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -640,7 +639,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -640,7 +639,7 @@ describe("SensorJsTest_sensor_49", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest031 Device does not support! "); console.info("newRotatingVector_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
...@@ -648,25 +647,25 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -648,25 +647,25 @@ describe("SensorJsTest_sensor_49", function () {
}) })
/* /*
* @tc.number: SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0320 * @tc.number: SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0190
* @tc.name: newRotatingVector_SensorJsTest032 * @tc.name: newRotatingVector_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newRotatingVector_SensorJsTest032--------------'); console.info('----------------------newRotatingVector_SensorJsTest019--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) { if (error) {
console.info('newRotatingVector_SensorJsTest032 error'); console.info('newRotatingVector_SensorJsTest019 error');
} else { } else {
try { try {
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, {'interval': -100000000}); sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, {'interval': -100000000});
console.info('----------------------newRotatingVector_SensorJsTest032 off in---------------------------'); console.info('----------------------newRotatingVector_SensorJsTest019 off in---------------------------');
sensor.off(sensor.SensorId.ROTATION_VECTOR); sensor.off(sensor.SensorId.ROTATION_VECTOR);
console.info('----------------------newRotatingVector_SensorJsTest032 off end---------------------------'); console.info('----------------------newRotatingVector_SensorJsTest019 off end---------------------------');
done(); done();
} catch (error) { } catch (error) {
console.info('newRotatingVector_SensorJsTest032 On fail, errCode:' + error.code + ' ,msg:' + error.message); console.info('newRotatingVector_SensorJsTest019 On fail, errCode:' + error.code + ' ,msg:' + error.message);
expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE); expect(error.code).assertEqual(SERVICE_EXCEPTION_CODE);
expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG); expect(error.message).assertEqual(SERVICE_EXCEPTION_MSG);
done(); done();
...@@ -674,10 +673,197 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -674,10 +673,197 @@ describe("SensorJsTest_sensor_49", function () {
} }
}) })
} catch (error) { } catch (error) {
console.info("newRotatingVector_SensorJsTest032 Device does not support! "); console.info("newRotatingVector_SensorJsTest019 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE); expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0200
* @tc.name: newRotatingVector_SensorJsTest020
* @tc.desc: Functional Use Cases
*/
it("newRotatingVector_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newRotatingVector_SensorJsTest020--------------');
try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('newRotatingVector_SensorJsTest020 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, { 'interval': undefined });
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest020 off in--------------');
try {
sensor.off(sensor.SensorId.ROTATION_VECTOR, callback);
sensor.off(sensor.SensorId.ROTATION_VECTOR, callback2);
} catch (error) {
console.info("newRotatingVector_SensorJsTest020 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newRotatingVector_SensorJsTest020 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('newRotatingVector_SensorJsTest020 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0210
* @tc.name: newRotatingVector_SensorJsTest021
* @tc.desc: Illegal ID passed in
*/
it("newRotatingVector_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('newRotatingVector_SensorJsTest021 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, undefined);
try{
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, { 'interval': undefined });
} catch(error){
console.info('newRotatingVector_SensorJsTest021 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest021 off in--------------');
try {
sensor.off(sensor.SensorId.ROTATION_VECTOR);
} catch (error) {
console.info("newRotatingVector_SensorJsTest021 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newRotatingVector_SensorJsTest021 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0220
* @tc.name: newRotatingVector_SensorJsTest022
* @tc.desc: For normal scenarios
*/
it("newRotatingVector_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest022--------------');
try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('newRotatingVector_SensorJsTest022 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, null);
try{
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, { 'interval': null });
} catch(error){
console.info('newRotatingVector_SensorJsTest022 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest022 off in--------------');
try {
sensor.off(sensor.SensorId.ROTATION_VECTOR);
} catch (error) {
console.info("newRotatingVector_SensorJsTest022 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('newRotatingVector_SensorJsTest022 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0230
* @tc.name: newRotatingVector_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newRotatingVector_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------newRotatingVector_SensorJsTest023--------------');
try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('newRotatingVector_SensorJsTest023 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest023 off in--------------');
try {
sensor.off(sensor.SensorId.ROTATION_VECTOR);
} catch (error) {
console.info("newRotatingVector_SensorJsTest023 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("newRotatingVector_SensorJsTest023 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_NEWROTATION_VECTOR_JSTest_0240
* @tc.name: newRotatingVector_SensorJsTest024
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("newRotatingVector_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('newRotatingVector_SensorJsTest024 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorId.ROTATION_VECTOR, callback, { 'interval': 100000000 });
} catch(error){
console.info("newRotatingVector_SensorJsTest024 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------newRotatingVector_SensorJsTest024 off in--------------');
try {
sensor.off(sensor.SensorId.ROTATION_VECTOR);
} catch (error) {
console.info("newRotatingVector_SensorJsTest024 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------newRotatingVector_SensorJsTest024 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("newRotatingVector_SensorJsTest024 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -24,7 +24,7 @@ describe("SensorJsTest_sensor_60", function () { ...@@ -24,7 +24,7 @@ describe("SensorJsTest_sensor_60", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function() { afterAll(function() {
...@@ -32,7 +32,7 @@ describe("SensorJsTest_sensor_60", function () { ...@@ -32,7 +32,7 @@ describe("SensorJsTest_sensor_60", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function() { beforeEach(function() {
...@@ -40,7 +40,7 @@ describe("SensorJsTest_sensor_60", function () { ...@@ -40,7 +40,7 @@ describe("SensorJsTest_sensor_60", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function() { afterEach(function() {
...@@ -48,7 +48,7 @@ describe("SensorJsTest_sensor_60", function () { ...@@ -48,7 +48,7 @@ describe("SensorJsTest_sensor_60", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import sensor from '@ohos.sensor'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function SensorJsTest_sensor_38() {
describe("SensorJsTest_sensor_38", function () {
beforeAll(function() {
/*
* @tc.setup: setup invoked before all testcases
*/
console.info('beforeAll called')
})
afterAll(function() {
/*
* @tc.teardown: teardown invoked after all testcases
*/
console.info('afterAll called')
})
beforeEach(function() {
/*
* @tc.setup: setup invoked before each testcases
*/
console.info('beforeEach called')
})
afterEach(function() {
/*
* @tc.teardown: teardown invoked after each testcases
*/
console.info('afterEach called')
})
const PARAMETER_ERROR_CODE = 401
const SERVICE_EXCEPTION_CODE = 14500101
const EPS = 0.01
const PARAMETER_ERROR_MSG = 'The parameter invalid.'
const SERVICE_EXCEPTION_MSG = 'Service exception.'
let GEOMAGNETIC_COMPONENT_YEAR_RESULT = [
[6570.3935546875, -146.3289337158203, 54606.0078125, -1.2758207321166992, 83.13726043701172, 6572.02294921875, 55000.0703125],
[6554.17041015625, -87.19947052001953, 54649.078125, -0.7622424364089966, 83.16046905517578, 6554.75048828125, 55040.7734375],
[6537.99169921875, -28.231582641601562, 54692.02734375, -0.24740631878376007, 83.18303680419922, 6538.052734375, 55081.4296875],
[6521.81201171875, 30.73670768737793, 54734.97265625, 0.2700277864933014, 83.20502471923828, 6521.88427734375, 55122.15625],
[6505.6328125, 89.70511627197266, 54777.90625, 0.7899921536445618, 83.22642517089844, 6506.2509765625, 55162.9453125]]
let GEOMAGNETIC_COMPONENT_COORDINATES_RESULT = [
[6570.3935546875, -146.3289337158203, 54606.0078125, -1.2758207321166992, 83.13726043701172, 6572.02294921875, 55000.0703125],
[39624.28125, 109.8766098022461, -10932.4638671875, 0.15887857973575592, -15.424291610717773, 39624.43359375, 41104.921875],
[37636.72265625, 104.90892791748047, -10474.810546875, 0.15970633924007416, -15.552550315856934, 37636.8671875, 39067.3203125],
[5940.583984375, 15772.0927734375, -52480.7578125, 69.36103820800781, -72.19599914550781, 16853.765625, 55120.58984375],
[5744.87255859375, 14799.48046875, -49969.40234375, 68.78474426269531, -72.37483215332031, 15875.3955078125, 52430.61328125]]
let GEOMAGNETIC_COORDINATES = [[80, 0, 0],
[0, 120, 0],
[0, 120, 100000],
[-80, 240, 0],
[-80, 240, 100000]]
let timeMillis = [1580486400000, 1612108800000, 1643644800000, 1675180800000, 1706716800000]
/*
* @tc.name:Sensor_GetGeomagneticField_058
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: I5SWJI
*/
it("Sensor_GetGeomagneticInfo_058", 0, async function (done) {
console.info("---------------------------Sensor_GetGeomagneticInfo_058----------------------------------");
for (let i = 0; i < timeMillis.length; i++) {
await sensor.getGeomagneticInfo({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[i], undefined).then((data) => {
console.info('Sensor_GetGeomagneticField_058 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip
+ ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity);
expect(Math.abs(data.x - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][0]) < EPS).assertTrue()
expect(Math.abs(data.y - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][1]) < EPS).assertTrue()
expect(Math.abs(data.z - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][2]) < EPS).assertTrue()
expect(Math.abs(data.deflectionAngle - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][3]) < EPS).assertTrue()
expect(Math.abs(data.geomagneticDip - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][4]) < EPS).assertTrue()
expect(Math.abs(data.levelIntensity - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][5]) < EPS).assertTrue()
expect(Math.abs(data.totalIntensity - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][6]) < EPS).assertTrue()
}).catch((error) => {
console.info("Sensor_GetGeomagneticInfo_058 promise::catch", error);
})
}
done()
})
/*
* @tc.name:Sensor_GetGeomagneticInfo_058
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: I5SWJI
*/
it("Sensor_GetGeomagneticInfo_059", 0, async function (done) {
console.info("---------------------------Sensor_GetGeomagneticInfo_059----------------------------------");
for (let i = 0; i < timeMillis.length; i++) {
await sensor.getGeomagneticInfo({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[i], null).then((data) => {
console.info('Sensor_GetGeomagneticInfo_059 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip
+ ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity);
expect(Math.abs(data.x - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][0]) < EPS).assertTrue()
expect(Math.abs(data.y - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][1]) < EPS).assertTrue()
expect(Math.abs(data.z - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][2]) < EPS).assertTrue()
expect(Math.abs(data.deflectionAngle - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][3]) < EPS).assertTrue()
expect(Math.abs(data.geomagneticDip - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][4]) < EPS).assertTrue()
expect(Math.abs(data.levelIntensity - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][5]) < EPS).assertTrue()
expect(Math.abs(data.totalIntensity - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][6]) < EPS).assertTrue()
}).catch((error) => {
console.info("promise::catch", error);
})
}
done()
})
/*
* @tc.name:Sensor_GetGeomagneticInfo_060
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: I5SWJI
*/
it("Sensor_GetGeomagneticInfo_060", 0, async function (done) {
console.info("---------------------------Sensor_GetGeomagneticInfo_060----------------------------------");
for (let i = 0; i < timeMillis.length; i++) {
await sensor.getGeomagneticInfo({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[i], "abc").then((data) => {
console.info('Sensor_GetGeomagneticInfo_060 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip
+ ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity);
expect(Math.abs(data.x - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][0]) < EPS).assertTrue()
expect(Math.abs(data.y - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][1]) < EPS).assertTrue()
expect(Math.abs(data.z - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][2]) < EPS).assertTrue()
expect(Math.abs(data.deflectionAngle - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][3]) < EPS).assertTrue()
expect(Math.abs(data.geomagneticDip - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][4]) < EPS).assertTrue()
expect(Math.abs(data.levelIntensity - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][5]) < EPS).assertTrue()
expect(Math.abs(data.totalIntensity - GEOMAGNETIC_COMPONENT_YEAR_RESULT[i][6]) < EPS).assertTrue()
}).catch((error) => {
console.info("promise::catch", error);
})
}
done()
})
const SENSOR_DATA_MATRIX = [
{
"rotation": [-0.7980074882507324, 0.5486301183700562, 0.24937734007835388, -0.17277367413043976,
-0.6047078967094421, 0.7774815559387207, 0.5773502588272095, 0.5773502588272095,0.5773502588272095],
"inclination":[1, 0, 0, 0, 0.20444221794605255,0.9788785576820374, 0, -0.9788785576820374, 0.20444221794605255]
},
{
"rotation": [-0.8206444382667542, 0.3832680284976959, 0.42384934425354004, 0.021023601293563843,
-0.7209705710411072,0.6926466822624207, 0.5710522532463074,0.57732754945755,0.5836028456687927],
"inclination":[1, 0, 0, 0, 0.2584352493286133,0.9660285115242004, 0, -0.9660285115242004, 0.2584352493286133]
},
{
"rotation": [0.9583651423454285, 0.08038506656885147, -0.27399733662605286, 0.160231813788414,
-0.9456362724304199, 0.2830156981945038, -0.23635157942771912, -0.3151354491710663, -0.9191450476646423],
"inclination":[1, 0, 0, 0, 0.34239840507507324, 0.9395548701286316, 0, -0.9395548701286316, 0.34239840507507324]
},
{
"rotation":[null, null, null, null, null, null, null, null, null],
"inclination":[1, 0, 0, 0, null, null, 0, null ,null]
},
{
"rotation":[null, null, null, null, null, null,0, 0, 0],
"inclination":[1, 0, 0, 0, null, 0, 0, 0, null]
}
];
let GET_DIRECTION = [
[ 0.38050639629364014, -0.9783217310905457, -0.6610431671142578],
[-2.7610862255096436, 1.5018651485443115, 2.987273931503296],
[0.32175055146217346, -1.006853699684143, -0.6857295036315918],
[1.3332617282867432, -1.5440233945846558, -0.6627295017242432],
[NaN, NaN, NaN],
[0.7853981852531433, -0.6154797077178955, -0.7853981852531433],
[0.7853981852531433, -0.7853981852531433, -0.7853981852531433],
[0.785398, -0.615480, -0.785398],
[0.785398, -0.785398, -0.785398]
]
let rotationMatrix = [
[1, 2, 3, 4, 5, 6, 7, 8, 9],
[-1, -2, -3, -4, -5, -6, -7, -78, -45],
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
[11111111, 21111111, 31111111, 4111111, 5111111, 61111111, 71111111, 811111111, 91111111],
[NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN],
[3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38],
[3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39],
[3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38],
[3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39]
]
let gravity = [
[9, 9, 9], [91, 92, 93], [-9, -12, -35], [NaN, NaN, NaN], [3.40282e+38, 3.40282e+38, 3.40282e+38], [3.40282e+39, 3.40282e+39, 3.40282e+39]
]
let geomagnetic = [
[30, 25, 41], [3, 2, 4], [-123, -456, -564], [3.40282e+38, 3.40282e+38, 3.40282e+38], [NaN, NaN, NaN]
]
let createRotationMatrixResult = [
[0.6724675297737122,-0.10471208393573761,0.7326819896697998,0.06531608104705811,0.9944750070571899,
0.08217836916446686,-0.7372390031814575,-0.007406365126371384,0.6755914688110352],
[1,0,0,0,1,0,0,0,1]
]
/*
* tc.name: Sensor_CreateRotationMatrix_015
* tc.desc: Verification results of the incorrect parameters of test interface.
* tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_CreateRotationMatrix_015', 0, async function (done) {
sensor.getRotationMatrix(gravity[0], geomagnetic[0], undefined).then((data) => {
console.info("Sensor_CreateRotationMatrix_015" + JSON.stringify(data))
expect(JSON.stringify(data)).assertEqual(JSON.stringify(SENSOR_DATA_MATRIX[0]))
done()
}, (error) => {
expect(false).assertTrue();
done()
})
})
/*
* tc.name: Sensor_CreateRotationMatrix_016
* tc.desc: Verification results of the incorrect parameters of test interface.
* tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_CreateRotationMatrix_016', 0, async function (done) {
sensor.getRotationMatrix(gravity[0], geomagnetic[0], null).then((data) => {
console.info("Sensor_CreateRotationMatrix_016" + JSON.stringify(data))
expect(JSON.stringify(data)).assertEqual(JSON.stringify(SENSOR_DATA_MATRIX[0]))
done()
}, (error) => {
expect(false).assertTrue();
done()
})
})
/*
* tc.name: Sensor_CreateRotationMatrix_017
* tc.desc: Verification results of the incorrect parameters of test interface.
* tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_CreateRotationMatrix_017', 0, async function (done) {
sensor.getRotationMatrix([0, 0, 0], undefined).then((data) => {
for(let i = 0; i < data.length; i++) {
console.info("Sensor_CreateRotationMatrix_017 [" + i + "] : " + data[i]);
expect(data[i]).assertEqual(createRotationMatrixResult[1][i])
}
done()
}, (error) => {
expect(false).assertTrue();
done()
})
})
/*
* tc.name: Sensor_CreateRotationMatrix_018
* tc.desc: Verification results of the incorrect parameters of test interface.
* tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_CreateRotationMatrix_018', 0, async function (done) {
sensor.getRotationMatrix([0, 0, 0], null).then((data) => {
for(let i = 0; i < data.length; i++) {
console.info("Sensor_CreateRotationMatrix_018 [" + i + "] : " + data[i]);
expect(data[i]).assertEqual(createRotationMatrixResult[1][i])
}
done()
}, (error) => {
expect(false).assertTrue();
done()
})
})
/**
* test
*
* @tc.name: Sensor_GetDirection_011
* @tc.desc: Verification results of the incorrect parameters of the test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_GetDirection_011', 0, async function (done) {
sensor.getOrientation(rotationMatrix[0], undefined).then((data) => {
for (let i = 0; i < data.length; i++) {
console.info("Sensor_GetDirection_011" + data[i])
expect(data[i]).assertEqual(GET_DIRECTION[0][i])
}
done()
}, (error) => {
expect(false).assertTrue();
done()
})
})
/**
* test
*
* @tc.name: Sensor_GetDirection_012
* @tc.desc: Verification results of the incorrect parameters of the test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_GetDirection_012', 0, async function (done) {
sensor.getOrientation(rotationMatrix[0], null).then((data) => {
for (let i = 0; i < data.length; i++) {
console.info("Sensor_GetDirection_012" + data[i])
expect(data[i]).assertEqual(GET_DIRECTION[0][i])
}
done()
}, (error) => {
expect(false).assertTrue();
done()
})
})
let ANGLECHANGE_9_RESULT = [
[0.7853981852531433, NaN, -0.32175055146217346], //123123123
[0.7853981852531433, NaN, -0.7853981852531433], //FLOAT.MAXVALUE
[0.0, -0.0, -0.0], //FLOAT.MINVALUE
[0.7853981852531433, NaN, -0.7853981852531433], //FLOAT.MAXVALUE+1
];
/*
* @tc.name:Sensor_GetAngleModify_017
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: I5SWJI
*/
it('Sensor_GetAngleModify_017', 0, async function (done) {
console.info('----------------------Sensor_GetAngleModify_017---------------------------');
sensor.getAngleVariation([1,2,3,1,2,3,1,2,3], [2,2,2,2,2,2,2,2,2], undefined).then((data) => {
for(let i = 0; i < data.length; i++) {
console.info("Sensor_GetAngleModify_017 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(Number.isNaN(data[1])).assertTrue() &&
expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[0][2]);
}
done();
}, (error) => {
expect(false).assertTrue();
done()
})
})
/*
* @tc.name:Sensor_GetAngleModify_018
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: I5SWJI
*/
it('Sensor_GetAngleModify_018', 0, async function (done) {
console.info('----------------------Sensor_GetAngleModify_018---------------------------');
sensor.getAngleVariation([1,2,3,1,2,3,1,2,3], [2,2,2,2,2,2,2,2,2], null).then((data) => {
for(let i = 0; i < data.length; i++) {
console.info("Sensor_GetAngleModify_018 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(Number.isNaN(data[1])).assertTrue() &&
expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[0][2]);
}
done();
}, (error) => {
expect(false).assertTrue();
done()
})
})
/*
* @tc.name:Sensor_GetAngleModify_019
* @tc.desc:verify app info is not null
* @tc.type: FUNC
* @tc.require: I5SWJI
*/
it('Sensor_GetAngleModify_019', 0, async function (done) {
console.info('----------------------Sensor_GetAngleModify_019---------------------------');
sensor.getAngleVariation([1,2,3,1,2,3,1,2,3], [2,2,2,2,2,2,2,2,2], null).then((data) => {
for(let i = 0; i < data.length; i++) {
console.info("Sensor_GetAngleModify_019 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(Number.isNaN(data[1])).assertTrue() &&
expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[0][2]);
}
done();
}, (error) => {
expect(false).assertTrue();
done()
})
})
const result = [
[0.7441122531890869, 0.5199999809265137, -0.335999995470047, -0.25099998712539673],
[0, 3.402820018375656e+38, 3.402820018375656e+38, 3.402820018375656e+38],
[1, 0, 0, 0],
[0.7183529734611511, -0.32499998807907104, -0.5619999766349792, -0.25],
[0, 0, 0, 0]
];
/*
* test
*
* @tc.name: Sensor_CreateQuaternion_016
* @tc.desc: Verification results of the incorrect parameters of the test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_CreateQuaternion_016', 0, async function (done) {
sensor.getQuaternion([0.52, -0.336, -0.251], undefined).then((data) => {
console.info('Sensor_CreateQuaternion_016');
for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]);
expect(data[i]).assertEqual(result[0][i])
}
done()
}, (error) => {
expect(false).assertTrue();
done()
})
})
/*
* test
*
* @tc.name: Sensor_CreateQuaternion_017
* @tc.desc: Verification results of the incorrect parameters of the test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_CreateQuaternion_017', 0, async function (done) {
sensor.getQuaternion([0.52, -0.336, -0.251], null).then((data) => {
console.info('Sensor_CreateQuaternion_017');
for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]);
expect(data[i]).assertEqual(result[0][i])
}
done()
}, (error) => {
expect(false).assertTrue();
done()
})
})
const getGeomagneticDipResult = [ 0.8760581016540527, 0.862170, -Infinity, 44330];
/*
* @tc.name: Sensor_GetGeomagneticDip_008
* @tc.desc: Verification results of the incorrect parameters of test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_GetGeomagneticDip_008', 0, async function (done) {
sensor.getInclination([1, 2, 3, 4, 5, 6, 7, 8, 9], undefined).then((data) => {
console.info("Sensor_GetGeomagneticDip_008" + data)
expect(data).assertEqual(getGeomagneticDipResult[0])
done()
}, (error) => {
console.info('Sensor_GetGeomagneticDip_008 failed');
expect(false).assertTrue();
done()
});
})
/*
* @tc.name: Sensor_GetGeomagneticDip_009
* @tc.desc: Verification results of the incorrect parameters of test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_GetGeomagneticDip_009', 0, async function (done) {
sensor.getInclination([1, 2, 3, 4, 5, 6, 7, 8, 9], null).then((data) => {
console.info("Sensor_GetGeomagneticDip_009" + data)
expect(data).assertEqual(getGeomagneticDipResult[0])
done()
}, (error) => {
console.info('Sensor_GetGeomagneticDip_009 failed');
expect(false).assertTrue();
done()
});
})
/*
* @tc.name: Sensor_GetAltitude_009
* @tc.desc: Verification results of the incorrect parameters of test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_GetAltitude_009', 0, async function (done) {
sensor.getDeviceAltitude(0, 100, undefined).then((data) => {
console.info("Sensor_GetAltitude_009" + data)
expect(data).assertEqual(getGeomagneticDipResult[2])
done()
}, (error) => {
console.info('Sensor_GetAltitude_009 failed');
expect(false).assertTrue();
done()
});
})
/*
* @tc.name: Sensor_GetAltitude_010
* @tc.desc: Verification results of the incorrect parameters of test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_GetAltitude_010', 0, async function (done) {
sensor.getDeviceAltitude(0, 100, null).then((data) => {
console.info("Sensor_GetAltitude_010" + data)
expect(data).assertEqual(getGeomagneticDipResult[2])
done()
}, (error) => {
console.info('Sensor_GetAltitude_010 failed');
expect(false).assertTrue();
done()
});
})
/*
* @tc.name: Sensor_GetAltitude_011
* @tc.desc: Verification results of the incorrect parameters of test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it('Sensor_GetAltitude_011', 0, async function (done) {
sensor.getDeviceAltitude(0, 100, "abc").then((data) => {
console.info("Sensor_GetAltitude_011" + data)
expect(data).assertEqual(getGeomagneticDipResult[2])
done()
}, (error) => {
console.info('Sensor_GetAltitude_011 failed');
expect(false).assertTrue();
done()
});
})
let transformCoordinateSystemResult = [
[1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000, 1.500000],
[340282001837565600000000000000000000000.000000, 340282001837565600000000000000000000000.000000, 340282001837565600000000000000000000000.000000,
340282001837565600000000000000000000000.000000, 340282001837565600000000000000000000000.000000, 340282001837565600000000000000000000000.000000,
340282001837565600000000000000000000000.000000, 340282001837565600000000000000000000000.000000, 340282001837565600000000000000000000000.000000],
[Infinity, -Infinity, Infinity, Infinity, -Infinity, Infinity, Infinity, -Infinity, Infinity]]
/*
* @tc.name: Sensor_TransformCoordinateSystem_011
* @tc.desc: Verification results of the incorrect parameters of test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it("Sensor_TransformCoordinateSystem_011", 0, async function (done) {
console.info("---------------------------Sensor_TransformCoordinateSystem_011----------------------------------");
sensor.transformRotationMatrix([1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], {'x':1, 'y':2}, undefined).then((data) => {
for (let i = 0; i < data.length; i++) {
console.info("Sensor_TransformCoordinateSystem_011 data[ " + i + "] = " + data[i]);
expect(data[i]).assertEqual(transformCoordinateSystemResult[0][i]);
}
done()
}, (error) => {
console.info('Sensor_TransformCoordinateSystem_011 failed');
expect(false).assertTrue();
done()
});
})
/*
* @tc.name: Sensor_TransformCoordinateSystem_012
* @tc.desc: Verification results of the incorrect parameters of test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it("Sensor_TransformCoordinateSystem_012", 0, async function (done) {
console.info("---------------------------Sensor_TransformCoordinateSystem_012----------------------------------");
sensor.transformRotationMatrix([1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], {'x':1, 'y':2}, null).then((data) => {
for (let i = 0; i < data.length; i++) {
console.info("Sensor_TransformCoordinateSystem_012 data[ " + i + "] = " + data[i]);
expect(data[i]).assertEqual(transformCoordinateSystemResult[0][i]);
}
done()
}, (error) => {
console.info('Sensor_TransformCoordinateSystem_012 failed');
expect(false).assertTrue();
done()
});
})
/*
* @tc.name: Sensor_TransformCoordinateSystem_013
* @tc.desc: Verification results of the incorrect parameters of test interface.
* @tc.require: I5SWJI
* @tc.author:
*/
it("Sensor_TransformCoordinateSystem_013", 0, async function (done) {
console.info("---------------------------Sensor_TransformCoordinateSystem_013----------------------------------");
sensor.transformRotationMatrix([1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], {'x':1, 'y':2}, "abc").then((data) => {
for (let i = 0; i < data.length; i++) {
console.info("Sensor_TransformCoordinateSystem_013 data[ " + i + "] = " + data[i]);
expect(data[i]).assertEqual(transformCoordinateSystemResult[0][i]);
}
done()
}, (error) => {
console.info('Sensor_TransformCoordinateSystem_013 failed');
expect(false).assertTrue();
done()
});
})
})}
\ No newline at end of file
...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_50", function () { ...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_50", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_50", function () { ...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_50", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_50", function () { ...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_50", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_50", function () { ...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_50", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_58", function () { ...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_58", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_58", function () { ...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_58", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_58", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_58", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_58", function () { ...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_58", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -23,7 +23,7 @@ describe("SystemServiceExceptionTest", function () { ...@@ -23,7 +23,7 @@ describe("SystemServiceExceptionTest", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SystemServiceExceptionTest", function () { ...@@ -31,7 +31,7 @@ describe("SystemServiceExceptionTest", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SystemServiceExceptionTest", function () { ...@@ -39,7 +39,7 @@ describe("SystemServiceExceptionTest", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,7 +47,7 @@ describe("SystemServiceExceptionTest", function () { ...@@ -47,7 +47,7 @@ describe("SystemServiceExceptionTest", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let invild = -1; let invild = -1;
......
...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_59", function () { ...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_59", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_59", function () { ...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_59", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_59", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_59", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_59", function () { ...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_59", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_3() { export default function SensorJsTest_sensor_3() {
describe("SensorJsTest_sensor_3", function () { describe("SensorJsTest_sensor_3", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_3", function () { ...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_3", function () {
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_3", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_3", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_3", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_3", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_3", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_3", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,11 +62,14 @@ describe("SensorJsTest_sensor_3", function () { ...@@ -62,11 +62,14 @@ describe("SensorJsTest_sensor_3", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401
const SERVICE_EXCEPTION_CODE = 14500101
const PARAMETER_ERROR_MSG = 'The parameter invalid.'
const SERVICE_EXCEPTION_MSG = 'Service exception.'
let errMessages = ['string is not defined','The parameter invalid']; let errMessages = ['string is not defined','The parameter invalid'];
let errMessage; let errMessage;
/* /*
...@@ -295,7 +298,6 @@ describe("SensorJsTest_sensor_3", function () { ...@@ -295,7 +298,6 @@ describe("SensorJsTest_sensor_3", function () {
} catch (error) { } catch (error) {
console.info("Accelerometer_SensorJsTest012 error:" + error); console.info("Accelerometer_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------Accelerometer_SensorJsTest012 off end---------------------------'); console.info('----------------------Accelerometer_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -322,4 +324,141 @@ describe("SensorJsTest_sensor_3", function () { ...@@ -322,4 +324,141 @@ describe("SensorJsTest_sensor_3", function () {
done(); done();
}, 1000); }, 1000);
}) })
/*
* @tc.number: SUB_SensorsSystem_ACCELEROMETER_JSTest_0140
* @tc.name: Accelerometer_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Accelerometer_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------Accelerometer_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2);
} catch (error) {
console.info("Accelerometer_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Accelerometer_SensorJsTest014 off end--------------');
done()
}, 1000);
})
/*
* @tc.number: SUB_SensorsSystem_ACCELEROMETER_JSTest_0150
* @tc.name: Accelerometer_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Accelerometer_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------Accelerometer_SensorJsTest015--------------');
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, { 'interval': undefined });
} catch(error){
console.info('Accelerometer_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Accelerometer_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER);
} catch (error) {
console.info("Accelerometer_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
})
/*
* @tc.number: SUB_SensorsSystem_ACCELEROMETER_JSTest_0160
* @tc.name: Accelerometer_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Accelerometer_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------Accelerometer_SensorJsTest016--------------');
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, { 'interval': null });
} catch(error){
console.info('Accelerometer_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Accelerometer_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER);
} catch (error) {
console.info("Accelerometer_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
})
/*
* @tc.number: SUB_SensorsSystem_ACCELEROMETER_JSTest_0170
* @tc.name: Accelerometer_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Accelerometer_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------Accelerometer_SensorJsTest017--------------');
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------Accelerometer_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER);
} catch (error) {
console.info("Accelerometer_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
})
/*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0180
* @tc.name: Accelerometer_SensorJsTest018
* @tc.desc: Functional Use Cases
*/
it("Accelerometer_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------Accelerometer_SensorJsTest018--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, null);
setTimeout(() => {
done();
}, 1000);
} catch(error){
console.info('Accelerometer_SensorJsTest018 error:'+error);
expect(false).assertTrue();
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ACCELEROMETER_JSTest_0190
* @tc.name: Accelerometer_SensorJsTest019
* @tc.desc: Functional Use Cases
*/
it("Accelerometer_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------Accelerometer_SensorJsTest019--------------');
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, { 'interval': 100000000 });
} catch(error){
console.info("Accelerometer_SensorJsTest019 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------Accelerometer_SensorJsTest019 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER);
} catch (error) {
console.info("Accelerometer_SensorJsTest019 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Accelerometer_SensorJsTest019 off end--------------');
done()
}, 1000);
})
})} })}
...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_6", function () { ...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_6", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_6", function () { ...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_6", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_6", function () { ...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_6", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_6", function () { ...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_6", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let errMessages = ['string is not defined','The parameter invalid']; let errMessages = ['string is not defined','The parameter invalid'];
......
...@@ -18,13 +18,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -18,13 +18,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_4() { export default function SensorJsTest_sensor_4() {
describe("SensorJsTest_sensor_4", function () { describe("SensorJsTest_sensor_4", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_4", function () { ...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_4", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_4", function () { ...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_4", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_4", function () { ...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_4", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_4", function () { ...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_4", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -385,7 +385,6 @@ describe("SensorJsTest_sensor_4", function () { ...@@ -385,7 +385,6 @@ describe("SensorJsTest_sensor_4", function () {
} catch (error) { } catch (error) {
console.info("Ambient_Light_SensorJsTest012 error:" + error); console.info("Ambient_Light_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------Ambient_Light_SensorJsTest012 off end---------------------------'); console.info('----------------------Ambient_Light_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -428,4 +427,191 @@ describe("SensorJsTest_sensor_4", function () { ...@@ -428,4 +427,191 @@ describe("SensorJsTest_sensor_4", function () {
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_Ambient_Light_JSTest_0140
* @tc.name: Ambient_Light_SensorJsTest014
* @tc.desc: Functional Use Cases
*/
it("Ambient_Light_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------Ambient_Light_SensorJsTest014--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('Ambient_Light_SensorJsTest014 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------Ambient_Light_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback2);
} catch (error) {
console.info("Ambient_Light_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Ambient_Light_SensorJsTest014 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('Ambient_Light_SensorJsTest014 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_Ambient_Light_JSTest_0150
* @tc.name: Ambient_Light_SensorJsTest015
* @tc.desc: Illegal ID passed in
*/
it("Ambient_Light_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('Ambient_Light_SensorJsTest015 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback, { 'interval': undefined });
} catch(error){
console.info('Ambient_Light_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Ambient_Light_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT);
} catch (error) {
console.info("Ambient_Light_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Ambient_Light_SensorJsTest015 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_Ambient_Light_JSTest_0160
* @tc.name: Ambient_Light_SensorJsTest016
* @tc.desc: For normal scenarios
*/
it("Ambient_Light_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Ambient_Light_SensorJsTest016--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('Ambient_Light_SensorJsTest016 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback, { 'interval': null });
} catch(error){
console.info('Ambient_Light_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Ambient_Light_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT);
} catch (error) {
console.info("Ambient_Light_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Ambient_Light_SensorJsTest016 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_Ambient_Light_JSTest_0170
* @tc.name: Ambient_Light_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Ambient_Light_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------Ambient_Light_SensorJsTest017--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('Ambient_Light_SensorJsTest017 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------Ambient_Light_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT);
} catch (error) {
console.info("Ambient_Light_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("Ambient_Light_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_Ambient_Light_JSTest_0180
* @tc.name: Ambient_Light_SensorJsTest018
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("Ambient_Light_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => {
if (error) {
console.info('Ambient_Light_SensorJsTest018 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback, { 'interval': 100000000 });
} catch(error){
console.info("Ambient_Light_SensorJsTest018 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------Ambient_Light_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT);
} catch (error) {
console.info("Ambient_Light_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Ambient_Light_SensorJsTest018 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("Ambient_Light_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -19,13 +19,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -19,13 +19,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_8() { export default function SensorJsTest_sensor_8() {
describe("SensorJsTest_sensor_8", function () { describe("SensorJsTest_sensor_8", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_8", function () { ...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_8", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_8", function () { ...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_8", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_8", function () { ...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_8", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_8", function () { ...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_8", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -387,7 +387,6 @@ describe("SensorJsTest_sensor_8", function () { ...@@ -387,7 +387,6 @@ describe("SensorJsTest_sensor_8", function () {
} catch (error) { } catch (error) {
console.info("Barometer_SensorJsTest012 error:" + error); console.info("Barometer_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------Barometer_SensorJsTest012 off end---------------------------'); console.info('----------------------Barometer_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -430,4 +429,191 @@ describe("SensorJsTest_sensor_8", function () { ...@@ -430,4 +429,191 @@ describe("SensorJsTest_sensor_8", function () {
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0140
* @tc.name: Barometer_SensorJsTest014
* @tc.desc: Functional Use Cases
*/
it("Barometer_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------Barometer_SensorJsTest014--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => {
if (error) {
console.info('Barometer_SensorJsTest014 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------Barometer_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback2);
} catch (error) {
console.info("Barometer_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Barometer_SensorJsTest014 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('Barometer_SensorJsTest014 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0150
* @tc.name: Barometer_SensorJsTest015
* @tc.desc: Illegal ID passed in
*/
it("Barometer_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => {
if (error) {
console.info('Barometer_SensorJsTest015 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback, { 'interval': undefined });
} catch(error){
console.info('Barometer_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Barometer_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER);
} catch (error) {
console.info("Barometer_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Barometer_SensorJsTest015 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0160
* @tc.name: Barometer_SensorJsTest016
* @tc.desc: For normal scenarios
*/
it("Barometer_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Barometer_SensorJsTest016--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => {
if (error) {
console.info('Barometer_SensorJsTest016 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback, { 'interval': null });
} catch(error){
console.info('Barometer_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Barometer_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER);
} catch (error) {
console.info("Barometer_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Barometer_SensorJsTest016 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0170
* @tc.name: Barometer_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Barometer_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------Barometer_SensorJsTest017--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => {
if (error) {
console.info('Barometer_SensorJsTest017 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------Barometer_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER);
} catch (error) {
console.info("Barometer_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("Barometer_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_BAROMETER_JSTest_0180
* @tc.name: Barometer_SensorJsTest018
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("Barometer_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => {
if (error) {
console.info('Barometer_SensorJsTest018 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback, { 'interval': 100000000 });
} catch(error){
console.info("Barometer_SensorJsTest018 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------Barometer_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER);
} catch (error) {
console.info("Barometer_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Barometer_SensorJsTest018 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("Barometer_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_9() { export default function SensorJsTest_sensor_9() {
describe("SensorJsTest_sensor_9", function () { describe("SensorJsTest_sensor_9", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_9", function () {
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_9", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_9", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_9", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_9", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -393,7 +393,6 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -393,7 +393,6 @@ describe("SensorJsTest_sensor_9", function () {
} catch (error) { } catch (error) {
console.info("Gravity_SensorJsTest012 error:" + error); console.info("Gravity_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------Gravity_SensorJsTest012 off end---------------------------'); console.info('----------------------Gravity_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -436,4 +435,191 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -436,4 +435,191 @@ describe("SensorJsTest_sensor_9", function () {
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0140
* @tc.name: Gravity_SensorJsTest014
* @tc.desc: Functional Use Cases
*/
it("Gravity_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------Gravity_SensorJsTest014--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => {
if (error) {
console.info('Gravity_SensorJsTest014 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------Gravity_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback2);
} catch (error) {
console.info("Gravity_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Gravity_SensorJsTest014 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('Gravity_SensorJsTest014 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0150
* @tc.name: Gravity_SensorJsTest015
* @tc.desc: Illegal ID passed in
*/
it("Gravity_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => {
if (error) {
console.info('Gravity_SensorJsTest015 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback, { 'interval': undefined });
} catch(error){
console.info('Gravity_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Gravity_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY);
} catch (error) {
console.info("Gravity_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Gravity_SensorJsTest015 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0160
* @tc.name: Gravity_SensorJsTest016
* @tc.desc: For normal scenarios
*/
it("Gravity_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Gravity_SensorJsTest016--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => {
if (error) {
console.info('Gravity_SensorJsTest016 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback, { 'interval': null });
} catch(error){
console.info('Gravity_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Gravity_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY);
} catch (error) {
console.info("Gravity_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Gravity_SensorJsTest016 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0170
* @tc.name: Gravity_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Gravity_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------Gravity_SensorJsTest017--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => {
if (error) {
console.info('Gravity_SensorJsTest017 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------Gravity_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY);
} catch (error) {
console.info("Gravity_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("Gravity_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0180
* @tc.name: Gravity_SensorJsTest018
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("Gravity_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => {
if (error) {
console.info('Gravity_SensorJsTest018 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback, { 'interval': 100000000 });
} catch(error){
console.info("Gravity_SensorJsTest018 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------Gravity_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY);
} catch (error) {
console.info("Gravity_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Gravity_SensorJsTest018 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("Gravity_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_5() { export default function SensorJsTest_sensor_5() {
describe("SensorJsTest_sensor_5", function () { describe("SensorJsTest_sensor_5", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_5", function () {
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_5", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_5", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_5", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_5", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -393,7 +393,6 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -393,7 +393,6 @@ describe("SensorJsTest_sensor_5", function () {
} catch (error) { } catch (error) {
console.info("Gyroscope_SensorJsTest012 error:" + error); console.info("Gyroscope_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------Gyroscope_SensorJsTest012 off end---------------------------'); console.info('----------------------Gyroscope_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -436,4 +435,191 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -436,4 +435,191 @@ describe("SensorJsTest_sensor_5", function () {
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0140
* @tc.name: Gyroscope_SensorJsTest014
* @tc.desc: Functional Use Cases
*/
it("Gyroscope_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------Gyroscope_SensorJsTest014--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => {
if (error) {
console.info('Gyroscope_SensorJsTest014 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------Gyroscope_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback2);
} catch (error) {
console.info("Gyroscope_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Gyroscope_SensorJsTest014 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('Gyroscope_SensorJsTest014 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0150
* @tc.name: Gyroscope_SensorJsTest015
* @tc.desc: Illegal ID passed in
*/
it("Gyroscope_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => {
if (error) {
console.info('Gyroscope_SensorJsTest015 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback, { 'interval': undefined });
} catch(error){
console.info('Gyroscope_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Gyroscope_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE);
} catch (error) {
console.info("Gyroscope_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Gyroscope_SensorJsTest015 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0160
* @tc.name: Gyroscope_SensorJsTest016
* @tc.desc: For normal scenarios
*/
it("Gyroscope_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Gyroscope_SensorJsTest016--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => {
if (error) {
console.info('Gyroscope_SensorJsTest016 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback, { 'interval': null });
} catch(error){
console.info('Gyroscope_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Gyroscope_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE);
} catch (error) {
console.info("Gyroscope_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Gyroscope_SensorJsTest016 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0170
* @tc.name: Gyroscope_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Gyroscope_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------Gyroscope_SensorJsTest017--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => {
if (error) {
console.info('Gyroscope_SensorJsTest017 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------Gyroscope_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE);
} catch (error) {
console.info("Gyroscope_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("Gyroscope_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GYROSCOPE_JSTest_0180
* @tc.name: Gyroscope_SensorJsTest018
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("Gyroscope_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => {
if (error) {
console.info('Gyroscope_SensorJsTest018 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback, { 'interval': 100000000 });
} catch(error){
console.info("Gyroscope_SensorJsTest018 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------Gyroscope_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE);
} catch (error) {
console.info("Gyroscope_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Gyroscope_SensorJsTest018 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("Gyroscope_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_10", function () { ...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_10", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_10", function () { ...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_10", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_10", function () { ...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_10", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_10", function () { ...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_10", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let errMessages = ['string is not defined','The parameter invalid']; let errMessages = ['string is not defined','The parameter invalid'];
......
...@@ -18,13 +18,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -18,13 +18,13 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_7() { export default function SensorJsTest_sensor_7() {
describe("SensorJsTest_sensor_7", function () { describe("SensorJsTest_sensor_7", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number"); expect(typeof (data.timestamp)).assertEqual("number");
} }
...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_7", function () { ...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_7", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_7", function () { ...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_7", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_7", function () { ...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_7", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_7", function () { ...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_7", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -383,7 +383,6 @@ describe("SensorJsTest_sensor_7", function () { ...@@ -383,7 +383,6 @@ describe("SensorJsTest_sensor_7", function () {
} catch (error) { } catch (error) {
console.info("Hall_SensorJsTest012 error:" + error); console.info("Hall_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------Hall_SensorJsTest012 off end---------------------------'); console.info('----------------------Hall_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -426,4 +425,191 @@ describe("SensorJsTest_sensor_7", function () { ...@@ -426,4 +425,191 @@ describe("SensorJsTest_sensor_7", function () {
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0140
* @tc.name: Hall_SensorJsTest014
* @tc.desc: Functional Use Cases
*/
it("Hall_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------Hall_SensorJsTest014--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => {
if (error) {
console.info('Hall_SensorJsTest014 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------Hall_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback2);
} catch (error) {
console.info("Hall_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Hall_SensorJsTest014 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('Hall_SensorJsTest014 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0150
* @tc.name: Hall_SensorJsTest015
* @tc.desc: Illegal ID passed in
*/
it("Hall_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => {
if (error) {
console.info('Hall_SensorJsTest015 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback, { 'interval': undefined });
} catch(error){
console.info('Hall_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Hall_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL);
} catch (error) {
console.info("Hall_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Hall_SensorJsTest015 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0160
* @tc.name: Hall_SensorJsTest016
* @tc.desc: For normal scenarios
*/
it("Hall_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Hall_SensorJsTest016--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => {
if (error) {
console.info('Hall_SensorJsTest016 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback, { 'interval': null });
} catch(error){
console.info('Hall_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Hall_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL);
} catch (error) {
console.info("Hall_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Hall_SensorJsTest016 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0170
* @tc.name: Hall_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Hall_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------Hall_SensorJsTest017--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => {
if (error) {
console.info('Hall_SensorJsTest017 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------Hall_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL);
} catch (error) {
console.info("Hall_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("Hall_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_HALL_JSTest_0180
* @tc.name: Hall_SensorJsTest018
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("Hall_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => {
if (error) {
console.info('Hall_SensorJsTest018 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback, { 'interval': 100000000 });
} catch(error){
console.info("Hall_SensorJsTest018 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------Hall_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL);
} catch (error) {
console.info("Hall_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Hall_SensorJsTest018 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("Hall_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_11", function () { ...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_11", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_11", function () { ...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_11", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_11", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_11", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_11", function () { ...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_11", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_12", function () { ...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_12", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_12", function () { ...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_12", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_12", function () { ...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_12", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_12", function () { ...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_12", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_13", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_13", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_13", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_13", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_13", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_13", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_13", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_13", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let errMessages = ['string is not defined','The parameter invalid']; let errMessages = ['string is not defined','The parameter invalid'];
......
...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_15() { export default function SensorJsTest_sensor_15() {
describe("SensorJsTest_sensor_15", function () { describe("SensorJsTest_sensor_15", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_15", function () {
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_15", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_15", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_15", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_15", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -393,7 +393,6 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -393,7 +393,6 @@ describe("SensorJsTest_sensor_15", function () {
} catch (error) { } catch (error) {
console.info("MagneticField_SensorJsTest012 error:" + error); console.info("MagneticField_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------MagneticField_SensorJsTest012 off end---------------------------'); console.info('----------------------MagneticField_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -436,4 +435,191 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -436,4 +435,191 @@ describe("SensorJsTest_sensor_15", function () {
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0140
* @tc.name: MagneticField_SensorJsTest014
* @tc.desc: Functional Use Cases
*/
it("MagneticField_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------MagneticField_SensorJsTest014--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('MagneticField_SensorJsTest014 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------MagneticField_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback2);
} catch (error) {
console.info("MagneticField_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------MagneticField_SensorJsTest014 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('MagneticField_SensorJsTest014 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0150
* @tc.name: MagneticField_SensorJsTest015
* @tc.desc: Illegal ID passed in
*/
it("MagneticField_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('MagneticField_SensorJsTest015 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback, { 'interval': undefined });
} catch(error){
console.info('MagneticField_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------MagneticField_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD);
} catch (error) {
console.info("MagneticField_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('MagneticField_SensorJsTest015 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0160
* @tc.name: MagneticField_SensorJsTest016
* @tc.desc: For normal scenarios
*/
it("MagneticField_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------MagneticField_SensorJsTest016--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('MagneticField_SensorJsTest016 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback, { 'interval': null });
} catch(error){
console.info('MagneticField_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------MagneticField_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD);
} catch (error) {
console.info("MagneticField_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('MagneticField_SensorJsTest016 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0170
* @tc.name: MagneticField_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("MagneticField_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------MagneticField_SensorJsTest017--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('MagneticField_SensorJsTest017 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------MagneticField_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD);
} catch (error) {
console.info("MagneticField_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("MagneticField_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_GRAVITY_JSTest_0180
* @tc.name: MagneticField_SensorJsTest018
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("MagneticField_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => {
if (error) {
console.info('MagneticField_SensorJsTest018 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback, { 'interval': 100000000 });
} catch(error){
console.info("MagneticField_SensorJsTest018 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------MagneticField_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD);
} catch (error) {
console.info("MagneticField_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------MagneticField_SensorJsTest018 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("MagneticField_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_14", function () { ...@@ -44,7 +44,7 @@ describe("SensorJsTest_sensor_14", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_14", function () { ...@@ -52,7 +52,7 @@ describe("SensorJsTest_sensor_14", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_14", function () { ...@@ -60,7 +60,7 @@ describe("SensorJsTest_sensor_14", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_14", function () { ...@@ -68,7 +68,7 @@ describe("SensorJsTest_sensor_14", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let errMessages = ['string is not defined','The parameter invalid']; let errMessages = ['string is not defined','The parameter invalid'];
......
...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_16() { export default function SensorJsTest_sensor_16() {
describe("SensorJsTest_sensor_16", function () { describe("SensorJsTest_sensor_16", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -26,7 +26,7 @@ describe("SensorJsTest_sensor_16", function () {
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number");
...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -38,7 +38,7 @@ describe("SensorJsTest_sensor_16", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -46,7 +46,7 @@ describe("SensorJsTest_sensor_16", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -54,7 +54,7 @@ describe("SensorJsTest_sensor_16", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -62,7 +62,7 @@ describe("SensorJsTest_sensor_16", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -393,7 +393,6 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -393,7 +393,6 @@ describe("SensorJsTest_sensor_16", function () {
} catch (error) { } catch (error) {
console.info("Orientating_SensorJsTest012 error:" + error); console.info("Orientating_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------Orientating_SensorJsTest012 off end---------------------------'); console.info('----------------------Orientating_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -436,4 +435,191 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -436,4 +435,191 @@ describe("SensorJsTest_sensor_16", function () {
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0140
* @tc.name: Orientating_SensorJsTest014
* @tc.desc: Functional Use Cases
*/
it("Orientating_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------Orientating_SensorJsTest014--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => {
if (error) {
console.info('Orientating_SensorJsTest014 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------Orientating_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback2);
} catch (error) {
console.info("Orientating_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Orientating_SensorJsTest014 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('Orientating_SensorJsTest014 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0150
* @tc.name: Orientating_SensorJsTest015
* @tc.desc: Illegal ID passed in
*/
it("Orientating_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => {
if (error) {
console.info('Orientating_SensorJsTest015 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback, { 'interval': undefined });
} catch(error){
console.info('Orientating_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Orientating_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION);
} catch (error) {
console.info("Orientating_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Orientating_SensorJsTest015 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0160
* @tc.name: Orientating_SensorJsTest016
* @tc.desc: For normal scenarios
*/
it("Orientating_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Orientating_SensorJsTest016--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => {
if (error) {
console.info('Orientating_SensorJsTest016 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback, { 'interval': null });
} catch(error){
console.info('Orientating_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------Orientating_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION);
} catch (error) {
console.info("Orientating_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('Orientating_SensorJsTest016 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0170
* @tc.name: Orientating_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("Orientating_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------Orientating_SensorJsTest017--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => {
if (error) {
console.info('Orientating_SensorJsTest017 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------Orientating_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION);
} catch (error) {
console.info("Orientating_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("Orientating_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ORIENTATION_JSTest_0180
* @tc.name: Orientating_SensorJsTest018
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("Orientating_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => {
if (error) {
console.info('Orientating_SensorJsTest018 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback, { 'interval': 100000000 });
} catch(error){
console.info("Orientating_SensorJsTest018 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------Orientating_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION);
} catch (error) {
console.info("Orientating_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------Orientating_SensorJsTest018 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("Orientating_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_18", function () { ...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_18", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_18", function () { ...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_18", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_18", function () { ...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_18", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_18", function () { ...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_18", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -38,12 +38,12 @@ let permissionNameUser = 'ohos.permission.ACTIVITY_MOTION' ...@@ -38,12 +38,12 @@ let permissionNameUser = 'ohos.permission.ACTIVITY_MOTION'
describe("SensorJsTest_sensor_17", function () { describe("SensorJsTest_sensor_17", function () {
function callback(data) { function callback(data) {
console.info('callback success' + JSON.stringify(data)); console.info('old callback success' + JSON.stringify(data));
expect(typeof(data.scalar)).assertEqual('number'); expect(typeof(data.scalar)).assertEqual('number');
} }
function callback2(data) { function callback2(data) {
console.info('callback2 sucess' + JSON.stringify(data)); console.info('old callback2 sucess' + JSON.stringify(data));
expect(typeof(data.scalar)).assertEqual('number'); expect(typeof(data.scalar)).assertEqual('number');
} }
...@@ -830,4 +830,228 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -830,4 +830,228 @@ describe("SensorJsTest_sensor_17", function () {
done(); done();
}) })
}) })
/*
* @tc.number:SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0180
* @tc.name: PedometerDetection_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest018---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('PedometerDetection_SensorJsTest018 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback, { 'interval': undefined });
setTimeout(() => {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION);
done();
}, 4000);
} catch (error) {
console.error('PedometerDetection_SensorJsTest018 On fail, errorCode:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('PedometerDetection_SensorJsTest018 Sensor is not support');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest018 error:' + JSON.stringify(error));
done();
})
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0190
* @tc.name: PedometerDetection_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest019---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('PedometerDetection_SensorJsTest019 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback2, { 'interval': undefined });
setTimeout(()=>{
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION);
done();
}, 4000);
} catch (error) {
console.error('PedometerDetection_SensorJsTest019 On fail, errorCode:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('PedometerDetection_SensorJsTest019 Sensor is not support');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest019 error:' + JSON.stringify(error));
done();
})
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0200
* @tc.name: PedometerDetection_SensorJsTest020
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest020---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('PedometerDetection_SensorJsTest020 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback, { 'interval': null });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback2, { 'interval': null });
setTimeout(() => {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback);
}, 4000);
setTimeout(() => {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback2);
done();
}, 4000);
} catch (error) {
console.error('PedometerDetection_SensorJsTest020 On fail, errorCode:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('PedometerDetection_SensorJsTest020 Sensor is not support');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest020 error:' + JSON.stringify(error));
done();
})
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0210
* @tc.name: PedometerDetection_SensorJsTest021
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest021---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('PedometerDetection_SensorJsTest021 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback, undefined);
} catch(error){
console.info('PedometerDetection_SensorJsTest021 Repeat subscription'+error);
}
setTimeout(() => {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION);
done();
}, 4000);
} catch (error) {
console.error('PedometerDetection_SensorJsTest021 On fail, errorCode:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('PedometerDetection_SensorJsTest021 Sensor is not support');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest021 error:' + JSON.stringify(error));
done();
})
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0220
* @tc.name: PedometerDetection_SensorJsTest022
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) {
console.error('PedometerDetection_SensorJsTest022 getSingleSensor fail:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback);
setTimeout(() => {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, null);
done();
}, 4000);
} catch (error) {
console.error('PedometerDetection_SensorJsTest022 catch error:' +JSON.stringify(error));
expect(false).assertTrue();
done();
}
});
} catch (error) {
console.error('PedometerDetection_SensorJsTest022 Sensor is not support'+error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest022 error:' + JSON.stringify(error));
done();
})
})
})} })}
...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_19", function () { ...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_19", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_19", function () { ...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_19", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_19", function () { ...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_19", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_19", function () { ...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_19", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT ...@@ -18,7 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestT
export default function SensorJsTest_sensor_20() { export default function SensorJsTest_sensor_20() {
describe("SensorJsTest_sensor_20", function () { describe("SensorJsTest_sensor_20", function () {
function callback(data) { function callback(data) {
console.info("callback" + JSON.stringify(data)); console.info("old callback" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -27,7 +27,7 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -27,7 +27,7 @@ describe("SensorJsTest_sensor_20", function () {
} }
function callback2(data) { function callback2(data) {
console.info("callback2" + JSON.stringify(data)); console.info("old callback2" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number");
...@@ -40,7 +40,7 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -40,7 +40,7 @@ describe("SensorJsTest_sensor_20", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -48,7 +48,7 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -48,7 +48,7 @@ describe("SensorJsTest_sensor_20", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -56,7 +56,7 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -56,7 +56,7 @@ describe("SensorJsTest_sensor_20", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -64,7 +64,7 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -64,7 +64,7 @@ describe("SensorJsTest_sensor_20", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
...@@ -395,7 +395,6 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -395,7 +395,6 @@ describe("SensorJsTest_sensor_20", function () {
} catch (error) { } catch (error) {
console.info("RotatingVector_SensorJsTest012 error:" + error); console.info("RotatingVector_SensorJsTest012 error:" + error);
} }
console
console.info('----------------------RotatingVector_SensorJsTest012 off end---------------------------'); console.info('----------------------RotatingVector_SensorJsTest012 off end---------------------------');
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
...@@ -438,4 +437,191 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -438,4 +437,191 @@ describe("SensorJsTest_sensor_20", function () {
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0140
* @tc.name: RotatingVector_SensorJsTest014
* @tc.desc: Functional Use Cases
*/
it("RotatingVector_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------RotatingVector_SensorJsTest014--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('RotatingVector_SensorJsTest014 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback, { 'interval': undefined });
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback2, { 'interval': undefined });
setTimeout(() => {
console.info('----------------------RotatingVector_SensorJsTest014 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback2);
} catch (error) {
console.info("RotatingVector_SensorJsTest014 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------RotatingVector_SensorJsTest014 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info('RotatingVector_SensorJsTest014 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0150
* @tc.name: RotatingVector_SensorJsTest015
* @tc.desc: Illegal ID passed in
*/
it("RotatingVector_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('RotatingVector_SensorJsTest015 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback, undefined);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback, { 'interval': undefined });
} catch(error){
console.info('RotatingVector_SensorJsTest015 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------RotatingVector_SensorJsTest015 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR);
} catch (error) {
console.info("RotatingVector_SensorJsTest015 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('RotatingVector_SensorJsTest015 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0160
* @tc.name: RotatingVector_SensorJsTest016
* @tc.desc: For normal scenarios
*/
it("RotatingVector_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------RotatingVector_SensorJsTest016--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('RotatingVector_SensorJsTest016 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback, null);
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback, { 'interval': null });
} catch(error){
console.info('RotatingVector_SensorJsTest016 Repeat subscription'+error);
}
setTimeout(() => {
console.info('----------------------RotatingVector_SensorJsTest016 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR);
} catch (error) {
console.info("RotatingVector_SensorJsTest016 error:" + error);
expect(false).assertTrue();
}
done();
}, 1000);
}
})
} catch (error) {
console.info('RotatingVector_SensorJsTest016 Device does not support! ');
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0170
* @tc.name: RotatingVector_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("RotatingVector_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) {
console.info('---------RotatingVector_SensorJsTest017--------------');
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('RotatingVector_SensorJsTest017 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback, { 'interval': null });
setTimeout(() => {
console.info('----------------------RotatingVector_SensorJsTest017 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR);
} catch (error) {
console.info("RotatingVector_SensorJsTest017 error:" + error);
expect(false).assertTrue();
}
done();
}, 500);
}
})
} catch (error) {
console.info("RotatingVector_SensorJsTest017 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_ROTATION_VECTOR_JSTest_0180
* @tc.name: RotatingVector_SensorJsTest018
* @tc.desc: Once Normal Subscription Scenario Use Case
*/
it("RotatingVector_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => {
if (error) {
console.info('RotatingVector_SensorJsTest018 error');
} else {
expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback, { 'interval': 100000000 });
try{
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback, { 'interval': 100000000 });
} catch(error){
console.info("RotatingVector_SensorJsTest018 catch error:" + error);
}
setTimeout(() => {
console.info('----------------------RotatingVector_SensorJsTest018 off in--------------');
try {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR);
} catch (error) {
console.info("RotatingVector_SensorJsTest018 error:" + error);
expect(false).assertTrue();
}
console.info('----------------------RotatingVector_SensorJsTest018 off end--------------');
done()
}, 1000);
}
})
} catch (error) {
console.info("RotatingVector_SensorJsTest018 Device does not support! ");
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
})} })}
\ No newline at end of file
...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_21", function () { ...@@ -34,7 +34,7 @@ describe("SensorJsTest_sensor_21", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_21", function () { ...@@ -42,7 +42,7 @@ describe("SensorJsTest_sensor_21", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_21", function () { ...@@ -50,7 +50,7 @@ describe("SensorJsTest_sensor_21", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_21", function () { ...@@ -58,7 +58,7 @@ describe("SensorJsTest_sensor_21", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let errMessages = ['string is not defined','The parameter invalid']; let errMessages = ['string is not defined','The parameter invalid'];
......
...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_22", function () { ...@@ -35,7 +35,7 @@ describe("SensorJsTest_sensor_22", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_22", function () { ...@@ -43,7 +43,7 @@ describe("SensorJsTest_sensor_22", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_22", function () { ...@@ -51,7 +51,7 @@ describe("SensorJsTest_sensor_22", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_22", function () { ...@@ -59,7 +59,7 @@ describe("SensorJsTest_sensor_22", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_23", function () { ...@@ -33,7 +33,7 @@ describe("SensorJsTest_sensor_23", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_23", function () { ...@@ -41,7 +41,7 @@ describe("SensorJsTest_sensor_23", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_23", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest_sensor_23", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_23", function () { ...@@ -57,7 +57,7 @@ describe("SensorJsTest_sensor_23", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const PARAMETER_ERROR_CODE = 401 const PARAMETER_ERROR_CODE = 401
......
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_24", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_24", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_24", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_24", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_24", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_24", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_24", function () { ...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_24", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
/* /*
......
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_25", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_25", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_25", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_25", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_25", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_25", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_25", function () { ...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_25", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
/* /*
...@@ -252,4 +252,171 @@ describe("SensorJsTest_sensor_25", function () { ...@@ -252,4 +252,171 @@ describe("SensorJsTest_sensor_25", function () {
done(); done();
}, 1000); }, 1000);
}) })
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0080
* @tc.name: subscribeAccelerometer_SensorJsTest008
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeAccelerometer_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeAccelerometer_SensorJsTest008---------------------------');
sensor.subscribeAccelerometer({
interval: 'game',
success: function (data) {
console.info("subscribeAccelerometer_SensorJsTest008 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeAccelerometer();
done();
}, 1000);
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0090
* @tc.name: subscribeAccelerometer_SensorJsTest009
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeAccelerometer_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeAccelerometer_SensorJsTest009---------------------------');
sensor.subscribeAccelerometer({
interval: 'ui',
success: function (data) {
console.info("subscribeAccelerometer_SensorJsTest009 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeAccelerometer();
done();
}, 1000);
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0100
* @tc.name: subscribeAccelerometer_SensorJsTest010
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeAccelerometer_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeAccelerometer_SensorJsTest010---------------------------');
sensor.subscribeAccelerometer({
interval: 'normal',
success: function (data) {
console.info("subscribeAccelerometer_SensorJsTest010 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeAccelerometer();
done();
}, 1000);
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0110
* @tc.name: subscribeAccelerometer_SensorJsTest011
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeAccelerometer_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeAccelerometer_SensorJsTest011---------------------------');
sensor.subscribeAccelerometer({
interval: 'normal',
success: function (data) {
console.info("subscribeAccelerometer_SensorJsTest011 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
sensor.subscribeAccelerometer({
interval: 'normal',
success: function (data) {
console.info("subscribeAccelerometer_SensorJsTest011_1 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeAccelerometer();
done();
}, 1000);
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0120
* @tc.name: subscribeAccelerometer_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeAccelerometer_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeAccelerometer_SensorJsTest012---------------------------');
sensor.subscribeAccelerometer({
interval: 'xxx',
success: function (data) {
console.info("subscribeAccelerometer_SensorJsTest012 success" + JSON.stringify(data));
expect(false).assertTrue();
},
fail: undefined,
});
setTimeout(() => {
done();
}, 500);
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0130
* @tc.name: subscribeAccelerometer_SensorJsTest013
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeAccelerometer_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeAccelerometer_SensorJsTest013---------------------------');
sensor.subscribeAccelerometer({
interval: 'xxx',
success: function (data) {
console.info("subscribeAccelerometer_SensorJsTest013 success" + JSON.stringify(data));
expect(false).assertTrue();
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeAccelerometer();
done();
}, 1000);
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0140
* @tc.name: subscribeAccelerometer_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeAccelerometer_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeAccelerometer_SensorJsTest014---------------------------');
sensor.subscribeAccelerometer({
interval: 'game',
success: function (data) {
console.info("subscribeAccelerometer_SensorJsTest014 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeAccelerometer();
done();
}, 1000);
})
})} })}
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_26", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_26", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_26", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_26", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_26", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_26", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,10 +47,11 @@ describe("SensorJsTest_sensor_26", function () { ...@@ -47,10 +47,11 @@ describe("SensorJsTest_sensor_26", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let BarometerId = 8 let BarometerId = 8
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeBarometer_JSTest_0010 * @tc.number:SUB_SensorsSystem_SubscribeBarometer_JSTest_0010
* @tc.name:subscribeBarometer_SensorJsTest001 * @tc.name:subscribeBarometer_SensorJsTest001
...@@ -149,5 +150,79 @@ describe("SensorJsTest_sensor_26", function () { ...@@ -149,5 +150,79 @@ describe("SensorJsTest_sensor_26", function () {
console.info('subscribeBarometer_SensorJsTest003 Device does not support! '); console.info('subscribeBarometer_SensorJsTest003 Device does not support! ');
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_SubscribeBarometer_JSTest_0040
* @tc.name: subscribeBarometer_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeBarometer_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeBarometer_SensorJsTest004---------------------------');
try{
sensor.getSingleSensor(BarometerId ,(error, data) => {
if (error) {
console.info('subscribeBarometer_SensorJsTest004 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeBarometer({
success: function (data) {
console.info("subscribeBarometer_SensorJsTest004 success" + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number");
},
fail: undefined,
});
sensor.subscribeBarometer({
success: function (data) {
console.info("subscribeBarometer_SensorJsTest004_1 success" + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number");
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeBarometer();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeBarometer_SensorJsTest004 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeBarometer_JSTest_0050
* @tc.name: subscribeBarometer_SensorJsTest005
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeBarometer_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeBarometer_SensorJsTest005---------------------------');
try{
sensor.getSingleSensor(BarometerId ,(error, data) => {
if (error) {
console.info('subscribeBarometer_SensorJsTest005 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeBarometer({
success: function (data) {
console.info("subscribeBarometer_SensorJsTest005 success" + JSON.stringify(data));
expect(typeof (data.pressure)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeBarometer();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeBarometer_SensorJsTest005 Device does not support! ');
done();
}
})
})} })}
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_28", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_28", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_28", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_28", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_28", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_28", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_28", function () { ...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_28", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
/* /*
......
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_27", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_27", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_27", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_27", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let DeviceOrientationId = 256 let DeviceOrientationId = 256
...@@ -60,26 +60,32 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -60,26 +60,32 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("subscribeDeviceOrientation_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest001---------------------------'); console.info('----------------------subscribeDeviceOrientation_SensorJsTest001---------------------------');
try{ try{
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => { sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({ if (error) {
interval: 'game', console.info('subscribeDeviceOrientation_SensorJsTest006 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeDeviceOrientation_SensorJsTest001 success" + JSON.stringify(data)); done();
expect(typeof (data.alpha)).assertEqual("number"); } else {
expect(typeof (data.beta)).assertEqual("number"); sensor.subscribeDeviceOrientation({
expect(typeof (data.gamma)).assertEqual("number"); interval: 'game',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeDeviceOrientation_SensorJsTest001 success" + JSON.stringify(data));
console.log("subscribeDeviceOrientation_SensorJsTest001 is failed, data: " + data + ", code: " + code); expect(typeof (data.alpha)).assertEqual("number");
expect(data).assertEqual('subscribe fail'); expect(typeof (data.beta)).assertEqual("number");
expect(code).assertEqual(1001); expect(typeof (data.gamma)).assertEqual("number");
done() },
}, fail: function (data, code) {
}); console.log("subscribeDeviceOrientation_SensorJsTest001 is failed, data: " + data + ", code: " + code);
setTimeout(() => { expect(data).assertEqual('subscribe fail');
sensor.unsubscribeDeviceOrientation(); expect(code).assertEqual(1001);
done(); done()
}, 500); },
});
setTimeout(() => {
sensor.unsubscribeDeviceOrientation();
done();
}, 500);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeDeviceOrientation_SensorJsTest001 Device does not support! '); console.info('subscribeDeviceOrientation_SensorJsTest001 Device does not support! ');
...@@ -95,27 +101,33 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -95,27 +101,33 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeDeviceOrientation_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest002---------------------------'); console.info('----------------------subscribeDeviceOrientation_SensorJsTest002---------------------------');
try{ try{
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => { sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({ if (error) {
interval: 'ui', console.info('subscribeDeviceOrientation_SensorJsTest006 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeDeviceOrientation_SensorJsTest002 success" + JSON.stringify(data)); done();
expect(typeof (data.alpha)).assertEqual("number"); } else {
expect(typeof (data.beta)).assertEqual("number"); sensor.subscribeDeviceOrientation({
expect(typeof (data.gamma)).assertEqual("number"); interval: 'ui',
done() success: function (data) {
}, console.info("subscribeDeviceOrientation_SensorJsTest002 success" + JSON.stringify(data));
fail: function (data, code) { expect(typeof (data.alpha)).assertEqual("number");
console.log("subscribeDeviceOrientation_SensorJsTest002 is failed, data: " + data + ", code: " + code); expect(typeof (data.beta)).assertEqual("number");
expect(data).assertEqual('subscribe fail'); expect(typeof (data.gamma)).assertEqual("number");
expect(code).assertEqual(1001); done()
done() },
}, fail: function (data, code) {
}); console.log("subscribeDeviceOrientation_SensorJsTest002 is failed, data: " + data + ", code: " + code);
setTimeout(() => { expect(data).assertEqual('subscribe fail');
sensor.unsubscribeDeviceOrientation(); expect(code).assertEqual(1001);
done(); done()
}, 500); },
});
setTimeout(() => {
sensor.unsubscribeDeviceOrientation();
done();
}, 500);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeDeviceOrientation_SensorJsTest002 Device does not support! '); console.info('subscribeDeviceOrientation_SensorJsTest002 Device does not support! ');
...@@ -131,27 +143,33 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -131,27 +143,33 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeDeviceOrientation_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest003---------------------------'); console.info('----------------------subscribeDeviceOrientation_SensorJsTest003---------------------------');
try{ try{
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => { sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({ if (error) {
interval: 'normal', console.info('subscribeDeviceOrientation_SensorJsTest006 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeDeviceOrientation_SensorJsTest003 success" + JSON.stringify(data)); done();
expect(typeof (data.alpha)).assertEqual("number"); } else {
expect(typeof (data.beta)).assertEqual("number"); sensor.subscribeDeviceOrientation({
expect(typeof (data.gamma)).assertEqual("number"); interval: 'normal',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeDeviceOrientation_SensorJsTest003 success" + JSON.stringify(data));
console.log("subscribeDeviceOrientation_SensorJsTest003 is failed, data: " + data + ", code: " + code); expect(typeof (data.alpha)).assertEqual("number");
expect(data).assertEqual('subscribe fail'); expect(typeof (data.beta)).assertEqual("number");
expect(code).assertEqual(1001); expect(typeof (data.gamma)).assertEqual("number");
done() },
}, fail: function (data, code) {
}); console.log("subscribeDeviceOrientation_SensorJsTest003 is failed, data: " + data + ", code: " + code);
setTimeout(() => { expect(data).assertEqual('subscribe fail');
sensor.unsubscribeDeviceOrientation(); expect(code).assertEqual(1001);
done(); done()
}, 500); },
}) });
setTimeout(() => {
sensor.unsubscribeDeviceOrientation();
done();
}, 500);
}
})
} catch (error) { } catch (error) {
console.info('subscribeDeviceOrientation_SensorJsTest003 Device does not support! '); console.info('subscribeDeviceOrientation_SensorJsTest003 Device does not support! ');
done(); done();
...@@ -166,41 +184,47 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -166,41 +184,47 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeDeviceOrientation_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest004---------------------------'); console.info('----------------------subscribeDeviceOrientation_SensorJsTest004---------------------------');
try{ try{
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => { sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({ if (error) {
interval: 'normal', console.info('subscribeDeviceOrientation_SensorJsTest006 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeDeviceOrientation_SensorJsTest004 success" + JSON.stringify(data)); done();
expect(typeof (data.alpha)).assertEqual("number"); } else {
expect(typeof (data.beta)).assertEqual("number"); sensor.subscribeDeviceOrientation({
expect(typeof (data.gamma)).assertEqual("number"); interval: 'normal',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeDeviceOrientation_SensorJsTest004 success" + JSON.stringify(data));
console.log("subscribeDeviceOrientation_SensorJsTest004 is failed, data: " + data + ", code: " + code); expect(typeof (data.alpha)).assertEqual("number");
expect(data).assertEqual('subscribe fail'); expect(typeof (data.beta)).assertEqual("number");
expect(code).assertEqual(1001); expect(typeof (data.gamma)).assertEqual("number");
}, },
}); fail: function (data, code) {
console.log("subscribeDeviceOrientation_SensorJsTest004 is failed, data: " + data + ", code: " + code);
sensor.subscribeDeviceOrientation({ expect(data).assertEqual('subscribe fail');
interval: 'normal', expect(code).assertEqual(1001);
success: function (data) { },
console.info("subscribeDeviceOrientation_SensorJsTest004_1 success" + JSON.stringify(data)); });
expect(typeof (data.alpha)).assertEqual("number");
expect(typeof (data.beta)).assertEqual("number"); sensor.subscribeDeviceOrientation({
expect(typeof (data.gamma)).assertEqual("number"); interval: 'normal',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeDeviceOrientation_SensorJsTest004_1 success" + JSON.stringify(data));
console.log("subscribeDeviceOrientation_SensorJsTest004_1 is failed, data: " + data + ", code: " + code); expect(typeof (data.alpha)).assertEqual("number");
expect(data).assertEqual('subscribe fail'); expect(typeof (data.beta)).assertEqual("number");
expect(code).assertEqual(1001); expect(typeof (data.gamma)).assertEqual("number");
}, },
}); fail: function (data, code) {
setTimeout(() => { console.log("subscribeDeviceOrientation_SensorJsTest004_1 is failed, data: " + data + ", code: " + code);
sensor.unsubscribeDeviceOrientation(); expect(data).assertEqual('subscribe fail');
done(); expect(code).assertEqual(1001);
}, 500); },
}) });
setTimeout(() => {
sensor.unsubscribeDeviceOrientation();
done();
}, 500);
}
})
} catch (error) { } catch (error) {
console.info('subscribeDeviceOrientation_SensorJsTest004 Device does not support! '); console.info('subscribeDeviceOrientation_SensorJsTest004 Device does not support! ');
done(); done();
...@@ -215,23 +239,29 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -215,23 +239,29 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeDeviceOrientation_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest005---------------------------'); console.info('----------------------subscribeDeviceOrientation_SensorJsTest005---------------------------');
try{ try{
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => { sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({ if (error) {
interval: 'xxx', console.info('subscribeDeviceOrientation_SensorJsTest006 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeDeviceOrientation_SensorJsTest005 success" + JSON.stringify(data)); done();
expect(typeof (data.alpha)).assertEqual("number"); } else {
expect(typeof (data.beta)).assertEqual("number"); sensor.subscribeDeviceOrientation({
expect(typeof (data.gamma)).assertEqual("number"); interval: 'xxx',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeDeviceOrientation_SensorJsTest005 success" + JSON.stringify(data));
console.log("subscribeDeviceOrientation_SensorJsTest005 is failed, data: " + data + ", code: " + code); expect(typeof (data.alpha)).assertEqual("number");
expect(data).assertEqual('input error'); expect(typeof (data.beta)).assertEqual("number");
expect(code).assertEqual(202); expect(typeof (data.gamma)).assertEqual("number");
done() },
}, fail: function (data, code) {
}); console.log("subscribeDeviceOrientation_SensorJsTest005 is failed, data: " + data + ", code: " + code);
}) expect(data).assertEqual('input error');
expect(code).assertEqual(202);
done()
},
});
}
})
} catch (error) { } catch (error) {
console.info('subscribeDeviceOrientation_SensorJsTest005 Device does not support! '); console.info('subscribeDeviceOrientation_SensorJsTest005 Device does not support! ');
done(); done();
...@@ -246,26 +276,32 @@ describe("SensorJsTest_sensor_27", function () { ...@@ -246,26 +276,32 @@ describe("SensorJsTest_sensor_27", function () {
it("subscribeDeviceOrientation_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeDeviceOrientation_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeDeviceOrientation_SensorJsTest006---------------------------'); console.info('----------------------subscribeDeviceOrientation_SensorJsTest006---------------------------');
try{ try{
sensor.getSingleSensor(DeviceOrientationId ,(error, data) => { sensor.getSingleSensor(DeviceOrientationId ,(error, data) => {
sensor.subscribeDeviceOrientation({ if (error) {
interval: 'normal', console.info('subscribeDeviceOrientation_SensorJsTest006 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeDeviceOrientation_SensorJsTest006 success" + JSON.stringify(data)); done();
expect(typeof (data.alpha)).assertEqual("number"); } else {
expect(typeof (data.beta)).assertEqual("number"); sensor.subscribeDeviceOrientation({
expect(typeof (data.gamma)).assertEqual("number"); interval: 'normal',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeDeviceOrientation_SensorJsTest006 success" + JSON.stringify(data));
console.log("subscribeDeviceOrientation_SensorJsTest006 is failed, data: " + data + ", code: " + code); expect(typeof (data.alpha)).assertEqual("number");
expect(data).assertEqual('subscribe fail'); expect(typeof (data.beta)).assertEqual("number");
expect(code).assertEqual(1001); expect(typeof (data.gamma)).assertEqual("number");
done() },
}, fail: function (data, code) {
}); console.log("subscribeDeviceOrientation_SensorJsTest006 is failed, data: " + data + ", code: " + code);
setTimeout(() => { expect(data).assertEqual('subscribe fail');
sensor.unsubscribeDeviceOrientation(); expect(code).assertEqual(1001);
done(); done()
}, 500); },
});
setTimeout(() => {
sensor.unsubscribeDeviceOrientation();
done();
}, 500);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeDeviceOrientation_SensorJsTest006 Device does not support! '); console.info('subscribeDeviceOrientation_SensorJsTest006 Device does not support! ');
......
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_29", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_29", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_29", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -47,7 +47,7 @@ describe("SensorJsTest_sensor_29", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let GyroscopeId = 2 let GyroscopeId = 2
...@@ -60,30 +60,36 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -60,30 +60,36 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("subscribeGyroscope_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest001---------------'); console.info('----------------------subscribeGyroscope_SensorJsTest001---------------');
try{ try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => { sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({ if (error) {
interval: 'game', console.info('subscribeGyroscope_SensorJsTest002 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeGyroscope_SensorJsTest001 success" + JSON.stringify(data)); done();
expect(typeof (data.x)).assertEqual("number"); } else {
expect(typeof (data.y)).assertEqual("number"); sensor.subscribeGyroscope({
expect(typeof (data.z)).assertEqual("number"); interval: 'game',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeGyroscope_SensorJsTest002 success" + JSON.stringify(data));
console.log("subscribeGyroscope_SensorJsTest001 is failed, data: " + data + ", code: " + code); expect(typeof (data.x)).assertEqual("number");
expect(false).assertTrue(); expect(typeof (data.y)).assertEqual("number");
}, expect(typeof (data.z)).assertEqual("number");
}); },
setTimeout(() => { fail: function (data, code) {
sensor.unsubscribeGyroscope(); console.log("subscribeGyroscope_SensorJsTest002 is failed, data: " + data + ", code: " + code);
done(); expect(false).assertTrue();
}, 1000); },
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeGyroscope_SensorJsTest001 Device does not support! '); console.info('subscribeGyroscope_SensorJsTest002 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0020 * @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0020
...@@ -91,32 +97,37 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -91,32 +97,37 @@ describe("SensorJsTest_sensor_29", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeGyroscope_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeGyroscope_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest002---------------');
try{ try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => { sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({ if (error) {
interval: 'ui', console.info('subscribeGyroscope_SensorJsTest002 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeGyroscope_SensorJsTest002 success" + JSON.stringify(data)); done();
expect(typeof (data.x)).assertEqual("number"); } else {
expect(typeof (data.y)).assertEqual("number"); sensor.subscribeGyroscope({
expect(typeof (data.z)).assertEqual("number"); interval: 'ui',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeGyroscope_SensorJsTest002 success" + JSON.stringify(data));
console.log("subscribeGyroscope_SensorJsTest002 is failed, data: " + data + ", code: " + code); expect(typeof (data.x)).assertEqual("number");
expect(false).assertTrue(); expect(typeof (data.y)).assertEqual("number");
}, expect(typeof (data.z)).assertEqual("number");
}); },
setTimeout(() => { fail: function (data, code) {
sensor.unsubscribeGyroscope(); console.log("subscribeGyroscope_SensorJsTest002 is failed, data: " + data + ", code: " + code);
done(); expect(false).assertTrue();
}, 1000); },
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeGyroscope_SensorJsTest002 Device does not support! '); console.info('subscribeGyroscope_SensorJsTest002 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0030 * @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0030
...@@ -124,32 +135,37 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -124,32 +135,37 @@ describe("SensorJsTest_sensor_29", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeGyroscope_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeGyroscope_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest003---------------');
try{ try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => { sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({ if (error) {
interval: 'normal', console.info('subscribeGyroscope_SensorJsTest003 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeGyroscope_SensorJsTest003 success" + JSON.stringify(data)); done();
expect(typeof (data.x)).assertEqual("number"); } else {
expect(typeof (data.y)).assertEqual("number"); sensor.subscribeGyroscope({
expect(typeof (data.z)).assertEqual("number"); interval: 'normal',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeGyroscope_SensorJsTest003 success" + JSON.stringify(data));
console.log("subscribeGyroscope_SensorJsTest003 is failed, data: " + data + ", code: " + code); expect(typeof (data.x)).assertEqual("number");
expect(false).assertTrue(); expect(typeof (data.y)).assertEqual("number");
}, expect(typeof (data.z)).assertEqual("number");
}); },
setTimeout(() => { fail: function (data, code) {
sensor.unsubscribeGyroscope(); console.log("subscribeGyroscope_SensorJsTest003 is failed, data: " + data + ", code: " + code);
done(); expect(false).assertTrue();
}, 1000); },
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeGyroscope_SensorJsTest003 Device does not support! '); console.info('subscribeGyroscope_SensorJsTest003 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0040 * @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0040
...@@ -157,46 +173,51 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -157,46 +173,51 @@ describe("SensorJsTest_sensor_29", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeGyroscope_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeGyroscope_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest004---------------');
try{ try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => { sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({ if (error) {
interval: 'normal', console.info('subscribeGyroscope_SensorJsTest004 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeGyroscope_SensorJsTest004 success" + JSON.stringify(data)); done();
expect(typeof (data.x)).assertEqual("number"); } else {
expect(typeof (data.y)).assertEqual("number"); sensor.subscribeGyroscope({
expect(typeof (data.z)).assertEqual("number"); interval: 'normal',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeGyroscope_SensorJsTest004 success" + JSON.stringify(data));
console.log("subscribeGyroscope_SensorJsTest004 is failed, data: " + data + ", code: " + code); expect(typeof (data.x)).assertEqual("number");
expect(false).assertTrue(); expect(typeof (data.y)).assertEqual("number");
}, expect(typeof (data.z)).assertEqual("number");
}); },
fail: function (data, code) {
sensor.subscribeGyroscope({ console.log("subscribeGyroscope_SensorJsTest004 is failed, data: " + data + ", code: " + code);
interval: 'normal', expect(false).assertTrue();
success: function (data) { },
console.info("subscribeGyroscope_SensorJsTest004_1 success" + JSON.stringify(data)); });
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number"); sensor.subscribeGyroscope({
expect(typeof (data.z)).assertEqual("number"); interval: 'normal',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeGyroscope_SensorJsTest004_1 success" + JSON.stringify(data));
console.log("subscribeGyroscope_SensorJsTest004_1 is failed, data: " + data + ", code: " + code); expect(typeof (data.x)).assertEqual("number");
expect(false).assertTrue(); expect(typeof (data.y)).assertEqual("number");
}, expect(typeof (data.z)).assertEqual("number");
}); },
setTimeout(() => { fail: function (data, code) {
sensor.unsubscribeGyroscope(); console.log("subscribeGyroscope_SensorJsTest004_1 is failed, data: " + data + ", code: " + code);
done(); expect(false).assertTrue();
}, 1000); },
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeGyroscope_SensorJsTest004 Device does not support! '); console.info('subscribeGyroscope_SensorJsTest004 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0050 * @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0050
...@@ -204,29 +225,34 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -204,29 +225,34 @@ describe("SensorJsTest_sensor_29", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeGyroscope_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeGyroscope_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest005---------------');
try{ try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => { sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({ if (error) {
interval: 'xxx', console.info('subscribeGyroscope_SensorJsTest005 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeGyroscope_SensorJsTest005 success" + JSON.stringify(data)); done();
expect(typeof (data.x)).assertEqual("number"); } else {
expect(typeof (data.y)).assertEqual("number"); sensor.subscribeGyroscope({
expect(typeof (data.z)).assertEqual("number"); interval: 'xxx',
}, success: function (data) {
fail: function (data, code) { console.info("subscribeGyroscope_SensorJsTest005 success" + JSON.stringify(data));
console.log("subscribeGyroscope_SensorJsTest005 is failed, data: " + data + ", code: " + code); expect(typeof (data.x)).assertEqual("number");
expect(code).assertEqual(202); expect(typeof (data.y)).assertEqual("number");
done(); expect(typeof (data.z)).assertEqual("number");
}, },
}); fail: function (data, code) {
}) console.log("subscribeGyroscope_SensorJsTest005 is failed, data: " + data + ", code: " + code);
expect(code).assertEqual(202);
done();
},
});
}
})
} catch (error) { } catch (error) {
console.info('subscribeGyroscope_SensorJsTest005 Device does not support! '); console.info('subscribeGyroscope_SensorJsTest005 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0060 * @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0060
...@@ -236,23 +262,33 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -236,23 +262,33 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeGyroscope_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest006---------------'); console.info('----------------------subscribeGyroscope_SensorJsTest006---------------');
try{ try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => { sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({ if (error) {
interval: 'normal', console.info('subscribeGyroscope_SensorJsTest006 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeGyroscope_SensorJsTest006 success" + JSON.stringify(data)); done();
expect(typeof (data.x)).assertEqual("number"); } else {
expect(typeof (data.y)).assertEqual("number"); sensor.subscribeGyroscope({
expect(typeof (data.z)).assertEqual("number"); interval: 'normal',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest006 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
done();
},
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done(); done();
}, }, 1000);
}); }
}) })
} catch (error) { } catch (error) {
console.info('subscribeGyroscope_SensorJsTest006 Device does not support! '); console.info('subscribeGyroscope_SensorJsTest006 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0070 * @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0070
...@@ -262,25 +298,296 @@ describe("SensorJsTest_sensor_29", function () { ...@@ -262,25 +298,296 @@ describe("SensorJsTest_sensor_29", function () {
it("subscribeGyroscope_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeGyroscope_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest007---------------'); console.info('----------------------subscribeGyroscope_SensorJsTest007---------------');
try{ try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => { sensor.getSingleSensor(GyroscopeId ,(error, data) => {
sensor.subscribeGyroscope({ if (error) {
interval: 'normal', console.info('subscribeGyroscope_SensorJsTest008 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeGyroscope_SensorJsTest007 success" + JSON.stringify(data)); done();
expect(typeof (data.x)).assertEqual("number"); } else {
expect(typeof (data.y)).assertEqual("number"); sensor.subscribeGyroscope({
expect(typeof (data.z)).assertEqual("number"); interval: 'normal',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest007 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
done();
},
fail: function (data, code) {
console.log("subscribeGyroscope_SensorJsTest007 is failed, data: " + data + ", code: " + code);
expect(false).assertTrue();
},
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done(); done();
}, }, 1000);
fail: function (data, code) { }
console.log("subscribeGyroscope_SensorJsTest007 is failed, data: " + data + ", code: " + code);
expect(false).assertTrue();
},
});
}) })
} catch (error) { } catch (error) {
console.info('subscribeGyroscope_SensorJsTest007 Device does not support! '); console.info('subscribeGyroscope_SensorJsTest007 Device does not support! ');
done(); done();
} }
}) })
/*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0080
* @tc.name: subscribeGyroscope_SensorJsTest008
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeGyroscope_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest008---------------');
try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
if (error) {
console.info('subscribeGyroscope_SensorJsTest008 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeGyroscope({
interval: 'game',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest008 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeGyroscope_SensorJsTest008 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0090
* @tc.name: subscribeGyroscope_SensorJsTest009
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeGyroscope_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
if (error) {
console.info('subscribeGyroscope_SensorJsTest009 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeGyroscope({
interval: 'ui',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest009 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeGyroscope_SensorJsTest009 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0100
* @tc.name: subscribeGyroscope_SensorJsTest010
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeGyroscope_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest010---------------------------');
try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
if (error) {
console.info('subscribeGyroscope_SensorJsTest010 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeGyroscope({
interval: 'normal',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest010 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeGyroscope_SensorJsTest010 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0110
* @tc.name: subscribeGyroscope_SensorJsTest011
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeGyroscope_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest011---------------------------');
try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
if (error) {
console.info('subscribeGyroscope_SensorJsTest011 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeGyroscope({
interval: 'normal',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest011 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
sensor.subscribeGyroscope({
interval: 'normal',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest011_1 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeGyroscope_SensorJsTest011 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0120
* @tc.name: subscribeGyroscope_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeGyroscope_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest012---------------------------');
try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
if (error) {
console.info('subscribeGyroscope_SensorJsTest012 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeGyroscope({
interval: 'xxx',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest012 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
done();
}, 500);
}
})
} catch (error) {
console.info('subscribeGyroscope_SensorJsTest012 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0130
* @tc.name: subscribeGyroscope_SensorJsTest013
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeGyroscope_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest013---------------------------');
try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
if (error) {
console.info('subscribeGyroscope_SensorJsTest013 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeGyroscope({
interval: 'xxx',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest013 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeGyroscope_SensorJsTest013 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeGyroscope_JSTest_0140
* @tc.name: subscribeGyroscope_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeGyroscope_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeGyroscope_SensorJsTest014---------------------------');
try{
sensor.getSingleSensor(GyroscopeId ,(error, data) => {
if (error) {
console.info('subscribeGyroscope_SensorJsTest014 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeGyroscope({
interval: 'game',
success: function (data) {
console.info("subscribeGyroscope_SensorJsTest014 success" + JSON.stringify(data));
expect(typeof (data.x)).assertEqual("number");
expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeGyroscope();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeGyroscope_SensorJsTest014 Device does not support! ');
done();
}
})
})} })}
...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -23,7 +23,7 @@ describe("SensorJsTest_sensor_31", function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -31,7 +31,7 @@ describe("SensorJsTest_sensor_31", function () {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll caled') console.info('afterAll called')
}) })
beforeEach(function () { beforeEach(function () {
...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -39,7 +39,7 @@ describe("SensorJsTest_sensor_31", function () {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach caled') console.info('beforeEach called')
}) })
afterEach(function () { afterEach(function () {
...@@ -47,34 +47,40 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -47,34 +47,40 @@ describe("SensorJsTest_sensor_31", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
let LightId = 5 let LightId = 5
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0010 * @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0010
* @tc.name: subscribeLight_SensorJsTest001 * @tc.name: subscribeLight_SensorJsTest001
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeLight_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("subscribeLight_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest001---------------------------');
try{ try{
sensor.getSingleSensor(LightId ,(error, data) => { sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({ if (error) {
interval: 'game', console.info('subscribeLight_SensorJsTest001 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeLight_SensorJsTest001 success" + JSON.stringify(data)); done();
expect(typeof (data.intensity)).assertEqual("number"); } else {
}, sensor.subscribeLight({
fail: function (data, code) { interval: 'game',
console.log("subscribeLight_SensorJsTest001 is failed, data: " + data + ", code: " + code); success: function (data) {
expect(false).assertTrue(); console.info("subscribeLight_SensorJsTest001 success" + JSON.stringify(data));
}, expect(typeof (data.intensity)).assertEqual("number");
}); },
setTimeout(() => { fail: function (data, code) {
sensor.unsubscribeLight(); console.log("subscribeLight_SensorJsTest001 is failed, data: " + data + ", code: " + code);
done(); expect(false).assertTrue();
}, 1000); },
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeLight_SensorJsTest001 Device does not support! '); console.info('subscribeLight_SensorJsTest001 Device does not support! ');
...@@ -88,24 +94,29 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -88,24 +94,29 @@ describe("SensorJsTest_sensor_31", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeLight_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeLight_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest002---------------------------');
try{ try{
sensor.getSingleSensor(LightId ,(error, data) => { sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({ if (error) {
interval: 'ui', console.info('subscribeLight_SensorJsTest002 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeLight_SensorJsTest002 success" + JSON.stringify(data)); done();
expect(typeof (data.intensity)).assertEqual("number"); } else {
}, sensor.subscribeLight({
fail: function (data, code) { interval: 'ui',
console.log("subscribeLight_SensorJsTest002 is failed, data: " + data + ", code: " + code); success: function (data) {
expect(false).assertTrue(); console.info("subscribeLight_SensorJsTest002 success" + JSON.stringify(data));
}, expect(typeof (data.intensity)).assertEqual("number");
}); },
setTimeout(() => { fail: function (data, code) {
sensor.unsubscribeLight(); console.log("subscribeLight_SensorJsTest002 is failed, data: " + data + ", code: " + code);
done(); expect(false).assertTrue();
}, 1000); },
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeLight_SensorJsTest002 Device does not support! '); console.info('subscribeLight_SensorJsTest002 Device does not support! ');
...@@ -121,21 +132,28 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -121,21 +132,28 @@ describe("SensorJsTest_sensor_31", function () {
it("subscribeLight_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeLight_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest003---------------------------'); console.info('----------------------subscribeLight_SensorJsTest003---------------------------');
try{ try{
sensor.getSingleSensor(LightId ,(error, data) => { sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({ if (error) {
success: function (data) { console.info('subscribeLight_SensorJsTest003 error');
console.info("subscribeLight_SensorJsTest003 success" + JSON.stringify(data)); expect(false).assertTrue();
expect(typeof (data.intensity)).assertEqual("number"); done();
}, } else {
fail: function (data, code) { sensor.subscribeLight({
console.log("subscribeLight_SensorJsTest003 is failed, data: " + data + ", code: " + code); interval: 'normal',
expect(false).assertTrue(); success: function (data) {
}, console.info("subscribeLight_SensorJsTest003 success" + JSON.stringify(data));
}); expect(typeof (data.intensity)).assertEqual("number");
setTimeout(() => { },
sensor.unsubscribeLight(); fail: function (data, code) {
done(); console.log("subscribeLight_SensorJsTest003 is failed, data: " + data + ", code: " + code);
}, 1000); expect(false).assertTrue();
},
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeLight_SensorJsTest003 Device does not support! '); console.info('subscribeLight_SensorJsTest003 Device does not support! ');
...@@ -149,42 +167,47 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -149,42 +167,47 @@ describe("SensorJsTest_sensor_31", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeLight_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeLight_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest004---------------------------');
try{ try{
sensor.getSingleSensor(LightId ,(error, data) => { sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({ if (error) {
interval: 'normal', console.info('subscribeLight_SensorJsTest004 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeLight_SensorJsTest004 success" + JSON.stringify(data)); done();
expect(typeof (data.intensity)).assertEqual("number"); } else {
}, sensor.subscribeLight({
fail: function (data, code) { interval: 'normal',
console.log("subscribeLight_SensorJsTest004 is failed, data: " + data + ", code: " + code); success: function (data) {
expect(false).assertTrue(); console.info("subscribeLight_SensorJsTest004 success" + JSON.stringify(data));
}, expect(typeof (data.intensity)).assertEqual("number");
}); },
fail: function (data, code) {
sensor.subscribeLight({ console.log("subscribeLight_SensorJsTest004 is failed, data: " + data + ", code: " + code);
interval: 'normal', expect(false).assertTrue();
success: function (data) { },
console.info("subscribeLight_SensorJsTest004_1 success" + JSON.stringify(data)); });
expect(typeof (data.intensity)).assertEqual("number");
}, sensor.subscribeLight({
fail: function (data, code) { interval: 'normal',
console.log("subscribeLight_SensorJsTest004_1 is failed, data: " + data + ", code: " + code); success: function (data) {
expect(false).assertTrue(); console.info("subscribeLight_SensorJsTest004_1 success" + JSON.stringify(data));
}, expect(typeof (data.intensity)).assertEqual("number");
}); },
setTimeout(() => { fail: function (data, code) {
sensor.unsubscribeLight(); console.log("subscribeLight_SensorJsTest004_1 is failed, data: " + data + ", code: " + code);
done(); expect(false).assertTrue();
}, 1000); },
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeLight_SensorJsTest004 Device does not support! '); console.info('subscribeLight_SensorJsTest004 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0050 * @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0050
...@@ -192,28 +215,33 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -192,28 +215,33 @@ describe("SensorJsTest_sensor_31", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeLight_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeLight_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest005---------------------------');
try{ try{
sensor.getSingleSensor(LightId ,(error, data) => { sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({ if (error) {
interval: 'xxx', console.info('subscribeLight_SensorJsTest005 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeLight_SensorJsTest005 success" + JSON.stringify(data)); done();
expect(typeof (data.intensity)).assertEqual("number"); } else {
done(); sensor.subscribeLight({
}, interval: 'xxx',
fail: function (data, code) { success: function (data) {
console.log("subscribeLight_SensorJsTest005 is failed, data: " + data + ", code: " + code); console.info("subscribeLight_SensorJsTest005 success" + JSON.stringify(data));
expect(code).assertEqual(202); expect(typeof (data.intensity)).assertEqual("number");
done(); done();
}, },
}); fail: function (data, code) {
console.log("subscribeLight_SensorJsTest005 is failed, data: " + data + ", code: " + code);
expect(code).assertEqual(202);
done();
},
});
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeLight_SensorJsTest005 Device does not support! '); console.info('subscribeLight_SensorJsTest005 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0060 * @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0060
...@@ -221,49 +249,271 @@ describe("SensorJsTest_sensor_31", function () { ...@@ -221,49 +249,271 @@ describe("SensorJsTest_sensor_31", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeLight_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeLight_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest006---------------------------');
try{ try{
sensor.getSingleSensor(LightId ,(error, data) => { sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({ if (error) {
interval: 'normal', console.info('subscribeLight_SensorJsTest006 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeLight_SensorJsTest006 success" + JSON.stringify(data)); done();
expect(typeof (data.intensity)).assertEqual("number"); } else {
done(); sensor.subscribeLight({
}, interval: 'normal',
}); success: function (data) {
console.info("subscribeLight_SensorJsTest006 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
done();
},
});
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeLight_SensorJsTest006 Device does not support! '); console.info('subscribeLight_SensorJsTest006 Device does not support! ');
done(); done();
} }
}) })
/* /*
* @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0070 * @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0070
* @tc.name: subscribeLight_SensorJsTest007 * @tc.name: subscribeLight_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeLight_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("subscribeLight_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest007---------------------------'); console.info('----------------------subscribeLight_SensorJsTest007---------------------------');
try{ try{
sensor.getSingleSensor(LightId ,(error, data) => { sensor.getSingleSensor(LightId ,(error, data) => {
sensor.subscribeLight({ if (error) {
interval: 'normal', console.info('subscribeLight_SensorJsTest007 error');
success: function (data) { expect(false).assertTrue();
console.info("subscribeLight_SensorJsTest007 success" + JSON.stringify(data)); done();
expect(typeof (data.intensity)).assertEqual("number"); } else {
done(); sensor.subscribeLight({
}, interval: 'game',
fail: function (data, code) { success: function (data) {
console.log("subscribeLight_SensorJsTest007 is failed, data: " + data + ", code: " + code); console.info("subscribeLight_SensorJsTest007 success" + JSON.stringify(data));
expect(false).assertTrue(); expect(typeof (data.intensity)).assertEqual("number");
}, },
}); fail: null,
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
}) })
} catch (error) { } catch (error) {
console.info('subscribeLight_SensorJsTest007 Device does not support! '); console.info('subscribeLight_SensorJsTest007 Device does not support! ');
done(); done();
} }
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeLight_JSTest_0080
* @tc.name: subscribeLight_SensorJsTest008
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeLight_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest008---------------');
try{
sensor.getSingleSensor(LightId ,(error, data) => {
if (error) {
console.info('subscribeLight_SensorJsTest008 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeLight({
interval: 'game',
success: function (data) {
console.info("subscribeLight_SensorJsTest008 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeLight_SensorJsTest008 Device does not support! ');
done();
}
}) })
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0090
* @tc.name: subscribeLight_SensorJsTest009
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeLight_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try{
sensor.getSingleSensor(LightId ,(error, data) => {
if (error) {
console.info('subscribeLight_SensorJsTest009 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeLight({
interval: 'ui',
success: function (data) {
console.info("subscribeLight_SensorJsTest009 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeLight_SensorJsTest009 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0100
* @tc.name: subscribeLight_SensorJsTest010
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeLight_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest010---------------------------');
try{
sensor.getSingleSensor(LightId ,(error, data) => {
if (error) {
console.info('subscribeLight_SensorJsTest010 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeLight({
interval: 'normal',
success: function (data) {
console.info("subscribeLight_SensorJsTest010 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeLight_SensorJsTest010 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0110
* @tc.name: subscribeLight_SensorJsTest011
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeLight_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest011---------------------------');
try{
sensor.getSingleSensor(LightId ,(error, data) => {
if (error) {
console.info('subscribeLight_SensorJsTest011 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeLight({
interval: 'normal',
success: function (data) {
console.info("subscribeLight_SensorJsTest011 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
},
fail: undefined,
});
sensor.subscribeLight({
interval: 'normal',
success: function (data) {
console.info("subscribeLight_SensorJsTest011_1 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeLight_SensorJsTest011 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0120
* @tc.name: subscribeLight_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeLight_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest012---------------------------');
try{
sensor.getSingleSensor(LightId ,(error, data) => {
if (error) {
console.info('subscribeLight_SensorJsTest012 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeLight({
interval: 'xxx',
success: function (data) {
console.info("subscribeLight_SensorJsTest012 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
},
fail: undefined,
});
setTimeout(() => {
done();
}, 500);
}
})
} catch (error) {
console.info('subscribeLight_SensorJsTest012 Device does not support! ');
done();
}
})
/*
* @tc.number:SUB_SensorsSystem_SubscribeAccelerometer_JSTest_0130
* @tc.name: subscribeLight_SensorJsTest013
* @tc.desc:Verification results of the incorrect parameters of the test interface.
*/
it("subscribeLight_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeLight_SensorJsTest013---------------------------');
try{
sensor.getSingleSensor(LightId ,(error, data) => {
if (error) {
console.info('subscribeLight_SensorJsTest013 error');
expect(false).assertTrue();
done();
} else {
sensor.subscribeLight({
interval: 'xxx',
success: function (data) {
console.info("subscribeLight_SensorJsTest013 success" + JSON.stringify(data));
expect(typeof (data.intensity)).assertEqual("number");
},
fail: null,
});
setTimeout(() => {
sensor.unsubscribeLight();
done();
}, 1000);
}
})
} catch (error) {
console.info('subscribeLight_SensorJsTest013 Device does not support! ');
done();
}
})
})} })}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册