提交 d960fb10 编写于 作者: G guduhanyan

20200924XTC00

Signed-off-by: Nguduhanyan <xuyanjun27@163.com>
上级 eaabbbea
......@@ -14,8 +14,16 @@
import("//build/ohos_var.gni")
group("miscservices") {
testonly = true
deps = [
"TimeTest_js:time_js_test",
"TimerTest_js:timer_js_test",
]
if (is_standard_system) {
deps = [ "TimeTest_js:time_js_test" ]
} else {
deps = [
"DownloadTest:download_hap",
"InputMethodTest:InputMethodTest_hap",
"pasteboard:testpasteboard_hap",
"screenlock:ScreenLockTest_hap",
"timer:testtimer_hap",
"wallpaper:wallpaperTest_hap",
]
}
}
......@@ -10,21 +10,27 @@
# 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")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("time_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
":time_js_assets",
":time_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "TimeJSApiTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("hjs_demo_js_assets") {
ohos_js_assets("time_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
ohos_resources("time_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
}
\ No newline at end of file
......@@ -2,9 +2,9 @@
"description": "Configuration for time js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "ohos.acts.miscservices.time",
"shell-timeout": "21600000"
"test-timeout": "60000",
"package": "ohos.acts.miscservices.timer",
"shell-timeout": "60000"
},
"kits": [
{
......
{
"app": {
"bundleName": "ohos.acts.miscservices.timer",
"vendor": "acts",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.miscservices.timer",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "ohos.acts.miscservices.timer.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* 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.
*/
import file from '@system.file'
import app from '@system.app'
//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test.js')
core.execute()
},
onReady() {
},
}
/*
* 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.
*/
require('./Time.test.js')
require('./SystemTimeJsunit.test.js')
require('./SystemTimerJsunit.test.js')
{
"string": [
{
"name": "app_name",
"value": "JstimeTest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.acts.miscservices.time",
"bundleName": "ohos.acts.miscservices.timer",
"vendor": "acts",
"version": {
"code": 1000000,
......@@ -13,7 +13,7 @@
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.miscservices.time",
"package": "ohos.acts.miscservices.timer",
"name": ".MyApplication",
"deviceType": [
"phone"
......@@ -25,6 +25,7 @@
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
......@@ -35,7 +36,7 @@
]
}
],
"name": "ohos.acts.miscservices.time.MainAbility",
"name": "ohos.acts.miscservices.timer.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
......
......@@ -13,4 +13,5 @@
* limitations under the License.
*/
require('./Time.test.js')
require('./SystemTimeJsunit.test.js')
\ 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.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import systemTime from '@ohos.systemTime'
describe('TimeTest', function() {
console.log('start################################start');
/**
* @tc.number SUB_systemTime_setTime_JS_API_0100
* @tc.name Test systemTime.setTime
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('systemTime_setTime_test1', 0, async function (done) {
console.log("SUB_systemTime_setTime_JS_API_0100 start")
systemTime.setTime(1526003846000)
.then(data =>{
console.log("setTime ===data " + data)
execpt(data).assertEqual(true)
}).catch(error => {
console.log("setTime ===error " + error)
console.log("setTime ===data " + data)
execpt(0).assertLarger(1)
});
console.log('SUB_systemTime_setTime_JS_API_0100 end');
done()
})
/**
* @tc.number SUB_systemTime_setTime_JS_API_0200
* @tc.name Test systemTime.setTime Invalid value
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('systemTime_setTime_test2', 0, async function (done) {
console.log("SUB_systemTime_setTime_JS_API_0200 start")
systemTime.setTime(-1)
.then(data => {
console.log("setTime ===data " + data)
}).catch(error => {
console.log("setTime ===error " + error)
execpt(0).assertLarger(1)
});
console.log('SUB_systemTime_setTime_JS_API_0200 end');
done()
})
/**
* @tc.number SUB_systemTime_setTime_JS_API_0300
* @tc.name Test systemTime.setTime3
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('systemTime_setTime_test3', 0, async function (done) {
console.log("SUB_systemTime_setTime_JS_API_0300 start")
systemTime.setTime(1597156246000, (error, data) => {
console.log("setTime ===data: " + data);
console.log("setTime ===error: " + error);
});
console.log('SUB_systemTime_setTime_JS_API_0300 end');
done()
})
/**
* @tc.number SUB_systemTime_setTime_JS_API_0400
* @tc.name Test systemTime.setTime4 Invalid value
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('systemTime_setTime_test4', 0, async function (done) {
console.log("SUB_systemTime_setTime_JS_API_0400 start")
systemTime.setTime(-1, (error, data) => {
console.log("setTime ===data: " + data);
console.log("setTime ===error: " + error);
}).catch(error=> {
expect(1).assertLarger(0)
})
console.log('SUB_systemTime_setTime_JS_API_0400 end');
done()
})
})
......@@ -10,21 +10,27 @@
# 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")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("timer_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
":time_js_assets",
":time_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "TimerJSApiTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("hjs_demo_js_assets") {
ohos_js_assets("time_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
ohos_resources("time_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
}
\ No newline at end of file
......@@ -2,14 +2,14 @@
"description": "Configuration for time js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "60000",
"package": "ohos.acts.miscservices.timer",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"TimerJSApiTest.hap"
"TimeJSApiTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
{
"app": {
"bundleName": "ohos.acts.miscservices.timer",
"vendor": "acts",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.miscservices.timer",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "ohos.acts.miscservices.timer.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* 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.
*/
import file from '@system.file'
import app from '@system.app'
//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
// const instrumentLog = new InstrumentLog({
// 'id': 'report'
// })
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
// core.addService('report', instrumentLog)
core.init()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test.js')
core.execute()
},
onReady() {
},
}
/*
* 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.
*/
require('./Time.test.js')
require('./SystemTimeJsunit.test.js')
require('./SystemTimerJsunit.test.js')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册