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

!4358 modified FS-JS PART9

Merge pull request !4358 from jiyong/local-20220716-0010
文件模式从 100755 更改为 100644
...@@ -23,7 +23,9 @@ ohos_js_hap_suite("usb_js_test") { ...@@ -23,7 +23,9 @@ ohos_js_hap_suite("usb_js_test") {
hap_name = "ActsUsbJSApiTest" hap_name = "ActsUsbJSApiTest"
} }
ohos_js_assets("usb_js_assets") { ohos_js_assets("usb_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("usb_js_resources") { ohos_resources("usb_js_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for usb js api Tests", "description": "Configuration for usb js api Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "160000", "test-timeout": "160000",
"package": "ohos.acts.usb.usb.function", "shell-timeout": "160000",
"shell-timeout": "60000" "bundle-name": "ohos.acts.usb.usb.function",
"package-name": "ohos.acts.usb.usb.function"
}, },
"kits": [ "kits": [
{ {
......
文件模式从 100755 更改为 100644
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "ohos.acts.usb.usb.function", "package": "ohos.acts.usb.usb.function",
"name": ".MyApplication", "name": ".entry",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
}, },
"abilities": [ "abilities": [
{ {
"visible": true,
"skills": [ "skills": [
{ {
"entities": [ "entities": [
...@@ -36,11 +35,29 @@ ...@@ -36,11 +35,29 @@
] ]
} }
], ],
"name": "ohos.acts.usb.usb.function.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"
} }
], ],
...@@ -54,7 +71,23 @@ ...@@ -54,7 +71,23 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
} }
] ],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
} }
} }
\ No newline at end of file
...@@ -12,9 +12,6 @@ ...@@ -12,9 +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.
*/ */
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')
...@@ -27,19 +24,6 @@ export default { ...@@ -27,19 +24,6 @@ export default {
}, },
onShow() { onShow() {
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
this.timeout = 5000
configService.setConfig(this)
require('../../test/ListUsb.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.
*/
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) 2021-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,20 +13,14 @@ ...@@ -13,20 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/* host test case */
require('./UsbCoreJsunit.test.js')
require('./UsbCoreJsunitEx.test.js')
require('./UsbDevicePipeJsunit.test.js')
require('./UsbDevicePipeJsunitEx.test.js')
/* device test case */
require('./UsbFunctionsJsunit.test.js')
require('./UsbFunctionsJsunitEx.test.js')
/* device and host test case */
require('./UsbPortJsunit.test.js')
require('./UsbPortJsunitEx.test.js')
// require('./UsbPortAndFunctionJsunit.test.js')
require('./UsbAutoJsunit.test.js')
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import UsbAutoJsunit from './UsbAutoJsunit.test.js'
import UsbPortAndFunctionsJsFunctionsTest from './UsbPortAndFunctionJsunit.test.js'
import UsbPortJsFunctionsTest from './UsbPortJsunit.test.js'
import UsbPortJsFunctionsTestEx from './UsbPortJsunitEx.test.js'
import UsbFunctionsJsFunctionsTestEx from './UsbFunctionsJsunitEx.test.js'
import UsbFunctionsJsFunctionsTest from './UsbFunctionsJsunit.test.js'
import UsbDevicePipeJsFunctionsTest from './UsbDevicePipeJsunit.test.js'
import UsbDevicePipeJsFunctionsTestEx from './UsbDevicePipeJsunitEx.test.js'
import UsbCoreJsFunctionsTest from './UsbCoreJsunit.test.js'
import UsbCoreJsFunctionsTestEx from './UsbCoreJsunitEx.test.js'
/* host test case */
export default function testsuite() {
UsbAutoJsunit()
UsbCoreJsFunctionsTest()
UsbCoreJsFunctionsTestEx()
UsbDevicePipeJsFunctionsTest()
UsbDevicePipeJsFunctionsTestEx()
UsbFunctionsJsFunctionsTest()
UsbFunctionsJsFunctionsTestEx()
//UsbPortAndFunctionsJsFunctionsTest()
UsbPortJsFunctionsTest()
UsbPortJsFunctionsTestEx()
}
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */ /* usb core functions test */
export default function UsbAutoJsunit() {
describe('UsbAutoJsunit', function () { describe('UsbAutoJsunit', function () {
beforeAll(function () { beforeAll(function () {
...@@ -363,3 +364,4 @@ describe('UsbAutoJsunit', function () { ...@@ -363,3 +364,4 @@ describe('UsbAutoJsunit', function () {
}) })
}) })
}
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */ /* usb core functions test */
export default function UsbCoreJsFunctionsTest() {
describe('UsbCoreJsFunctionsTest', function () { describe('UsbCoreJsFunctionsTest', function () {
var gDeviceList; var gDeviceList;
...@@ -425,3 +426,4 @@ describe('UsbCoreJsFunctionsTest', function () { ...@@ -425,3 +426,4 @@ describe('UsbCoreJsFunctionsTest', function () {
}) })
}) })
}
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */ /* usb core functions test */
export default function UsbCoreJsFunctionsTestEx() {
describe('UsbCoreJsFunctionsTestEx', function () { describe('UsbCoreJsFunctionsTestEx', function () {
var gDeviceList var gDeviceList
...@@ -702,3 +703,4 @@ describe('UsbCoreJsFunctionsTestEx', function () { ...@@ -702,3 +703,4 @@ describe('UsbCoreJsFunctionsTestEx', function () {
} }
}) })
}) })
}
...@@ -17,9 +17,10 @@ import usb from '@ohos.usb'; ...@@ -17,9 +17,10 @@ import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import EventConstants from './EventConstants.js'; import EventConstants from './EventConstants.js';
import parameter from '@ohos.systemparameter'; import parameter from '@ohos.systemparameter';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb device pipe test */ /* usb device pipe test */
export default function UsbDevicePipeJsFunctionsTest() {
describe('UsbDevicePipeJsFunctionsTest', function () { describe('UsbDevicePipeJsFunctionsTest', function () {
var gDeviceList var gDeviceList
...@@ -629,3 +630,4 @@ describe('UsbDevicePipeJsFunctionsTest', function () { ...@@ -629,3 +630,4 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}) })
}) })
}
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import EventConstants from './EventConstants.js'; import EventConstants from './EventConstants.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb device pipe test */ /* usb device pipe test */
export default function UsbDevicePipeJsFunctionsTestEx() {
describe('UsbDevicePipeJsFunctionsTestEx', function () { describe('UsbDevicePipeJsFunctionsTestEx', function () {
var gDeviceList var gDeviceList
...@@ -906,3 +907,4 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () { ...@@ -906,3 +907,4 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () {
}) })
}) })
}
...@@ -17,9 +17,10 @@ import usb from '@ohos.usb'; ...@@ -17,9 +17,10 @@ import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import EventConstants from './EventConstants.js'; import EventConstants from './EventConstants.js';
import parameter from '@ohos.systemparameter'; import parameter from '@ohos.systemparameter';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb device pipe test */ /* usb device pipe test */
export default function UsbDevicePipeJsFunctionsTest() {
describe('UsbDevicePipeJsFunctionsTest', function () { describe('UsbDevicePipeJsFunctionsTest', function () {
var gDeviceList var gDeviceList
var gPipe var gPipe
...@@ -565,3 +566,4 @@ describe('UsbDevicePipeJsFunctionsTest', function () { ...@@ -565,3 +566,4 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}) })
}) })
}
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */ /* usb core functions test */
export default function UsbFunctionsJsFunctionsTest() {
describe('UsbFunctionsJsFunctionsTest', function () { describe('UsbFunctionsJsFunctionsTest', function () {
beforeAll(function () { beforeAll(function () {
...@@ -96,3 +97,4 @@ describe('UsbFunctionsJsFunctionsTest', function () { ...@@ -96,3 +97,4 @@ describe('UsbFunctionsJsFunctionsTest', function () {
}) })
}) })
}
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
*/ */
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */ /* usb core functions test */
export default function UsbFunctionsJsFunctionsTestEx() {
describe('UsbFunctionsJsFunctionsTestEx', function () { describe('UsbFunctionsJsFunctionsTestEx', function () {
beforeAll(function () { beforeAll(function () {
...@@ -253,3 +254,4 @@ describe('UsbFunctionsJsFunctionsTestEx', function () { ...@@ -253,3 +254,4 @@ describe('UsbFunctionsJsFunctionsTestEx', function () {
}) })
}) })
}
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */ /* usb core functions test */
export default function UsbPortAndFunctionsJsFunctionsTest() {
describe('UsbPortAndFunctionsJsFunctionsTest', function () { describe('UsbPortAndFunctionsJsFunctionsTest', function () {
beforeAll(function () { beforeAll(function () {
...@@ -211,3 +212,4 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { ...@@ -211,3 +212,4 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () {
}) })
}) })
}
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */ /* usb core functions test */
export default function UsbPortJsFunctionsTest() {
describe('UsbPortJsFunctionsTest', function () { describe('UsbPortJsFunctionsTest', function () {
beforeAll(function () { beforeAll(function () {
...@@ -78,3 +79,4 @@ describe('UsbPortJsFunctionsTest', function () { ...@@ -78,3 +79,4 @@ describe('UsbPortJsFunctionsTest', function () {
}) })
}) })
}
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
import usb from '@ohos.usb'; import usb from '@ohos.usb';
import CheckEmptyUtils from './CheckEmptyUtils.js'; import CheckEmptyUtils from './CheckEmptyUtils.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/* usb core functions test */ /* usb core functions test */
export default function UsbPortJsFunctionsTestEx() {
describe('UsbPortJsFunctionsTestEx', function () { describe('UsbPortJsFunctionsTestEx', function () {
var gPort; var gPort;
...@@ -202,3 +203,4 @@ describe('UsbPortJsFunctionsTestEx', function () { ...@@ -202,3 +203,4 @@ describe('UsbPortJsFunctionsTestEx', function () {
}) })
}) })
}
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability" "value": "JS_Phone_Empty Feature Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
} }
] ]
} }
\ No newline at end of file
文件模式从 100755 更改为 100644
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册