提交 d1a720fb 编写于 作者: L lixiangpeng5

xts use case differentiating device modification

Signed-off-by: Nlixiangpeng5 <lixiangpeng5@huawei.com>
Change-Id: I36d72a16e2c9cefeb08e214d61adbc7cfca648ac
上级 471b0ca5
...@@ -13,17 +13,22 @@ ...@@ -13,17 +13,22 @@
* limitations under the License. * limitations under the License.
*/ */
import vibrator from '@ohos.vibrator' import vibrator from '@ohos.vibrator'
import deviceInfo from '@ohos.deviceInfo'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function VibratorJsTest_misc_2() { export default function VibratorJsTest_misc_2() {
describe("VibratorJsTest_misc_2", function () { describe("VibratorJsTest_misc_2", function () {
var g_execute = true;
beforeAll(function () { beforeAll(function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
if (deviceInfo.deviceType == "tablet") {
g_execute = false;
}
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +36,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -31,7 +36,7 @@ describe("VibratorJsTest_misc_2", 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 +44,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -39,7 +44,7 @@ describe("VibratorJsTest_misc_2", 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,14 +52,14 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -47,14 +52,14 @@ describe("VibratorJsTest_misc_2", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
}) })
const OPERATION_FAIL_CODE = 14600101; const DEVICE_OPERATION_FAILED = 14600101;
const PERMISSION_ERROR_CODE = 201; const PERMISSION_ERROR_CODE = 201;
const PARAMETER_ERROR_CODE = 401; const PARAMETER_ERROR_CODE = 401;
const OPERATION_FAIL_MSG = 'Device operation failed.' const DEVICE_OPERATION_MSG = 'Device operation failed.'
const PERMISSION_ERROR_MSG = 'Permission denied.' const PERMISSION_ERROR_MSG = 'Permission denied.'
const PARAMETER_ERROR_MSG = 'The parameter invalid.' const PARAMETER_ERROR_MSG = 'The parameter invalid.'
...@@ -190,6 +195,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -190,6 +195,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0070 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0070
*/ */
it("VibratorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest007 vibrator error'); console.info('VibratorJsTest007 vibrator error');
...@@ -203,6 +209,11 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -203,6 +209,11 @@ describe("VibratorJsTest_misc_2", function () {
}, 500); }, 500);
} }
vibrator.vibrate("haptic.clock.timer", vibrateCallback); vibrator.vibrate("haptic.clock.timer", vibrateCallback);
} else {
console.info('VibratorJsTest007 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -211,6 +222,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -211,6 +222,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0080 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0080
*/ */
it("VibratorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest008 stop error'); console.info('VibratorJsTest008 stop error');
...@@ -224,6 +236,11 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -224,6 +236,11 @@ describe("VibratorJsTest_misc_2", function () {
}, 500); }, 500);
} }
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, vibrateCallback); vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, vibrateCallback);
} else {
console.info('VibratorJsTest008 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -232,7 +249,6 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -232,7 +249,6 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0090 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0090
*/ */
it("VibratorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------VibratorJsTest001---------------------------');
function stopPromise() { function stopPromise() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
vibrator.stop("time", (error) => { vibrator.stop("time", (error) => {
...@@ -376,6 +392,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -376,6 +392,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0140 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0140
*/ */
it("VibratorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(() => { vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(() => {
console.log("VibratorJsTest014 vibrate success"); console.log("VibratorJsTest014 vibrate success");
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -389,6 +406,11 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -389,6 +406,11 @@ describe("VibratorJsTest_misc_2", function () {
done(); done();
}, 500); }, 500);
}); });
} else {
console.info('VibratorJsTest014 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -397,6 +419,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -397,6 +419,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150
*/ */
it("VibratorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
vibrator.stop("preset").then(() => { vibrator.stop("preset").then(() => {
console.log("VibratorJsTest015 off success"); console.log("VibratorJsTest015 off success");
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -410,6 +433,11 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -410,6 +433,11 @@ describe("VibratorJsTest_misc_2", function () {
done(); done();
}, 500); }, 500);
}); });
} else {
console.info('VibratorJsTest015 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
......
...@@ -13,17 +13,22 @@ ...@@ -13,17 +13,22 @@
* limitations under the License. * limitations under the License.
*/ */
import vibrator from '@ohos.vibrator' import vibrator from '@ohos.vibrator'
import deviceInfo from '@ohos.deviceInfo'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function VibratorJsTest_misc_3() { export default function VibratorJsTest_misc_3() {
describe("VibratorJsTest_misc_3", function () { describe("VibratorJsTest_misc_3", function () {
var g_execute = true;
beforeAll(function () { beforeAll(function () {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll caled') console.info('beforeAll called')
if (deviceInfo.deviceType == "tablet") {
g_execute = false;
}
}) })
afterAll(function () { afterAll(function () {
...@@ -31,7 +36,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -31,7 +36,7 @@ describe("VibratorJsTest_misc_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 () {
...@@ -39,7 +44,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -39,7 +44,7 @@ describe("VibratorJsTest_misc_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 () {
...@@ -47,17 +52,17 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -47,17 +52,17 @@ describe("VibratorJsTest_misc_3", function () {
/* /*
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach caled') console.info('afterEach called')
vibrator.stop("preset"); vibrator.stop("preset");
vibrator.stop("time"); vibrator.stop("time");
console.info('afterEach called') console.info('afterEach called')
}) })
const OPERATION_FAIL_CODE = 14600101; const DEVICE_OPERATION_FAILED = 14600101;
const PERMISSION_ERROR_CODE = 201; const PERMISSION_ERROR_CODE = 201;
const PARAMETER_ERROR_CODE = 401; const PARAMETER_ERROR_CODE = 401;
const OPERATION_FAIL_MSG = 'Device operation failed.' const DEVICE_OPERATION_MSG = 'Device operation failed.'
const PERMISSION_ERROR_MSG = 'Permission denied.' const PERMISSION_ERROR_MSG = 'Permission denied.'
const PARAMETER_ERROR_MSG = 'The parameter invalid.' const PARAMETER_ERROR_MSG = 'The parameter invalid.'
...@@ -122,6 +127,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -122,6 +127,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0310 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0310
*/ */
it("VibratorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
vibrator.vibrate({ vibrator.vibrate({
type: "preset", type: "preset",
effectId: "haptic.clock.timer", effectId: "haptic.clock.timer",
...@@ -140,6 +146,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -140,6 +146,11 @@ describe("VibratorJsTest_misc_3", function () {
done(); done();
}, 500); }, 500);
}); });
} else {
console.info('VibratorJsTest021 vibrator success');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -180,6 +191,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -180,6 +191,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0330 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0330
*/ */
it("VibratorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
try { try {
vibrator.vibrate({ vibrator.vibrate({
type: "preset", type: "preset",
...@@ -203,7 +215,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -203,7 +215,11 @@ describe("VibratorJsTest_misc_3", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
} else {
console.info('VibratorJsTest023 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -272,6 +288,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -272,6 +288,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0370 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0370
*/ */
it("VibratorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
await vibrator.vibrate({ await vibrator.vibrate({
type: "preset", type: "preset",
effectId: "haptic.clock.timer", effectId: "haptic.clock.timer",
...@@ -284,6 +301,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -284,6 +301,11 @@ describe("VibratorJsTest_misc_3", function () {
expect(false).assertTrue(); expect(false).assertTrue();
}); });
done(); done();
} else {
console.info('VibratorJsTest027 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -320,6 +342,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -320,6 +342,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0390 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0390
*/ */
it("VibratorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
try { try {
vibrator.vibrate({ vibrator.vibrate({
type: "preset", type: "preset",
...@@ -340,6 +363,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -340,6 +363,11 @@ describe("VibratorJsTest_misc_3", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
} else {
console.info('VibratorJsTest029 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -456,13 +484,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -456,13 +484,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest032 reject"); console.info("VibratorJsTest032 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest032 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -509,12 +542,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -509,12 +542,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest033 reject"); console.info("VibratorJsTest033 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest033 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -561,13 +600,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -561,13 +600,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest034 reject"); console.info("VibratorJsTest034 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest034 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -613,13 +657,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -613,13 +657,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest035 reject"); console.info("VibratorJsTest035 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest035 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -665,13 +714,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -665,13 +714,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest036 reject"); console.info("VibratorJsTest036 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest036 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -718,13 +772,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -718,13 +772,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest037 reject"); console.info("VibratorJsTest037 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest037 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -771,13 +830,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -771,13 +830,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest038 reject"); console.info("VibratorJsTest038 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest038 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -824,13 +888,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -824,13 +888,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest039 reject"); console.info("VibratorJsTest039 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest039 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
* @tc.name:VibratorJsTest040 * @tc.name:VibratorJsTest040
...@@ -895,6 +964,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -895,6 +964,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0520 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0520
*/ */
it("VibratorJsTest042", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest042", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
vibrator.vibrate({ vibrator.vibrate({
type: "preset", type: "preset",
effectId: "haptic.clock.timer", effectId: "haptic.clock.timer",
...@@ -914,6 +984,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -914,6 +984,11 @@ describe("VibratorJsTest_misc_3", function () {
done(); done();
}, 500); }, 500);
}); });
} else {
console.info('VibratorJsTest042 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1009,6 +1084,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1009,6 +1084,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0560 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0560
*/ */
it("VibratorJsTest046", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest046", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
vibrator.startVibration({ vibrator.startVibration({
type: "preset", type: "preset",
effectId: "haptic.clock.timer", effectId: "haptic.clock.timer",
...@@ -1027,6 +1103,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1027,6 +1103,11 @@ describe("VibratorJsTest_misc_3", function () {
done(); done();
}, 500); }, 500);
}); });
} else {
console.info('VibratorJsTest046 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1066,6 +1147,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1066,6 +1147,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0580 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0580
*/ */
it("VibratorJsTest048", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest048", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
try { try {
vibrator.startVibration({ vibrator.startVibration({
type: "preset", type: "preset",
...@@ -1085,6 +1167,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1085,6 +1167,11 @@ describe("VibratorJsTest_misc_3", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
} else {
console.info('VibratorJsTest048 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1158,6 +1245,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1158,6 +1245,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0620 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0620
*/ */
it("VibratorJsTest052", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest052", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
await vibrator.startVibration({ await vibrator.startVibration({
type: "preset", type: "preset",
effectId: "haptic.clock.timer", effectId: "haptic.clock.timer",
...@@ -1172,6 +1260,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1172,6 +1260,11 @@ describe("VibratorJsTest_misc_3", function () {
expect(false).assertTrue(); expect(false).assertTrue();
}); });
done(); done();
} else {
console.info('VibratorJsTest052 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1210,6 +1303,7 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1210,6 +1303,7 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0640 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0640
*/ */
it("VibratorJsTest054", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("VibratorJsTest054", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
if (g_execute) {
try { try {
vibrator.startVibration({ vibrator.startVibration({
type: "preset", type: "preset",
...@@ -1232,6 +1326,11 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1232,6 +1326,11 @@ describe("VibratorJsTest_misc_3", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
} else {
console.info('VibratorJsTest054 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1327,8 +1426,8 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1327,8 +1426,8 @@ describe("VibratorJsTest_misc_3", function () {
}, (error)=>{ }, (error)=>{
if (error) { if (error) {
console.info("VibratorJsTest057_1 error :" + error); console.info("VibratorJsTest057_1 error :" + error);
expect(error.code).assertEqual(OPERATION_FAIL_CODE); expect(error.code).assertEqual(DEVICE_OPERATION_FAILED);
expect(error.message).assertEqual(OPERATION_FAIL_MSG); expect(error.message).assertEqual(DEVICE_OPERATION_MSG);
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -1357,13 +1456,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1357,13 +1456,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest057 reject"); console.info("VibratorJsTest057 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest057 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1413,12 +1517,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1413,12 +1517,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest058 reject"); console.info("VibratorJsTest058 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest058 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1437,8 +1547,8 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1437,8 +1547,8 @@ describe("VibratorJsTest_misc_3", function () {
usage: "unknown", usage: "unknown",
}, (error)=>{ }, (error)=>{
if (error) { if (error) {
expect(error.code).assertEqual(OPERATION_FAIL_CODE); expect(error.code).assertEqual(DEVICE_OPERATION_FAILED);
expect(error.message).assertEqual(OPERATION_FAIL_MSG); expect(error.message).assertEqual(DEVICE_OPERATION_MSG);
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -1466,13 +1576,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1466,13 +1576,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest059 reject"); console.info("VibratorJsTest059 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest059 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1490,8 +1605,8 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1490,8 +1605,8 @@ describe("VibratorJsTest_misc_3", function () {
usage: "alarm" usage: "alarm"
}, (error)=>{ }, (error)=>{
if (error) { if (error) {
expect(error.code).assertEqual(OPERATION_FAIL_CODE); expect(error.code).assertEqual(DEVICE_OPERATION_FAILED);
expect(error.message).assertEqual(OPERATION_FAIL_MSG); expect(error.message).assertEqual(DEVICE_OPERATION_MSG);
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -1519,13 +1634,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1519,13 +1634,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest060 reject"); console.info("VibratorJsTest060 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest060 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1571,13 +1691,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1571,13 +1691,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest061 reject"); console.info("VibratorJsTest061 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest061 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1624,13 +1749,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1624,13 +1749,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest062 reject"); console.info("VibratorJsTest062 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest062 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
* @tc.name:VibratorJsTest063 * @tc.name:VibratorJsTest063
...@@ -1676,13 +1806,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1676,13 +1806,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest063 reject"); console.info("VibratorJsTest063 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest063 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1701,8 +1836,8 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1701,8 +1836,8 @@ describe("VibratorJsTest_misc_3", function () {
usage: "unknown" usage: "unknown"
}, (error)=>{ }, (error)=>{
if (error) { if (error) {
expect(error.code).assertEqual(OPERATION_FAIL_CODE); expect(error.code).assertEqual(DEVICE_OPERATION_FAILED);
expect(error.message).assertEqual(OPERATION_FAIL_MSG); expect(error.message).assertEqual(DEVICE_OPERATION_MSG);
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -1730,13 +1865,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1730,13 +1865,18 @@ describe("VibratorJsTest_misc_3", function () {
} }
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return vibratePromise(); return vibratePromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest064 reject"); console.info("VibratorJsTest064 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest064 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
...@@ -1807,13 +1947,18 @@ describe("VibratorJsTest_misc_3", function () { ...@@ -1807,13 +1947,18 @@ describe("VibratorJsTest_misc_3", function () {
}, 500); }, 500);
}); });
}) })
if (g_execute) {
await promise.then(() =>{ await promise.then(() =>{
return stopPromise(); return stopPromise();
}, ()=>{ }, ()=>{
console.info("VibratorJsTest066 reject"); console.info("VibratorJsTest066 reject");
}) })
done(); done();
} else {
console.info('VibratorJsTest066 is not supported on this device');
expect(true).assertTrue();
done();
}
}) })
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册