未验证 提交 8aff1f41 编写于 作者: O openharmony_ci 提交者: Gitee

!4866 【powermgr】【master】新框架适配用例&用例整改

Merge pull request !4866 from kangqiao/master
文件模式从 100755 更改为 100644
......@@ -21,9 +21,13 @@ ohos_js_hap_suite("powermgr_battery_test") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsPowerMgrBatteryTest"
subsystem_name = "powermgr"
part_name = "battery_manager"
}
ohos_js_assets("powermgr_battery_js_assets") {
source_dir = "./src/main/js/default"
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("powermgr_battery_resources") {
sources = [ "./src/main/resources" ]
......
{
"description": "Configuration for powermgr battery Tests",
"driver": {
"type": "JSUnitTest",
"type": "OHJSUnitTest",
"test-timeout": "90000",
"package": "com.example.mybatteryapp",
"shell-timeout": "90000"
"shell-timeout": "90000",
"bundle-name": "com.example.mybatteryapp",
"package-name": "com.example.mybatteryapp",
"testcase-timeout": 10000
},
"kits": [
{
......
文件模式从 100755 更改为 100644
......@@ -14,7 +14,7 @@
"deviceConfig": {},
"module": {
"package": "com.example.mybatteryapp",
"name": ".MyApplication",
"name": ".entry",
"deviceType": [
"phone"
],
......@@ -25,7 +25,6 @@
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
......@@ -36,11 +35,29 @@
]
}
],
"name": "com.example.mybatteryapp.MainAbility",
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
......@@ -54,6 +71,16 @@
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions": [
......@@ -61,6 +88,12 @@
"name": "ohos.permission.RUNNING_LOCK",
"reason": "use ohos.permission.RUNNING_LOCK"
}
]
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility":".MainAbility",
"srcPath":""
}
}
\ No newline at end of file
......@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import device from '@system.device';
export default {
onCreate() {
......
{
"strings": {
"hello": "Hello",
"world": "World"
"world": "World",
"test" : "PowerTest"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
"world": "世界",
"test" : "电源服务测试"
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Copyright (c) 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
......@@ -12,31 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
import {Core, ExpectExtend} from 'deccjsunit/index'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
data: {
title: ""
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World",
"test": "PowerTest"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界",
"test":"电源服务测试"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 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
......@@ -12,6 +12,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./battery_unit.test.js')
require('./battery_common_event.test.js')
require('./system_battery.test.js')
\ No newline at end of file
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.test');
}
}
/*
* Copyright (c) 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* 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 batteryCommonEventTest from './battery_common_event.test.js'
import batteryUnitTest from './battery_unit.test.js'
import batteryManagerPerformanceTest from './batterymanager_performance.test.js'
import systemBatteryTest from './system_battery.test.js'
export default function testsuite() {
batteryCommonEventTest()
batteryUnitTest()
//batteryManagerPerformanceTest()
systemBatteryTest()
}
\ No newline at end of file
......@@ -13,12 +13,12 @@
* limitations under the License.
*/
import app from '@system.app'
import batteryInfo from '@ohos.batteryInfo';
import brightness from '@ohos.brightness';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import { describe, it, expect } from '@ohos/hypium'
describe('appInfoTest_battery_2', function () {
export default function BatteryUnitTest() {
describe('BatteryUnitTest', function () {
console.log("*************Battery Unit Test Begin*************");
/**
......@@ -522,3 +522,4 @@ describe('appInfoTest_battery_2', function () {
expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_TECHNOLOGY == 10).assertTrue();
})
})
}
\ No newline at end of file
......@@ -14,9 +14,10 @@
*/
import batteryInfo from '@ohos.batteryInfo';
import { describe, it, expect } from 'deccjsunit/index';
import { describe, it, expect } from '@ohos/hypium';
describe('appInfoTest_battery_4', function () {
export default function BatteryManagerPerformanceTest() {
describe('BatteryManagerPerformanceTest', function () {
console.log("*************Edited Battery Performance Test Begin*************");
const MAXNUM = 1000;
......@@ -212,3 +213,4 @@ describe('appInfoTest_battery_4', function () {
avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
})
})
}
\ No newline at end of file
......@@ -15,8 +15,7 @@
import battery from '@system.battery';
import batteryInfo from '@ohos.batteryInfo';
import {describe, it, expect} from 'deccjsunit/index';
import { describe, it, expect } from '@ohos/hypium';
function successFunc(data, tag) {
console.log(tag + ": level: " + data.level + ", charging: " + data.charging);
......@@ -39,7 +38,8 @@ function completeFunc(tag) {
console.log(tag + ": The device information is obtained successfully.");
}
describe('appInfoTest_battery_3', function () {
export default function SystemBatteryTest() {
describe('SystemBatteryTest', function () {
console.log("*************System Battery Unit Test Begin*************");
/**
......@@ -192,4 +192,5 @@ describe('appInfoTest_battery_3', function () {
battery.getStatus();
expect(!allNull).assertTrue();
});
});
})
}
\ No newline at end of file
......@@ -7,6 +7,22 @@
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
文件模式从 100755 更改为 100644
......@@ -21,9 +21,13 @@ ohos_js_hap_suite("powermgr_display_test") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsPowerMgrDisplayTest"
subsystem_name = "powermgr"
part_name = "display_manager"
}
ohos_js_assets("powermgr_display_js_assets") {
source_dir = "./src/main/js/default"
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("powermgr_display_resources") {
sources = [ "./src/main/resources" ]
......
{
"description": "Configuration for powermgr display Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.mypowerdisplayapp",
"shell-timeout": "60000"
"type": "OHJSUnitTest",
"bundle-name": "com.example.mypowerdisplayapp",
"package-name": "com.example.mypowerdisplayapp",
"test-timeout": "90000",
"shell-timeout": "90000"
},
"kits": [
{
......
......@@ -14,7 +14,7 @@
"deviceConfig": {},
"module": {
"package": "com.example.mypowerdisplayapp",
"name": ".MyApplication",
"srcPath":"",
"deviceType": [
"phone"
],
......@@ -25,7 +25,6 @@
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
......@@ -36,11 +35,29 @@
]
}
],
"name": "com.example.mypowerdisplayapp.MainAbility",
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
......@@ -54,7 +71,23 @@
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"name": ".entry",
"mainAbility":".MainAbility"
}
}
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* 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
......@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import device from '@system.device';
export default {
onCreate() {
......
{
"strings": {
"hello": "Hello",
"world": "World"
"world": "World",
"test" : "PowerTest"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
"world": "世界",
"test" : "电源服务测试"
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* 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
......
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
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
......
/*
* 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (c) 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
......@@ -12,32 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
import {Core, ExpectExtend} from 'deccjsunit/index'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
data: {
title: ""
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World",
"test": "PowerTest"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界",
"test":"电源服务测试"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.test');
}
}
/*
* Copyright (c) 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
......@@ -12,4 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./system_display.test.js')
\ No newline at end of file
import systemDisplayTest from "./system_display.test"
export default function testsuite() {
systemDisplayTest()
}
\ No newline at end of file
......@@ -14,17 +14,14 @@
*/
import brightness from '@system.brightness';
import { describe } from 'deccjsunit/index';
import { describe, it, expect } from '@ohos/hypium';
const INPUT_ERROR_CODE_CODE = 202;
const SET_VALUE_MSG = "value is not an available number";
const SET_MODE_MSG = "value is not an available number";
function sleep(time){
return new Promise((resolve) => setTimeout(resolve, time));
}
describe('appInfoTest_display', function () {
export default function SystemDisplayTest() {
describe('SystemDisplayTest', function () {
console.log("*************System SystemDisplay Unit Test Begin*************");
/**
......@@ -301,9 +298,11 @@ describe('appInfoTest_display', function () {
* @tc.desc set keep screen on true
*/
it('set_keep_screen_on_true', 0, async function () {
let sleepTime = 35 * 1000;
brightness.setKeepScreenOn({
keepScreenOn: true,
success: () => {
expect().assertTrue();
},
fail: (data, code) => {
console.log("set_keep_screen_on, data: " + data + ", code: " + code);
expect().assertFail();
......@@ -312,15 +311,7 @@ describe('appInfoTest_display', function () {
console.log("The device information is obtained successfully. Procedure");
}
});
await sleep(sleepTime);
power.isScreenOn().then(screenOn => {
console.info('The current screenOn is ' + screenOn);
expect(screenOn).assertTrue();
}).catch(error => {
console.log('isScreenOn error: ' + error);
})
})
});
/**
* @tc.number system_display_js_0501
......@@ -328,25 +319,19 @@ describe('appInfoTest_display', function () {
* @tc.desc set keep screen on false
*/
it('set_keep_screen_on_false', 0, async function () {
let sleepTime = 35 * 1000;
brightness.setKeepScreenOn({
keepScreenOn: false,
success: () => {
expect().assertTrue();
},
fail: (data, code) => {
console.log("set_keep_screen_on_false, data: " + data + ", code: " + code);
expect().assertFail();
},
complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure");
}
});
await sleep(sleepTime);
power.isScreenOn().then(screenOn => {
console.info('set_keep_screen_on_false The current screenOn is ' + screenOn);
expect(screenOn).assertFalse();
}).catch(error => {
console.log('set_keep_screen_on_false isScreenOn error: ' + error);
});
});
});
})
}
\ No newline at end of file
......@@ -7,6 +7,22 @@
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
......@@ -21,6 +21,8 @@ ohos_js_hap_suite("powermgr_power_test") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsPowerMgrPowerTest"
subsystem_name = "powermgr"
part_name = "power_manager"
}
ohos_js_assets("powermgr_power_js_assets") {
js2abc = true
......
......@@ -5,7 +5,8 @@
"test-timeout": "60000",
"shell-timeout": "60000",
"bundle-name": "com.example.mypowerapp",
"package-name": "com.example.mypowerapp"
"package-name": "com.example.mypowerapp",
"testcase-timeout": 60000
},
"kits": [
{
......
......@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import device from '@system.device';
export default {
onCreate() {
......
{
"strings": {
"hello": "Hello",
"world": "World"
"world": "World",
"test" : "PowerTest"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
"world": "世界",
"test" : "电源服务测试"
}
}
\ No newline at end of file
......@@ -12,9 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
export default {
data: {
title: ""
......
{
"strings": {
"hello": "Hello",
"world": "World"
"world": "World",
"test": "PowerTest"
},
"Files": {
}
......
{
"strings": {
"hello": "您好",
"world": "世界"
"world": "世界",
"test":"电源服务测试"
},
"Files": {
}
......
......@@ -18,7 +18,7 @@ export default {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
this.title = this.$t('strings.test');
}
}
......
......@@ -12,9 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import appInfoTest_power_1 from './power_manager_power.test.js'
import appInfoTest_power_2 from './power_manager_running_lock.test.js'
import powerManagerPowerTest from './power_manager_power.test.js'
import powerManagerRebootShutTest from './power_manager_rebootshut.test.js'
import powerManagerRunningLockTest from './power_manager_running_lock.test.js'
import powerPerformanceTest from './power_performance.test.js'
export default function testsuite() {
appInfoTest_power_1()
appInfoTest_power_2()
powerManagerPowerTest()
//powerManagerRebootShutTest()
powerManagerRunningLockTest()
//powerPerformanceTest()
}
......@@ -15,10 +15,10 @@
import power from '@ohos.power';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { describe, it, expect } from '@ohos/hypium'
export default function appInfoTest_power_1() {
describe('appInfoTest_power_1', function () {
export default function PowerManagerPowerTest() {
describe('PowerManagerPowerTest', function () {
console.log("*************Power Unit Test Begin*************");
/**
......
......@@ -15,10 +15,10 @@
import power from '@ohos.power';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { describe, it, expect } from '@ohos/hypium'
export default function appInfoTest() {
describe('appInfoTest', function () {
export default function PowerManagerRebootShutTest() {
describe('PowerManagerRebootShutTest', function () {
console.log("*************Power Unit Test Begin*************");
/**
......
......@@ -15,10 +15,10 @@
import runningLock from '@ohos.runningLock'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { describe, it, expect } from '@ohos/hypium'
export default function appInfoTest_power_2() {
describe('appInfoTest_power_2', function () {
export default function PowerManagerRunningLockTest() {
describe('PowerManagerRunningLockTest', function () {
console.log("*************RunningLock Unit Test Begin*************");
/**
......
......@@ -18,8 +18,8 @@ import power from '@ohos.power';
import brightness from '@ohos.brightness';
import { describe, it, expect } from '@ohos/hypium';
export default function appInfoTest_power_3() {
describe('appInfoTest_power_3', function () {
export default function PowerPerformanceTest() {
describe('PowerPerformanceTest', function () {
console.log("*************Power Performance Test Begin*************");
const MAXNUM = 1000;
......
......@@ -21,6 +21,8 @@ ohos_js_hap_suite("powermgr_thermal_test") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsPowerMgrThermalTest"
subsystem_name = "powermgr"
part_name = "thermal_manager"
}
ohos_js_assets("powermgr_thermal_js_assets") {
js2abc = true
......
......@@ -5,7 +5,8 @@
"test-timeout": "120000",
"shell-timeout": "120000",
"bundle-name": "com.example.mythermalapp",
"package-name": "com.example.mythermalapp"
"package-name": "com.example.mythermalapp",
"testcase-timeout": 60000
},
"kits": [
{
......
......@@ -12,8 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
export default {
data: {
......
{
"strings": {
"hello": "Hello",
"world": "World"
"world": "World",
"test": "PowerTest"
},
"Files": {
}
......
{
"strings": {
"hello": "您好",
"world": "世界"
"world": "世界",
"test":"电源服务测试"
},
"Files": {
}
......
......@@ -18,7 +18,7 @@ export default {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
this.title = this.$t('strings.test');
}
}
......
......@@ -12,7 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import appInfoTest_thermal_1 from './thermal_unittest.test.js'
import thermalCommonEvent from './thermal_common_event.test.js'
import thermalPerformance from './thermal_performance.test.js'
import thermalUnit from './thermal_uint.test.js'
import thermalUnitTest from './thermal_unittest.test.js'
export default function testsuite() {
appInfoTest_thermal_1()
thermalUnitTest()
//thermalUnit()
//thermalCommonEvent()
//thermalPerformance()
}
......@@ -15,8 +15,8 @@
import commonEvent from '@ohos.commonEvent';
import thermal from "@ohos.thermal"
export default function appInfoTest_thermal_3() {
describe('appInfoTest_thermal_3', function () {
export default function ThermalCommonEvent() {
describe('ThermalCommonEvent', function () {
console.log("*************Thermal commonEvent Test Begin*************");
/**
......
......@@ -14,10 +14,10 @@
*/
import thermal from "@ohos.thermal"
import { describe, it, expect } from '@ohos/hypium';
import { describe, it } from '@ohos/hypium';
export default function appInfoTest_thermal_4() {
describe('appInfoTest_thermal_4', function () {
export default function ThermalPerformance() {
describe('ThermalPerformance', function () {
console.log("*************Thermal Performance Test Begin*************");
performanceTest1();
performanceTest2();
......
......@@ -14,13 +14,11 @@
* limitations under the License.
*/
import app from '@system.app'
import thermal from "@ohos.thermal"
import ThermalLevel from "@ohos.thermal"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { describe, it, expect } from '@ohos/hypium'
export default function appInfoTest_thermal_2() {
describe('appInfoTest_thermal_2', function () {
export default function ThermalUnit() {
describe('ThermalUnit', function () {
console.log("*************Thermal API Test Begin*************");
test1();
test2();
......@@ -41,7 +39,7 @@ describe('appInfoTest_thermal_2', function () {
function test1() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0010
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0010
* @tc.name Thermal_JSTest0010
* @tc.desc Thermal acquisition kit
*/
......@@ -62,7 +60,7 @@ function test1() {
function test2() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0020
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0020
* @tc.name Thermal_JSTest0020
* @tc.desc Thermal acquisition kit
*/
......@@ -82,7 +80,7 @@ function test2() {
function test3() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0030
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0030
* @tc.name Thermal_JSTest0030
* @tc.desc Thermal acquisition kit
*/
......@@ -102,7 +100,7 @@ function test3() {
function test4() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0040
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0040
* @tc.name Thermal_JSTest0040
* @tc.desc Thermal acquisition kit
*/
......@@ -123,7 +121,7 @@ function test4() {
function test5() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0050
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0050
* @tc.name Thermal_JSTest0050
* @tc.desc Thermal acquisition kit
*/
......@@ -143,7 +141,7 @@ function test5() {
function test6() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0060
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0060
* @tc.name Thermal_JSTest0060
* @tc.desc Thermal acquisition kit
*/
......@@ -164,7 +162,7 @@ function test6() {
function test7() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0070
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0070
* @tc.name Thermal_JSTest0070
* @tc.desc Thermal acquisition kit
*/
......@@ -188,7 +186,7 @@ function test7() {
function test8() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0080
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0080
* @tc.name Thermal_JSTest0080
* @tc.desc Thermal acquisition kit
*/
......@@ -212,7 +210,7 @@ function test8() {
function test9() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0090
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0090
* @tc.name Thermal_JSTest0090
* @tc.desc Thermal acquisition kit
*/
......@@ -237,7 +235,7 @@ function test9() {
function test10() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0100
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0100
* @tc.name Thermal_JSTest0100
* @tc.desc Thermal acquisition kit
*/
......@@ -262,7 +260,7 @@ function test10() {
function test11() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0110
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0110
* @tc.name Thermal_JSTest0110
* @tc.desc Thermal acquisition kit
*/
......@@ -286,7 +284,7 @@ function test11() {
function test12() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0120
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0120
* @tc.name Thermal_JSTest0120
* @tc.desc Thermal acquisition kit
*/
......@@ -310,7 +308,7 @@ function test12() {
function test13() {
const MSEC_1000 = 1000;
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0130
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0130
* @tc.name Thermal_JSTest0130
* @tc.desc Thermal acquisition kit
*/
......
......@@ -13,14 +13,12 @@
* limitations under the License.
*/
import app from '@system.app'
import thermal from "@ohos.thermal"
import ThermalLevel from "@ohos.thermal"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { describe, it, expect } from '@ohos/hypium'
const MSEC_1000 = 1000;
export default function appInfoTest_thermal_1() {
describe('appInfoTest_thermal_1', function () {
export default function ThermalUnitTest() {
describe('ThermalUnitTest', function () {
console.log("*************Thermal API Test Begin*************");
test14();
test15();
......@@ -28,7 +26,7 @@ describe('appInfoTest_thermal_1', function () {
function test14() {
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0010
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0010
* @tc.name Thermal_014
* @tc.desc Thermal acquisition kit
*/
......@@ -48,7 +46,7 @@ function test14() {
function test15() {
/* @tc.number USB_PowerSystem_ThermalManager_JSTest_0020
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0020
* @tc.name Thermal_015
* @tc.desc Thermal acquisition kit
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册