未验证 提交 0b7d5123 编写于 作者: O openharmony_ci 提交者: Gitee

!7798 【resourceschedule】【master】下线信息查询新增系统api用例&提醒代理模块api8用例优化

Merge pull request !7798 from 南先森/rms0303
......@@ -21,6 +21,7 @@ group("resourceschedule_standard") {
"continuoustaskrelyhap:ContinuousTaskRelyHap",
"deviceusagestatisticsjsunit:resourceschedule_deviceusagestatisticsjsunit_js_test",
"reminderagent:resourceschedule_reminderagent_js_test",
"reminderagentManager:resourceschedule_reminderagentmgr_js_test",
"workscheduler:resourceschedule_workscheduler_js_test",
]
}
......
......@@ -14,9 +14,8 @@
*/
import bundlestate_test from './BundleState.test.js'
import DeviceUsageStatisticsJsTest from './DeviceUsageStatisticsJsunit.test.js'
import UsageStatisticsTest from './UsageStatistics.test.js'
export default function testsuite() {
bundlestate_test()
DeviceUsageStatisticsJsTest()
UsageStatisticsTest()
}
/*
* 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 usageStatistics from '@ohos.resourceschedule.usageStatistics'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function UsageStatistics() {
describe("UsageStatistics", 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 caled')
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0025
* @tc.name: UsageStatistics001
* @tc.desc: test isIdleState promise.
*/
it("UsageStatistics001", 0, async function (done) {
console.info('----------------------UsageStatistics001---------------------------');
let bundleName = 'ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function';
try {
usageStatistics.isIdleState(bundleName).then((res) => {
console.info('test UsageStatistics001 isIdleState promise success.' + res);
expect(res).assertFalse();
done()
}).catch((err) => {
console.info('test UsageStatistics001 isIdleState promise failure.' + err.code);
});
} catch (error) {
console.info('isIdleState throw error, code is: ' + error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0026
* @tc.name: UsageStatistics002
* @tc.desc: test isIdleState callback.
*/
it("UsageStatistics002", 0, async function (done) {
console.info('----------------------UsageStatistics002---------------------------');
let bundleName = 'ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function';
try {
usageStatistics.isIdleState(bundleName, (err, res) => {
if(err) {
console.info('test UsageStatistics002 isIdleState callback failure.' + err.code);
} else {
console.info('test UsageStatistics002 isIdleState callback success.' + res);
expect(res).assertFalse();
done();
}
});
} catch (error) {
console.info('isIdleState throw error, code is: ' + error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0027
* @tc.name: UsageStatistics003
* @tc.desc: test queryAppGroup promise.
*/
it("UsageStatistics003", 0, async function (done) {
console.info('----------------------UsageStatistics003---------------------------');
let bundleName = 'ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function';
try {
usageStatistics.queryAppGroup(bundleName).then( res => {
console.info('test UsageStatistics003 queryAppGroup promise success.' + res);
expect(res).assertEqual(10);
done();
}).catch( err => {
console.info('tets UsageStatistics003 queryAppGroup promise failure.' + err.code);
});
} catch (error) {
console.info('queryAppGroup throw error, code is: ' + error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0028
* @tc.name: UsageStatistics004
* @tc.desc: test queryAppGroup callback.
*/
it("UsageStatistics004", 0, async function (done) {
console.info('----------------------UsageStatistics004---------------------------');
let bundleName = 'ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function';
try {
usageStatistics.queryAppGroup(bundleName, (err, res) => {
if(err) {
console.info('test UsageStatistics004 queryAppGroup callback failure.' + err.code);
} else {
console.info('tets UsageStatistics004 queryAppGroup callback success.' + res);
expect(res).assertEqual(10);
done();
}
});
} catch (error) {
console.info('queryAppGroup throw error, code is: ' + error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0029
* @tc.name: UsageStatistics005
* @tc.desc: test queryCurrentBundleEvents promise.
*/
it("UsageStatistics005", 0, async function (done) {
console.info('----------------------UsageStatistics005---------------------------');
let beginTime = 0;
let endTime = 20000000000000;
try {
usageStatistics.queryCurrentBundleEvents(beginTime, endTime).then((res) => {
console.info('test UsageStatistics005 queryCurrentBundleEvents promise success.' + res);
expect(res).assertInstanceOf("Array");
done();
}).catch((err) => {
console.info('test UsageStatistics005 queryCurrentBundleEvents promise failure.' + err.code);
});
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0030
* @tc.name: UsageStatistics006
* @tc.desc: test queryCurrentBundleEvents callback.
*/
it("UsageStatistics006", 0, async function (done) {
console.info('----------------------UsageStatistics006---------------------------');
let beginTime = 0;
let endTime = 20000000000000;
try {
usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => {
if(err) {
console.info('tets UsageStatistics006 queryCurrentBundleEvents callback failure.' + err.code);
} else {
console.info('test UsageStatistics006 queryCurrentBundleEvents callback success.' + res);
expect(res).assertInstanceOf("Array");
done();
}
});
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0031
* @tc.name: UsageStatistics007
* @tc.desc: test BundleEvents bundleName.
*/
it("UsageStatistics007", 0, async function (done) {
console.info('----------------------UsageStatistics007---------------------------');
let beginTime = 10;
let endTime = 20000000000000;
try {
usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => {
if(err) {
console.info('tets UsageStatistics007 queryCurrentBundleEvents callback failure.' + err.code);
} else {
console.info('test UsageStatistics007 queryCurrentBundleEvents callback success.' + res);
expect(res).assertInstanceOf("Array");
if(res === undefined) {
res = [{bundleName: 'www.baidu.com'}];
}
console.info('test BundleEvents bundleName :' + res[0].bundleName);
done();
}
});
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0032
* @tc.name: UsageStatistics008
* @tc.desc: test BundleEvents eventId.
*/
it("UsageStatistics008", 0, async function (done) {
console.info('----------------------UsageStatistics008---------------------------');
let beginTime = 10;
let endTime = 20000000000000;
try {
usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => {
if(err) {
console.info('tets UsageStatistics008 queryCurrentBundleEvents callback failure.' + err.code);
} else {
console.info('test UsageStatistics008 queryCurrentBundleEvents callback success.' + res);
expect(res).assertInstanceOf("Array");
if(res === undefined) {
res = [{eventId: 0}];
}
console.info('test BundleEvents eventId :' + res[0].eventId);
done();
}
})
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0033
* @tc.name: UsageStatistics009
* @tc.desc: test BundleEvents eventOccurredTime.
*/
it("UsageStatistics009", 0, async function (done) {
console.info('----------------------UsageStatistics009---------------------------');
let beginTime = 10;
let endTime = 20000000000000;
try {
usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => {
if(err) {
console.info('tets UsageStatistics009 queryCurrentBundleEvents callback failure.' + err.code);
} else {
console.info('test UsageStatistics009 queryCurrentBundleEvents callback success.' + res);
expect(res).assertInstanceOf("Array");
if(res === undefined) {
res = [{eventOccurredTime: 10000000000000}];
}
console.info('test BundleEvents eventOccurredTime :' + res[0].eventOccurredTime);
done();
}
})
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0034
* @tc.name: UsageStatistics0010
* @tc.desc: test BundleEvents appGroup.
*/
it("UsageStatistics0010", 0, async function (done) {
console.info('----------------------UsageStatistics0010---------------------------');
let beginTime = 10;
let endTime = 20000000000000;
try {
usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => {
if(err) {
console.info('tets UsageStatistics0010 queryCurrentBundleEvents callback failure.' + err.code);
} else {
console.info('test UsageStatistics0010 queryCurrentBundleEvents callback success.' + res);
expect(res).assertInstanceOf("Array");
if(res === undefined) {
res = [{appGroup: 1}];
}
console.info('test BundleEvents appGroup :' + res[0].appGroup);
done();
}
})
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0035
* @tc.name: UsageStatistics0011
* @tc.desc: test BundleEvents indexOfLink.
*/
it("UsageStatistics0011", 0, async function (done) {
console.info('----------------------UsageStatistics0011---------------------------');
let beginTime = 10;
let endTime = 20000000000000;
try {
usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => {
if(err) {
console.info('tets UsageStatistics0011 queryCurrentBundleEvents callback failure.' + err.code);
} else {
console.info('test UsageStatistics0011 queryCurrentBundleEvents callback success.' + res);
expect(res).assertInstanceOf("Array");
if(res === undefined) {
res = [{indexOfLink: 'id'}];
}
console.info('test BundleEvents indexOfLink :' + res[0].indexOfLink);
done();
}
})
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0036
* @tc.name: UsageStatistics0012
* @tc.desc: test BundleEvents nameOfClass.
*/
it("UsageStatistics0012", 0, async function (done) {
console.info('----------------------UsageStatistics0012---------------------------');
let beginTime = 10;
let endTime = 20000000000000;
try {
usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => {
if(err) {
console.info('tets UsageStatistics0012 queryCurrentBundleEvents callback failure.' + err.code);
} else {
console.info('test UsageStatistics0012 queryCurrentBundleEvents callback success.' + res);
expect(res).assertInstanceOf("Array");
if(res === undefined) {
res = [{nameOfClass: 'BundleEvents'}];
}
console.info('test BundleEvents nameOfClass :' + res[0].nameOfClass);
done();
}
})
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0037
* @tc.name: UsageStatistics0013
* @tc.desc: test isIdleState promise.
*/
it("UsageStatistics0013", 0, async function (done) {
console.info('----------------------UsageStatistics0013---------------------------');
try {
usageStatistics.isIdleState(12345).then((res) => {
console.info('test UsageStatistics0013 isIdleStateone promise success.' + res);
}).catch((err) => {
console.info('test UsageStatistics0013 isIdleState promise failure.' + err.code);
});
} catch (error) {
console.info('isIdleState throw error, code is: ' + error.code + ',message is: ' + error.message);
expect(error.code).assertEqual("401");
done();
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0038
* @tc.name: UsageStatistics0014
* @tc.desc: test isIdleState callback.
*/
it("UsageStatistics0014", 0, async function (done) {
console.info('----------------------UsageStatistics0014---------------------------');
try {
usageStatistics.isIdleState("", (err, res) => {
if(err) {
console.info('test UsageStatistics0014 isIdleState callback failure.' + err.code);
} else {
console.info('test UsageStatistics0014 isIdleState callback success.' + res);
}
});
} catch (error) {
console.info('isIdleState throw error, code is: ' + error.code + ',message is: ' + error.message);
expect(error.code).assertEqual("401");
done();
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0039
* @tc.name: UsageStatistics0015
* @tc.desc: test queryAppGroup promise.
*/
it("UsageStatistics0015", 0, async function (done) {
console.info('----------------------UsageStatistics0015---------------------------');
try {
usageStatistics.queryAppGroup(123456).then( res => {
console.info('test UsageStatistics0015 queryAppGroup promise success.'+ res);
}).catch( err => {
console.info('tets UsageStatistics0015 queryAppGroup promise failure.' + err.code);
});
} catch (error) {
console.info('queryAppGroup throw error, code is: ' + error.code + ',message is: ' + error.message);
expect(error.code).assertEqual("401");
done();
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0040
* @tc.name: UsageStatistics0016
* @tc.desc: test queryAppGroup callback.
*/
it("UsageStatistics0016", 0, async function (done) {
console.info('----------------------UsageStatistics0016---------------------------');
try {
usageStatistics.queryAppGroup(null, (err, res) => {
if(err) {
console.info('test UsageStatistics0016 queryAppGroup callback failure.' + err.code);
} else {
console.info('tets UsageStatistics0016 queryAppGroup callback success.' + res);
}
});
} catch (error) {
console.info('queryAppGroup throw error, code is: ' + error.code + ',message is: ' + error.message);
expect(error.code).assertEqual("401");
done();
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0041
* @tc.name: UsageStatistics0017
* @tc.desc: test queryCurrentBundleEvents promise.
*/
it("UsageStatistics0017", 0, async function (done) {
console.info('----------------------UsageStatistics0017---------------------------');
try {
usageStatistics.queryCurrentBundleEvents(true, false).then((res) => {
console.info('test UsageStatistics0017 queryCurrentBundleEvents promise success.' + res);
}).catch((err) => {
console.info('test UsageStatistics0017 queryCurrentBundleEvents promise failure.' + err.code);
});
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
expect(error.code).assertEqual("401");
done();
}
})
/*
* @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0042
* @tc.name: UsageStatistics0018
* @tc.desc: test queryCurrentBundleEvents callback.
*/
it("UsageStatistics0018", 0, async function (done) {
console.info('----------------------UsageStatistics0018---------------------------');
try {
usageStatistics.queryCurrentBundleEvents("", "1235456", (err, res) => {
if(err) {
console.info('tets UsageStatistics0018 queryCurrentBundleEvents callback failure.' + err.code);
} else {
console.info('test UsageStatistics0018 queryCurrentBundleEvents callback success.' + res);
}
});
} catch (error) {
console.info('queryCurrentBundleEvents throw error, code is: ' +
error.code + ',message is: ' + error.message);
expect(error.code).assertEqual("401");
done();
}
})
})}
......@@ -13,9 +13,8 @@
* limitations under the License.
*/
import ReminderAgentTest from './ReminderAgentJs.test.js'
import ReminderAgentManagerTest from './ReminderAgentManagerJs.test.js'
export default function testsuite() {
ReminderAgentTest()
ReminderAgentManagerTest()
}
......@@ -2800,6 +2800,7 @@ export default function ReminderAgentTest() {
let firstId = 0;
let secondId = 0;
let diffId = 0
reminderAgent.cancelAllReminders().then(() =>{
for (let i = 0; i < maxLimitNumsOfApp; i++) {
(function (i) {
setTimeout(function () {
......@@ -2811,12 +2812,13 @@ export default function ReminderAgentTest() {
secondId = reminderId
diffId = secondId - firstId
expect(29).assertEqual(diffId);
done();
}
});
}, 500 * i);
}, 500);
})(i);
}
done();
})
})
/**
......
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("resourceschedule_reminderagentmgr_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":resourceschedule_js_assets",
":resourceschedule_js_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsResourcescheduleReminderAgentMgrTest"
subsystem_name = "notification"
part_name = "distributed_notification_service"
}
ohos_js_assets("resourceschedule_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("resourceschedule_js_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for resourceschedule js api Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "300000",
"shell-timeout": "300000",
"bundle-name": "ohos.acts.resourceschedule.reminderagentMgr.js.function",
"package-name": "ohos.acts.resourceschedule.reminderagentMgr.js.function"
},
"kits": [
{
"test-file-name": [
"ActsResourcescheduleReminderAgentMgrTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.acts.resourceschedule.reminderagentMgr.js.function",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.resourceschedule.reminderagentMgr.js.function",
"name": ".entry",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"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:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions": [
{
"name": "ohos.permission.PUBLISH_AGENT_REMINDER",
"reason": "SYSTEM_GRANT",
"usedScene": {
"ability": [
".FormAbility"
],
"when": "inuse"
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ 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 {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "鸿蒙"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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.
*/
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
/*
* 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'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"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.world');
}
}
/*
* 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 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 ReminderAgentManagerTest from './ReminderAgentManagerJs.test.js'
export default function testsuite() {
ReminderAgentManagerTest()
}
{
"string": [
{
"name": "app_name",
"value": "ResourcescheduleJSApiTest"
},
{
"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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册