提交 3c667879 编写于 作者: J jiyong_sd

modified FA-JS

Signed-off-by: Njiyong_sd <jiyong@huawei.com>
Change-Id: I0dbe1e549fdf907c2cf4cdd19cc0c1bcddddaf23
上级 2b52be99
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsJSHTTPTest") { ohos_js_hap_suite("ActsJSHTTPTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsJSHTTPTest") { ...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsJSHTTPTest") {
hap_name = "ActsJSHTTPTest" hap_name = "ActsJSHTTPTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Function test of sim manager interface", "description": "Function test of sim manager interface",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "900000", "test-timeout": "900000",
"package": "com.ohos.jshttp", "bundle-name": "com.ohos.jshttp",
"shell-timeout": "60000" "package-name": "com.ohos.jshttp",
"shell-timeout": "900000"
}, },
"kits": [ "kits": [
{ {
......
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.ohos.jshttp", "package": "com.ohos.jshttp",
"name": ".MyApplication", "name": ".entry",
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -26,7 +28,6 @@ ...@@ -26,7 +28,6 @@
}, },
"abilities": [ "abilities": [
{ {
"visible": true,
"skills": [ "skills": [
{ {
"entities": [ "entities": [
...@@ -37,11 +38,29 @@ ...@@ -37,11 +38,29 @@
] ]
} }
], ],
"name": "com.ohos.jshttp.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", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:TestAbility_desc",
"label": "$string:app_name", "label": "$string:TestAbility_label",
"type": "page", "type": "page",
"visible": true,
"launchType": "standard" "launchType": "standard"
} }
], ],
...@@ -101,7 +120,21 @@ ...@@ -101,7 +120,21 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
} }
]
} }
} }
\ No newline at end of file
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate () { onCreate () {
console.info('TestApplication onCreate'); console.info('TestApplication onCreate');
......
...@@ -17,7 +17,9 @@ import file from '@system.file'; ...@@ -17,7 +17,9 @@ import file from '@system.file';
import app from '@system.app'; import app from '@system.app';
import device from '@system.device'; import device from '@system.device';
import router from '@system.router'; import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
...@@ -31,19 +33,10 @@ export default { ...@@ -31,19 +33,10 @@ export default {
}, },
onShow () { onShow () {
console.info('onShow finish!'); console.info('onShow finish!');
const core = Core.getInstance(); var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
const expectExtend = new ExpectExtend({ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
'id': 'extend' console.info('start run testcase!!!')
}); Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
}, },
onReady () { 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.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
/*
* 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'] + '.MainAbility'
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,5 +12,8 @@ ...@@ -12,5 +12,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import Telephony_NETSTACK_HTTPTest from './NetworkManagerHttp.test.js'
require('./Http.wifi.test'); export default function testsuite() {
Telephony_NETSTACK_HTTPTest()
}
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
*/ */
import netHttp from '@ohos.net.http'; import netHttp from '@ohos.net.http';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function Telephony_NETSTACK_HTTPTest() {
describe('Telephony_NETSTACK_HTTPTest',function(){ describe('Telephony_NETSTACK_HTTPTest',function(){
...@@ -138,3 +139,4 @@ describe('Telephony_NETSTACK_HTTPTest',function(){ ...@@ -138,3 +139,4 @@ describe('Telephony_NETSTACK_HTTPTest',function(){
}) })
}); });
}); });
}
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "Sim Test - sim manager interface test" "value": "Sim Test - sim manager interface test"
},
{
"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
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNetworkNowifiTest") { ohos_js_hap_suite("ActsNetworkNowifiTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsNetworkNowifiTest") { ...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsNetworkNowifiTest") {
hap_name = "ActsNetworkNowifiTest" hap_name = "ActsNetworkNowifiTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Function test of sim manager interface", "description": "Function test of sim manager interface",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1800000", "test-timeout": "1800000",
"package": "com.ohos.network_nowifi", "bundle-name": "com.ohos.network_nowifi",
"shell-timeout": "60000" "package-name": "com.ohos.network_nowifi",
"shell-timeout": "1800000"
}, },
"kits": [ "kits": [
{ {
......
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
...@@ -30,12 +30,29 @@ ...@@ -30,12 +30,29 @@
] ]
} }
], ],
"visible": true, "orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility", "name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:MainAbility_desc", "description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label", "label": "$string:MainAbility_label",
"type": "page", "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" "launchType": "standard"
} }
], ],
...@@ -64,7 +81,21 @@ ...@@ -64,7 +81,21 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
} }
]
} }
} }
\ No newline at end of file
...@@ -17,7 +17,9 @@ import file from '@system.file'; ...@@ -17,7 +17,9 @@ import file from '@system.file';
import app from '@system.app'; import app from '@system.app';
import device from '@system.device'; import device from '@system.device';
import router from '@system.router'; import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
...@@ -31,19 +33,10 @@ export default { ...@@ -31,19 +33,10 @@ export default {
}, },
onShow () { onShow () {
console.info('onShow finish!'); console.info('onShow finish!');
const core = Core.getInstance(); var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
const expectExtend = new ExpectExtend({ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
'id': 'extend' console.info('start run testcase!!!')
}); Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
}, },
onReady () { 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.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
.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
/*
* 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'] + '.MainAbility'
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);
})
}
};
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
*/ */
import network from '@system.network'; import network from '@system.network';
import { describe, afterAll, it, expect, beforeAll, afterEach } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function Telephony_NetManager_NetWorkTest() {
describe("Telephony_NetManager_NetWorkTest", function () { describe("Telephony_NetManager_NetWorkTest", function () {
...@@ -116,3 +117,4 @@ describe("Telephony_NetManager_NetWorkTest", function () { ...@@ -116,3 +117,4 @@ describe("Telephony_NetManager_NetWorkTest", function () {
}); });
}); });
}
\ No newline at end of file
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import Telephony_NetManager_NetWorkTest from './Http.nowifi.test.js'
export default function testsuite() {
Telephony_NetManager_NetWorkTest()
}
require('./NetStackSocket.test');
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"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
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNetworkWifiTest") { ohos_js_hap_suite("ActsNetworkWifiTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsNetworkWifiTest") { ...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsNetworkWifiTest") {
hap_name = "ActsNetworkWifiTest" hap_name = "ActsNetworkWifiTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Function test of sim manager interface", "description": "Function test of sim manager interface",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "900000", "test-timeout": "900000",
"package": "com.ohos.network_wifi", "bundle-name": "com.ohos.network_wifi",
"shell-timeout": "60000" "package-name": "com.ohos.network_wifi",
"shell-timeout": "900000"
}, },
"kits": [ "kits": [
{ {
......
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
...@@ -30,12 +30,29 @@ ...@@ -30,12 +30,29 @@
] ]
} }
], ],
"visible": true, "orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility", "name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:MainAbility_desc", "description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label", "label": "$string:MainAbility_label",
"type": "page", "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" "launchType": "standard"
} }
], ],
...@@ -64,7 +81,21 @@ ...@@ -64,7 +81,21 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
} }
]
} }
} }
\ No newline at end of file
{
"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
...@@ -17,7 +17,9 @@ import file from '@system.file'; ...@@ -17,7 +17,9 @@ import file from '@system.file';
import app from '@system.app'; import app from '@system.app';
import device from '@system.device'; import device from '@system.device';
import router from '@system.router'; import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
...@@ -31,19 +33,10 @@ export default { ...@@ -31,19 +33,10 @@ export default {
}, },
onShow () { onShow () {
console.info('onShow finish!'); console.info('onShow finish!');
const core = Core.getInstance(); var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
const expectExtend = new ExpectExtend({ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
'id': 'extend' console.info('start run testcase!!!')
}); Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
}, },
onReady () { 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.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
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'] + '.MainAbility'
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);
})
}
};
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
*/ */
import network from '@system.network'; import network from '@system.network';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function Telephony_NetManager_NetWorkTest() {
describe("Telephony_NetManager_NetWorkTest", function () { describe("Telephony_NetManager_NetWorkTest", function () {
...@@ -116,3 +117,4 @@ describe("Telephony_NetManager_NetWorkTest", function () { ...@@ -116,3 +117,4 @@ describe("Telephony_NetManager_NetWorkTest", function () {
}); });
}) })
}
\ No newline at end of file
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import Telephony_NetManager_NetWorkTest from './Http.wifi.test.js'
export default function testsuite() {
Telephony_NetManager_NetWorkTest()
}
require('./NetworkManagerHttp.test');
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"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
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsSocketTest") { ohos_js_hap_suite("ActsSocketTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsSocketTest") { ...@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsSocketTest") {
hap_name = "ActsSocketTest" hap_name = "ActsSocketTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Function test of sim manager interface", "description": "Function test of sim manager interface",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1800000", "test-timeout": "1800000",
"package": "com.ohos.socket", "bundle-name": "com.ohos.socket",
"shell-timeout": "60000" "package-name": "com.ohos.socket",
"shell-timeout": "1800000"
}, },
"kits": [ "kits": [
{ {
......
{
"string": [
{
"name": "app_name",
"value": "Sim Test"
},
{
"name": "mainability_description",
"value": "Sim Test - sim manager interface test"
}
]
}
\ No newline at end of file
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.ohos.socket", "package": "com.ohos.socket",
"name": ".MyApplication", "name": ".entry",
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -26,7 +28,6 @@ ...@@ -26,7 +28,6 @@
}, },
"abilities": [ "abilities": [
{ {
"visible": true,
"skills": [ "skills": [
{ {
"entities": [ "entities": [
...@@ -37,11 +38,29 @@ ...@@ -37,11 +38,29 @@
] ]
} }
], ],
"name": "com.ohos.socket.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", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:TestAbility_desc",
"label": "$string:app_name", "label": "$string:TestAbility_label",
"type": "page", "type": "page",
"visible": true,
"launchType": "standard" "launchType": "standard"
} }
], ],
...@@ -101,7 +120,21 @@ ...@@ -101,7 +120,21 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
} }
]
} }
} }
\ No newline at end of file
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
...@@ -17,7 +17,9 @@ import file from '@system.file'; ...@@ -17,7 +17,9 @@ import file from '@system.file';
import app from '@system.app'; import app from '@system.app';
import device from '@system.device'; import device from '@system.device';
import router from '@system.router'; import router from '@system.router';
import {Core, ExpectExtend} from 'deccjsunit/index'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
...@@ -31,19 +33,10 @@ export default { ...@@ -31,19 +33,10 @@ export default {
}, },
onShow () { onShow () {
console.info('onShow finish!'); console.info('onShow finish!');
const core = Core.getInstance(); var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
const expectExtend = new ExpectExtend({ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
'id': 'extend' console.info('start run testcase!!!')
}); Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
core.addService('expect', expectExtend);
core.init();
const configService = core.getDefaultService('config');
this.timeout = 30000
configService.setConfig(this);
require('../../../test/List.test');
core.execute();
}, },
onReady () { 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.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
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'] + '.MainAbility'
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,5 +12,8 @@ ...@@ -12,5 +12,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import Telephony_NETSTACK_SocketTest from './NetStackSocket.test.js'
require('./Http.nowifi.test'); export default function testsuite() {
Telephony_NETSTACK_SocketTest()
}
\ No newline at end of file
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
*/ */
import netSocket from '@ohos.net.socket'; import netSocket from '@ohos.net.socket';
import { describe, afterAll, it, expect, beforeAll, afterEach } from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function Telephony_NETSTACK_SocketTest() {
describe('Telephony_NETSTACK_SocketTest', function () { describe('Telephony_NETSTACK_SocketTest', function () {
...@@ -548,3 +549,4 @@ describe('Telephony_NETSTACK_SocketTest', function () { ...@@ -548,3 +549,4 @@ describe('Telephony_NETSTACK_SocketTest', function () {
}); });
}); });
}
\ No newline at end of file
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "Sim Test - sim manager interface test" "value": "Sim Test - sim manager interface test"
},
{
"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
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsNetworkSearchTest") { ohos_js_hap_suite("ActsNetworkSearchTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -22,9 +22,11 @@ ohos_js_hap_suite("ActsNetworkSearchTest") { ...@@ -22,9 +22,11 @@ ohos_js_hap_suite("ActsNetworkSearchTest") {
hap_name = "ActsNetworkSearchTest" hap_name = "ActsNetworkSearchTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Configuration for NetworkSearch Tests", "description": "Configuration for NetworkSearch Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "2100000", "test-timeout": "2100000",
"package": "com.ohos.networksearch", "bundle-name": "com.ohos.networksearch",
"shell-timeout": "60000" "package-name": "com.ohos.networksearch",
"shell-timeout": "2100000"
}, },
"kits": [ "kits": [
{ {
......
{
"string": [
{
"name": "app_name",
"value": "NetworkSearchTest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.ohos.networksearch", "package": "com.ohos.networksearch",
"name": ".MyApplication", "name": ".entry",
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -37,12 +39,29 @@ ...@@ -37,12 +39,29 @@
] ]
} }
], ],
"name": "com.ohos.networksearch.MainAbility", "orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:MainAbility_desc",
"label": "$string:app_name", "label": "$string:MainAbility_label",
"type": "page", "type": "page",
"launchType": "standard" "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"
} }
], ],
"reqPermissions": [ "reqPermissions": [
...@@ -101,7 +120,21 @@ ...@@ -101,7 +120,21 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
} }
]
} }
} }
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
...@@ -17,7 +17,10 @@ import file from '@system.file' ...@@ -17,7 +17,10 @@ import file from '@system.file'
import app from '@system.app' import app from '@system.app'
import device from '@system.device' import device from '@system.device'
import router from '@system.router' import router from '@system.router'
import {Core, ExpectExtend} from 'deccjsunit/index' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default { export default {
...@@ -29,18 +32,10 @@ export default { ...@@ -29,18 +32,10 @@ export default {
}, },
onShow() { onShow() {
console.info('onShow finish!') console.info('onShow finish!')
const core = Core.getInstance() var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
const expectExtend = new ExpectExtend({ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
'id': 'extend' console.info('start run testcase!!!')
}) Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
this.timeout = 2000000
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
}, },
onReady() { 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.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册