提交 61fdb819 编写于 作者: J jiyong_sd

modified FA-JS

Signed-off-by: Njiyong_sd <jiyong@huawei.com>
Change-Id: I526bfe2fe40ebd23472c1c7a6127a7e3bde87150
上级 1c217309
...@@ -23,7 +23,9 @@ ohos_js_hap_suite("ActsAceStandardVideoTest") { ...@@ -23,7 +23,9 @@ ohos_js_hap_suite("ActsAceStandardVideoTest") {
hap_name = "ActsAceStandardVideoTest" hap_name = "ActsAceStandardVideoTest"
} }
ohos_js_assets("ace_js_assets") { ohos_js_assets("ace_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("ace_resources") { ohos_resources("ace_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for acevideo Tests", "description": "Configuration for acevideo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1000000", "test-timeout": "1000000",
"package": "com.example.acevideo", "shell-timeout": "1000000",
"shell-timeout": "30000" "bundle-name": "com.example.acevideo",
"package-name": "com.example.acevideo"
}, },
"kits": [ "kits": [
{ {
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.acevideo", "package": "com.example.acevideo",
"name": ".MyApplication", "name": ".entry",
"mainAbility": "com.example.acevideo.MainAbility", "mainAbility": ".MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -37,14 +37,30 @@ ...@@ -37,14 +37,30 @@
] ]
} }
], ],
"name": "com.example.acevideo.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:entry_MainAbility", "label": "$string:MainAbility_label",
"type": "page", "type": "page",
"launchType": "standard",
"visible": true, "visible": true,
"configChanges": ["orientation"] "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": [ "js": [
...@@ -60,7 +76,22 @@ ...@@ -60,7 +76,22 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": true "autoDesignWidth": true
} }
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
} }
] }
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"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.
*/
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");
}
};
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
...@@ -25,14 +24,6 @@ export default { ...@@ -25,14 +24,6 @@ export default {
onInit() { onInit() {
console.info('[test page log] index onInit') console.info('[test page log] index onInit')
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
require('../../test/List.test')
core.execute()
}, },
onShow() { onShow() {
console.info('[test page log] index onShow') console.info('[test page log] index onShow')
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -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('AceApplication onCreate'); console.info('AceApplication onCreate');
......
{
"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. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,6 +13,14 @@ ...@@ -13,6 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
require('./basicabilityapi.test.js') export default {
require('./mediaquery.test.js') data: {
require('./commonComponentJsApi.test.js') 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);
})
}
};
/*
* 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 basicabilityapi from './basicabilityapi.test.js'
import mediaquery_vioTest from './mediaquery.test.js'
import aceJsTest from './commonComponentJsApi.test.js'
export default function testsuite() {
basicabilityapi()
mediaquery_vioTest()
aceJsTest()
}
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
import configuration from '@system.configuration'; import configuration from '@system.configuration';
import prompt from '@system.prompt'; import prompt from '@system.prompt';
import router from '@system.router'; import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium';
export default function basicabilityapi() {
describe('basicabilityapi', function () { describe('basicabilityapi', function () {
let testResult; let testResult;
let testResultFail; let testResultFail;
...@@ -476,3 +477,4 @@ describe('basicabilityapi', function () { ...@@ -476,3 +477,4 @@ describe('basicabilityapi', function () {
}, 1000); }, 1000);
}); });
}); });
}
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
*/ */
import router from '@system.router'; import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium';
export default function aceJsTest() {
describe('aceJsTest', function () { describe('aceJsTest', function () {
async function sleep(time) { async function sleep(time) {
...@@ -80,3 +81,4 @@ describe('aceJsTest', function () { ...@@ -80,3 +81,4 @@ describe('aceJsTest', function () {
done(); done();
}); });
}); });
}
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
* limitations under the License. * limitations under the License.
*/ */
import {describe,beforeAll,beforeEach,afterEach,afterAll,it,expect}from 'deccjsunit/index' import {describe,beforeAll,beforeEach,afterEach,afterAll,it,expect}from '@ohos/hypium'
import mediaquery from '@system.mediaquery'; import mediaquery from '@system.mediaquery';
describe('mediaquery', function() { export default function mediaquery_vioTest() {
describe('mediaquery_vioTest', function() {
let testResult; let testResult;
let test; let test;
beforeAll(function() { beforeAll(function() {
...@@ -269,4 +270,4 @@ describe('mediaquery', function() { ...@@ -269,4 +270,4 @@ describe('mediaquery', function() {
mMediaQueryList.addListener(logicOrMatch) mMediaQueryList.addListener(logicOrMatch)
console.info('MediaQuery logic>= end') console.info('MediaQuery logic>= end')
}) })
}); });}
\ No newline at end of file
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Empty Ability" "value": "JS_Empty Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
} }
] ]
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册