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

!4481 Adapt to the new framework_part22

Merge pull request !4481 from jiyong/local-20220722-0001
...@@ -31,7 +31,9 @@ ohos_js_hap_suite("uri_js_test") { ...@@ -31,7 +31,9 @@ ohos_js_hap_suite("uri_js_test") {
# subsystem_name = "xts" # subsystem_name = "xts"
} }
ohos_js_assets("uri_js_assets") { ohos_js_assets("uri_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("uri_resources") { ohos_resources("uri_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for startup uri js api Tests", "description": "Configuration for startup uri js api Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "800000", "test-timeout": "800000",
"package": "com.example.uri", "bundle-name": "com.example.uri",
"shell-timeout": "90000" "package-name": "com.example.uri",
"shell-timeout": "800000"
}, },
"kits": [ "kits": [
{ {
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.uri", "package": "com.example.uri",
"name": ".MyApplication", "name": ".entry",
"mainAbility": "com.example.uri.MainAbility", "mainAbility": ".MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -37,12 +37,29 @@ ...@@ -37,12 +37,29 @@
] ]
} }
], ],
"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, "visible": true,
"name": "com.example.uri.MainAbility", "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:entry_MainAbility", "label": "$string:TestAbility_label",
"type": "page", "type": "page",
"visible": true,
"launchType": "standard" "launchType": "standard"
} }
], ],
...@@ -56,7 +73,22 @@ ...@@ -56,7 +73,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. * 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,35 +12,29 @@ ...@@ -12,35 +12,29 @@
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default { export default {
data: { data: {
title: "" title: ''
}, },
onInit() { onInit() {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
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 = 5000
configService.setConfig(this)
require('../../test/List.test')
core.execute()
}, },
onReady() { onReady() {
}, },
} }
/* /*
* 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
......
{
"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 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,5 +13,14 @@ ...@@ -13,5 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
require('./Vibrator_old.test.js') export default {
require('./Vibrator_new.test.js') 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 { UriTest } from './uri.test.js'
require('./uri.test.js') export default function testsuite() {
\ No newline at end of file UriTest()
}
...@@ -12,16 +12,18 @@ ...@@ -12,16 +12,18 @@
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import uri from '@ohos.uri' import uri from '@ohos.uri'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export function UriTest() {
describe('UriTest', function () { describe('UriTest', function () {
/** /**
* @tc.name: SUB_Runtime_JSAPI_001 * @tc.name: testUriConstruction001
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_001', 0, function () { it('testUriConstruction001', 0, function () {
try { try {
let that = new uri.URI('#http://username:password@host:8080/directory/file?foo=1&bar=2'); let that = new uri.URI('#http://username:password@host:8080/directory/file?foo=1&bar=2');
} catch (err) { } catch (err) {
...@@ -30,11 +32,11 @@ describe('UriTest', function () { ...@@ -30,11 +32,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_002 * @tc.name: testUriConstruction002
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_002', 0, function () { it('testUriConstruction002', 0, function () {
try { try {
let that = new uri.URI({name: 'gaogao'}); let that = new uri.URI({name: 'gaogao'});
} catch (err) { } catch (err) {
...@@ -43,11 +45,11 @@ describe('UriTest', function () { ...@@ -43,11 +45,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_003 * @tc.name: testUriConstruction003
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_003', 0, function () { it('testUriConstruction003', 0, function () {
try { try {
let that = new uri.URI('ht/tp://username:pas sword@host:8080/directory/file?foo=1&bar=2'); let that = new uri.URI('ht/tp://username:pas sword@host:8080/directory/file?foo=1&bar=2');
} catch (err) { } catch (err) {
...@@ -56,11 +58,11 @@ describe('UriTest', function () { ...@@ -56,11 +58,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_004 * @tc.name: testUriConstruction004
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_004', 0, function () { it('testUriConstruction004', 0, function () {
try { try {
let that = new uri.URI('http://username:password@[::]:8080/directory/file?Query#gaogao faofao'); let that = new uri.URI('http://username:password@[::]:8080/directory/file?Query#gaogao faofao');
} catch (err) { } catch (err) {
...@@ -69,11 +71,11 @@ describe('UriTest', function () { ...@@ -69,11 +71,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_005 * @tc.name: testUriConstruction005
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_005', 0, function () { it('testUriConstruction005', 0, function () {
try { try {
let that = new uri.URI('http://username:password@host:8080/directory/file?foo^=1&bar=2#gaogaofaofao'); let that = new uri.URI('http://username:password@host:8080/directory/file?foo^=1&bar=2#gaogaofaofao');
} catch (err) { } catch (err) {
...@@ -82,11 +84,11 @@ describe('UriTest', function () { ...@@ -82,11 +84,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_006 * @tc.name: testUriConstruction006
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_006', 0, function () { it('testUriConstruction006', 0, function () {
try { try {
let that = new uri.URI('1http://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new uri.URI('1http://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } catch (err) {
...@@ -95,11 +97,11 @@ describe('UriTest', function () { ...@@ -95,11 +97,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_007 * @tc.name: testUriConstruction007
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_007', 0, function () { it('testUriConstruction007', 0, function () {
try { try {
let that = new uri.URI('ht@tp://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new uri.URI('ht@tp://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } catch (err) {
...@@ -108,11 +110,11 @@ describe('UriTest', function () { ...@@ -108,11 +110,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_008 * @tc.name: testUriConstruction008
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_008', 0, function () { it('testUriConstruction008', 0, function () {
try { try {
let that = new uri.URI('http://username:password@[::]:80r80/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new uri.URI('http://username:password@[::]:80r80/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } catch (err) {
...@@ -121,11 +123,11 @@ describe('UriTest', function () { ...@@ -121,11 +123,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_009 * @tc.name: testUriConstruction009
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_009', 0, function () { it('testUriConstruction009', 0, function () {
try { try {
let that = new uri.URI('http://username:password@[::12:55:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new uri.URI('http://username:password@[::12:55:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } catch (err) {
...@@ -134,11 +136,11 @@ describe('UriTest', function () { ...@@ -134,11 +136,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_010 * @tc.name: testUriConstruction010
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_010', 0, function () { it('testUriConstruction010', 0, function () {
try { try {
let that = new uri.URI('http://username:pa^ssword@[::12:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new uri.URI('http://username:pa^ssword@[::12:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } catch (err) {
...@@ -147,11 +149,11 @@ describe('UriTest', function () { ...@@ -147,11 +149,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_011 * @tc.name: testUriConstruction011
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_011', 0, function () { it('testUriConstruction011', 0, function () {
try { try {
let that = new uri.URI('http://username:password@[::1你2:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao'); let that = new uri.URI('http://username:password@[::1你2:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao');
} catch (err) { } catch (err) {
...@@ -160,11 +162,11 @@ describe('UriTest', function () { ...@@ -160,11 +162,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_012 * @tc.name: testUriConstruction012
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_012', 0, function () { it('testUriConstruction012', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@www.baidu.com:99/path/path?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@www.baidu.com:99/path/path?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@www.baidu.com:99"); expect(gaogao.authority).assertEqual("gg:gaogao@www.baidu.com:99");
...@@ -178,11 +180,11 @@ describe('UriTest', function () { ...@@ -178,11 +180,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor013 * @tc.name: testUriConstruction013
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor013', 0, function () { it('testUriConstruction013', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1080::8:800:200C:417A]:99/path/66path1?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[1080::8:800:200C:417A]:99/path/66path1?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@[1080::8:800:200C:417A]:99"); expect(gaogao.authority).assertEqual("gg:gaogao@[1080::8:800:200C:417A]:99");
...@@ -196,11 +198,11 @@ describe('UriTest', function () { ...@@ -196,11 +198,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_014 * @tc.name: testUriConstruction014
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_014', 0, function () { it('testUriConstruction014', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[::]:88/path/path66?foooo#gaogao'); let gaogao = new uri.URI('http://gg:gaogao@[::]:88/path/path66?foooo#gaogao');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@[::]:88"); expect(gaogao.authority).assertEqual("gg:gaogao@[::]:88");
...@@ -214,11 +216,11 @@ describe('UriTest', function () { ...@@ -214,11 +216,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor015 * @tc.name: testUriConstruction015
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor015', 0, function () { it('testUriConstruction015', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66path1?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66path1?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@[1:0:0:1:2:1:2:1]:99"); expect(gaogao.authority).assertEqual("gg:gaogao@[1:0:0:1:2:1:2:1]:99");
...@@ -232,11 +234,11 @@ describe('UriTest', function () { ...@@ -232,11 +234,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_016 * @tc.name: testUriConstruction016
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_016', 0, function () { it('testUriConstruction016', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[::FFFF:129.144.52.38]:99/path/path?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[::FFFF:129.144.52.38]:99/path/path?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@[::FFFF:129.144.52.38]:99"); expect(gaogao.authority).assertEqual("gg:gaogao@[::FFFF:129.144.52.38]:99");
...@@ -250,11 +252,11 @@ describe('UriTest', function () { ...@@ -250,11 +252,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor017 * @tc.name: testUriConstruction017
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor017', 0, function () { it('testUriConstruction017', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[::192.9.5.5]:99/path/path?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[::192.9.5.5]:99/path/path?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@[::192.9.5.5]:99"); expect(gaogao.authority).assertEqual("gg:gaogao@[::192.9.5.5]:99");
...@@ -268,11 +270,11 @@ describe('UriTest', function () { ...@@ -268,11 +270,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor018 * @tc.name: testUriConstruction018
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor018', 0, function () { it('testUriConstruction018', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[22::22:2:2%ss]:99/path/path?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[22::22:2:2%ss]:99/path/path?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@[22::22:2:2%ss]:99"); expect(gaogao.authority).assertEqual("gg:gaogao@[22::22:2:2%ss]:99");
...@@ -286,11 +288,11 @@ describe('UriTest', function () { ...@@ -286,11 +288,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor019 * @tc.name: testUriConstruction019
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor019', 0, function () { it('testUriConstruction019', 0, function () {
let gaogao = let gaogao =
new uri.URI('http://gg:gaogao@[fe80:0000:0001:0000:0440:44ff:1233:5678]:99/path/path?query#fagment'); new uri.URI('http://gg:gaogao@[fe80:0000:0001:0000:0440:44ff:1233:5678]:99/path/path?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
...@@ -305,11 +307,11 @@ describe('UriTest', function () { ...@@ -305,11 +307,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor020 * @tc.name: testUriConstruction020
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor020', 0, function () { it('testUriConstruction020', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[fe80::0001:0000]:99/path/path?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[fe80::0001:0000]:99/path/path?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@[fe80::0001:0000]:99"); expect(gaogao.authority).assertEqual("gg:gaogao@[fe80::0001:0000]:99");
...@@ -323,11 +325,11 @@ describe('UriTest', function () { ...@@ -323,11 +325,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_021 * @tc.name: testUriConstruction021
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_021', 0, function () { it('testUriConstruction021', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@199.98.55.44:99/path/path?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@199.98.55.44:99/path/path?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("gg:gaogao@199.98.55.44:99"); expect(gaogao.authority).assertEqual("gg:gaogao@199.98.55.44:99");
...@@ -341,11 +343,11 @@ describe('UriTest', function () { ...@@ -341,11 +343,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_022 * @tc.name: testUriConstruction022
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_022', 0, function () { it('testUriConstruction022', 0, function () {
let gaogao = new uri.URI('http://16.9.5.4:99/path/path?query#fagment'); let gaogao = new uri.URI('http://16.9.5.4:99/path/path?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("16.9.5.4:99"); expect(gaogao.authority).assertEqual("16.9.5.4:99");
...@@ -359,11 +361,11 @@ describe('UriTest', function () { ...@@ -359,11 +361,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor023 * @tc.name: testUriConstruction023
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor023', 0, function () { it('testUriConstruction023', 0, function () {
let gaogao = new uri.URI('http://49.99.54.12:50/path/path23?query#fagment'); let gaogao = new uri.URI('http://49.99.54.12:50/path/path23?query#fagment');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("49.99.54.12:50"); expect(gaogao.authority).assertEqual("49.99.54.12:50");
...@@ -377,11 +379,11 @@ describe('UriTest', function () { ...@@ -377,11 +379,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_024 * @tc.name: testUriConstruction024
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_024', 0, function () { it('testUriConstruction024', 0, function () {
let gaogao = new uri.URI('http://user@49.10pe8.54.12:80/path/path23?query#qwer'); let gaogao = new uri.URI('http://user@49.10pe8.54.12:80/path/path23?query#qwer');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("user@49.10pe8.54.12:80"); expect(gaogao.authority).assertEqual("user@49.10pe8.54.12:80");
...@@ -395,11 +397,11 @@ describe('UriTest', function () { ...@@ -395,11 +397,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_025 * @tc.name: testUriConstruction025
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_025', 0, function () { it('testUriConstruction025', 0, function () {
let gaogao = new uri.URI('http://user@www.baidu.com/path/path23?query#qwer'); let gaogao = new uri.URI('http://user@www.baidu.com/path/path23?query#qwer');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("user@www.baidu.com"); expect(gaogao.authority).assertEqual("user@www.baidu.com");
...@@ -413,11 +415,11 @@ describe('UriTest', function () { ...@@ -413,11 +415,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_026 * @tc.name: testUriConstruction026
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_026', 0, function () { it('testUriConstruction026', 0, function () {
let gaogao = new uri.URI('http://user@www.hw.com:77/path/path23?query#qwer'); let gaogao = new uri.URI('http://user@www.hw.com:77/path/path23?query#qwer');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("user@www.hw.com:77"); expect(gaogao.authority).assertEqual("user@www.hw.com:77");
...@@ -431,11 +433,11 @@ describe('UriTest', function () { ...@@ -431,11 +433,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_027 * @tc.name: testUriConstruction027
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_027', 0, function () { it('testUriConstruction027', 0, function () {
let gaogao = new uri.URI('ht2tp://user@www.h12343w.com:77/path/path23?query#qwer'); let gaogao = new uri.URI('ht2tp://user@www.h12343w.com:77/path/path23?query#qwer');
expect(gaogao.scheme).assertEqual("ht2tp"); expect(gaogao.scheme).assertEqual("ht2tp");
expect(gaogao.authority).assertEqual("user@www.h12343w.com:77"); expect(gaogao.authority).assertEqual("user@www.h12343w.com:77");
...@@ -449,11 +451,11 @@ describe('UriTest', function () { ...@@ -449,11 +451,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor028 * @tc.name: testUriConstruction028
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor028', 0, function () { it('testUriConstruction028', 0, function () {
let gaogao = new uri.URI('ht2tp://user@www.1hw.1com:77/path/path23?query#qwer'); let gaogao = new uri.URI('ht2tp://user@www.1hw.1com:77/path/path23?query#qwer');
expect(gaogao.scheme).assertEqual("ht2tp"); expect(gaogao.scheme).assertEqual("ht2tp");
expect(gaogao.authority).assertEqual("user@www.1hw.1com:77"); expect(gaogao.authority).assertEqual("user@www.1hw.1com:77");
...@@ -467,11 +469,11 @@ describe('UriTest', function () { ...@@ -467,11 +469,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor029 * @tc.name: testUriConstruction029
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor029', 0, function () { it('testUriConstruction029', 0, function () {
let gaogao = new uri.URI('http://user@hosthost/path/path23?query#qwer'); let gaogao = new uri.URI('http://user@hosthost/path/path23?query#qwer');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("user@hosthost"); expect(gaogao.authority).assertEqual("user@hosthost");
...@@ -485,11 +487,11 @@ describe('UriTest', function () { ...@@ -485,11 +487,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor030 * @tc.name: testUriConstruction030
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor030', 0, function () { it('testUriConstruction030', 0, function () {
let gaogao = new uri.URI('http://user@[::]/path/path23?query#qwer'); let gaogao = new uri.URI('http://user@[::]/path/path23?query#qwer');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("user@[::]"); expect(gaogao.authority).assertEqual("user@[::]");
...@@ -503,11 +505,11 @@ describe('UriTest', function () { ...@@ -503,11 +505,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: testConstructor031 * @tc.name: testUriConstruction031
* @tc.desc: Constructs a URI by parsing the given string. * @tc.desc: Constructs a URI by parsing the given string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('testConstructor031', 0, function () { it('testUriConstruction031', 0, function () {
let gaogao = new uri.URI('http://[::192:0:5]/path/path23?query#qwer'); let gaogao = new uri.URI('http://[::192:0:5]/path/path23?query#qwer');
expect(gaogao.scheme).assertEqual("http"); expect(gaogao.scheme).assertEqual("http");
expect(gaogao.authority).assertEqual("[::192:0:5]"); expect(gaogao.authority).assertEqual("[::192:0:5]");
...@@ -533,11 +535,11 @@ describe('UriTest', function () { ...@@ -533,11 +535,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_002 * @tc.name: testEquals002
* @tc.desc: Tests this URI for equality with another object. * @tc.desc: Tests this URI for equality with another object.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_002', 0, function () { it('testEquals002', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment'); let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
let res = gaogao.equals(gaogao1); let res = gaogao.equals(gaogao1);
...@@ -545,11 +547,11 @@ describe('UriTest', function () { ...@@ -545,11 +547,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_003 * @tc.name: testEquals003
* @tc.desc: Tests this URI for equality with another object. * @tc.desc: Tests this URI for equality with another object.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_003', 0, function () { it('testEquals003', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment123'); let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment123');
let res = gaogao.equals(gaogao1); let res = gaogao.equals(gaogao1);
...@@ -581,11 +583,11 @@ describe('UriTest', function () { ...@@ -581,11 +583,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_001 * @tc.name: testNormalize001
* @tc.desc: Normalizes this URI's path. * @tc.desc: Normalizes this URI's path.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_001', 0, function () { it('testNormalize001', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66./../././mm/.././path1?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66./../././mm/.././path1?query#fagment');
let res = gaogao.normalize(); let res = gaogao.normalize();
expect(res.path).assertEqual("/path/path1"); expect(res.path).assertEqual("/path/path1");
...@@ -593,11 +595,11 @@ describe('UriTest', function () { ...@@ -593,11 +595,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_002 * @tc.name: testNormalize002
* @tc.desc: Normalizes this URI's path. * @tc.desc: Normalizes this URI's path.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_002', 0, function () { it('testNormalize002', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path?query#fagment');
let res = gaogao.normalize(); let res = gaogao.normalize();
expect(res.path).assertEqual("/../../path"); expect(res.path).assertEqual("/../../path");
...@@ -617,11 +619,11 @@ describe('UriTest', function () { ...@@ -617,11 +619,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_004 * @tc.name: testNormalize004
* @tc.desc: Normalizes this URI's path. * @tc.desc: Normalizes this URI's path.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_004', 0, function () { it('testNormalize004', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../path/.././../aa/bb/cc?query'); let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../path/.././../aa/bb/cc?query');
let res = gaogao.normalize(); let res = gaogao.normalize();
expect(res.path).assertEqual("/../../aa/bb/cc"); expect(res.path).assertEqual("/../../aa/bb/cc");
...@@ -629,11 +631,11 @@ describe('UriTest', function () { ...@@ -629,11 +631,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_005 * @tc.name: testNormalize005
* @tc.desc: Normalizes this URI's path. * @tc.desc: Normalizes this URI's path.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_005', 0, function () { it('testNormalize005', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/./path/./aa/bb/cc?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/./path/./aa/bb/cc?query#fagment');
let res = gaogao.normalize(); let res = gaogao.normalize();
expect(res.path).assertEqual("/path/aa/bb/cc"); expect(res.path).assertEqual("/path/aa/bb/cc");
...@@ -641,11 +643,11 @@ describe('UriTest', function () { ...@@ -641,11 +643,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_001 * @tc.name: testToString001
* @tc.desc: Returns the content of this URI as a US-ASCII string. * @tc.desc: Returns the content of this URI as a US-ASCII string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_001', 0, function () { it('testToString001', 0, function () {
let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment'); let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment');
let res = gaogao.toString(); let res = gaogao.toString();
expect(res).assertEqual('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment'); expect(res).assertEqual('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment');
...@@ -674,11 +676,11 @@ describe('UriTest', function () { ...@@ -674,11 +676,11 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_004 * @tc.name: testToString004
* @tc.desc: Returns the content of this URI as a US-ASCII string. * @tc.desc: Returns the content of this URI as a US-ASCII string.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_004', 0, function () { it('testToString004', 0, function () {
let gaogao = new uri.URI('http://gg:gao你好gao@199.98.55.44:99/path/p你好ath?qu你好ery#fag你好ment'); let gaogao = new uri.URI('http://gg:gao你好gao@199.98.55.44:99/path/p你好ath?qu你好ery#fag你好ment');
let res = gaogao.toString(); let res = gaogao.toString();
expect(res).assertEqual('http://gg:gao%E4%BD%A0%E5%A5%BDgao@199.98.55.44:99/path/' + expect(res).assertEqual('http://gg:gao%E4%BD%A0%E5%A5%BDgao@199.98.55.44:99/path/' +
...@@ -697,22 +699,22 @@ describe('UriTest', function () { ...@@ -697,22 +699,22 @@ describe('UriTest', function () {
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_001 * @tc.name: testCheckIsAbsolute001
* @tc.desc: Tells whether or not this URI is absolute. * @tc.desc: Tells whether or not this URI is absolute.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_001', 0, function () { it('testCheckIsAbsolute001', 0, function () {
let gaogao = new uri.URI('f/tp://username:password@www.baidu.com:88/path?query#fagment'); let gaogao = new uri.URI('f/tp://username:password@www.baidu.com:88/path?query#fagment');
let res = gaogao.checkIsAbsolute(); let res = gaogao.checkIsAbsolute();
expect(res).assertEqual(false); expect(res).assertEqual(false);
}) })
/** /**
* @tc.name: SUB_Runtime_JSAPI_002 * @tc.name: testCheckIsAbsolute002
* @tc.desc: Tells whether or not this URI is absolute. * @tc.desc: Tells whether or not this URI is absolute.
* @tc.author: zhaoduwei * @tc.author: zhaoduwei
*/ */
it('SUB_Runtime_JSAPI_002', 0, function () { it('testCheckIsAbsolute002', 0, function () {
let gaogao = new uri.URI('ftp://username:password@www.baidu.com:88/path?query#fagment'); let gaogao = new uri.URI('ftp://username:password@www.baidu.com:88/path?query#fagment');
let res = gaogao.checkIsAbsolute(); let res = gaogao.checkIsAbsolute();
expect(res).assertEqual(true); expect(res).assertEqual(true);
...@@ -751,3 +753,4 @@ describe('UriTest', function () { ...@@ -751,3 +753,4 @@ describe('UriTest', function () {
expect(res).assertEqual(true); expect(res).assertEqual(true);
}) })
}) })
}
\ 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"
} }
] ]
} }
\ No newline at end of file
...@@ -21,8 +21,6 @@ ohos_js_hap_suite("appdatamgr_js_test") { ...@@ -21,8 +21,6 @@ ohos_js_hap_suite("appdatamgr_js_test") {
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAppdatamagrJsTest" hap_name = "ActsAppdatamagrJsTest"
subsystem_name = "distributeddatamgr"
part_name = "relational_store"
} }
ohos_js_assets("appdatamgr_js_assets") { ohos_js_assets("appdatamgr_js_assets") {
js2abc = true js2abc = true
......
...@@ -12,24 +12,24 @@ ...@@ -12,24 +12,24 @@
* 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 dataAbilityPredicatesTest from './StorageHelperJsunit.test.js' import dataAbilityPredicatesTest from './DataAbilityPredicatesJsunit.test.js'
import rdbStoreBackupRestoreWithFAContextTest from './StoragePromiseJsunit.test.js' import rdbStoreBackupRestoreWithFAContextTest from './RdbstoreBackupRestoreWithFAContextJsunit.test.js'
import rdbstoreChangeEncryptKeyTest from './StorageCallBackJsunit.test.js' import rdbstoreChangeEncryptKeyTest from './RdbstoreChangeEncryptKeyJsunit.test.js'
import rdbStoreDataSharePredicatesTest from './StorageSyncJsunit.test.js' import rdbStoreDataSharePredicatesTest from './RdbStoreDataShareJsunit.test.js'
import rdbStoreDeleteTest from './RdbstoreInsertJsunit.test.js' import rdbStoreDeleteTest from './RdbstoreDeleteJsunit.test.js'
import rdbStoreDistributedTest from './RdbstoreDeleteJsunit.test.js' import rdbStoreDistributedTest from './RdbStoreDistributedJsunit.test.js'
import rdbstoreInsertTest from './RdbStoreResultSetJsunit.test.js' import rdbstoreInsertTest from './RdbstoreInsertJsunit.test.js'
import rdbStorePredicatesJoinTest from './RdbstorePredicatesJsunit.test.js' import rdbStorePredicatesJoinTest from './RdbstorePredicatesJoinJsunit.test.js'
import rdbPredicatesTest from './RdbstoreRdbstoreJsunit.test.js' import rdbPredicatesTest from './RdbstorePredicatesJsunit.test.js'
import rdbStoreTest from './RdbstoreStoreExcuteSqlJsunit.test.js' import rdbStoreTest from './RdbstoreRdbstoreJsunit.test.js'
import rdbResultSetTest from './RdbstoreUpdateJsunit.test.js' import rdbResultSetTest from './RdbStoreResultSetJsunit.test.js'
import rdbstoreStoreExcuteSqlTest from './DataAbilityPredicatesJsunit.test.js' import rdbstoreStoreExcuteSqlTest from './RdbstoreStoreExcuteSqlJsunit.test.js'
import rdbstoreTransactionTest from './RdbstoreTransactionJsunit.test.js' import rdbstoreTransactionTest from './RdbstoreTransactionJsunit.test.js'
import rdbStoreUpdateTest from './RdbstorePredicatesJoinJsunit.test.js' import rdbStoreUpdateTest from './RdbstoreUpdateJsunit.test.js'
import storageCallBackTest from './RdbStoreDistributedJsunit.test.js' import storageCallBackTest from './StorageCallBackJsunit.test.js'
import storageHelperTest from './RdbstoreChangeEncryptKeyJsunit.test.js' import storageHelperTest from './StorageHelperJsunit.test.js'
import storagePromiseTest from './RdbStoreDataShareJsunit.test.js' import storagePromiseTest from './StoragePromiseJsunit.test.js'
import storageSyncTest from './RdbstoreBackupRestoreWithFAContextJsunit.test.js' import storageSyncTest from './StorageSyncJsunit.test.js'
export default function testsuite() { export default function testsuite() {
dataAbilityPredicatesTest() dataAbilityPredicatesTest()
rdbStoreBackupRestoreWithFAContextTest() rdbStoreBackupRestoreWithFAContextTest()
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
const TAG = "[RDB_JSKITS_TEST]" const TAG = "[RDB_JSKITS_TEST]"
...@@ -23,7 +23,8 @@ const STORE_CONFIG = { ...@@ -23,7 +23,8 @@ const STORE_CONFIG = {
} }
var rdbStore = undefined; var rdbStore = undefined;
describe('rdbStoreInsertTest', function () { export default function rdbstoreStoreExcuteSqlTest() {
describe('rdbstoreStoreExcuteSqlTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
...@@ -362,4 +363,5 @@ describe('rdbStoreInsertTest', function () { ...@@ -362,4 +363,5 @@ describe('rdbStoreInsertTest', function () {
console.info(TAG + "*************Unit Test End*************"); console.info(TAG + "*************Unit Test End*************");
}) })
\ No newline at end of file }
...@@ -14,5 +14,5 @@ ...@@ -14,5 +14,5 @@
*/ */
import objectStoreTest from './ObjectStoreJsunit.test.js' import objectStoreTest from './ObjectStoreJsunit.test.js'
export default function testsuite() { export default function testsuite() {
objectStoreTest() objectStoreTest()
} }
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import distributedObject from '@ohos.data.distributedDataObject'; import distributedObject from '@ohos.data.distributedDataObject';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl' import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
...@@ -66,7 +66,7 @@ var tokenID = undefined; ...@@ -66,7 +66,7 @@ var tokenID = undefined;
const TIMEOUT = 2000; const TIMEOUT = 2000;
const PERMISSION_USER_SET = 1; const PERMISSION_USER_SET = 1;
const PERMISSION_USER_NAME = "ohos.permission.DISTRIBUTED_DATASYNC"; const PERMISSION_USER_NAME = "ohos.permission.DISTRIBUTED_DATASYNC";
export default function objectStoreTest() {
describe('objectStoreTest', function () { describe('objectStoreTest', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
console.info("====>beforeAll start===="); console.info("====>beforeAll start====");
...@@ -775,3 +775,4 @@ describe('objectStoreTest', function () { ...@@ -775,3 +775,4 @@ describe('objectStoreTest', function () {
}) })
console.info(TAG + "*************Unit Test End*************"); console.info(TAG + "*************Unit Test End*************");
}) })
}
\ No newline at end of file
...@@ -23,7 +23,9 @@ ohos_js_hap_suite("miscdevice_js_test") { ...@@ -23,7 +23,9 @@ ohos_js_hap_suite("miscdevice_js_test") {
hap_name = "ActsmiscdeviceJSApiTest" hap_name = "ActsmiscdeviceJSApiTest"
} }
ohos_js_assets("miscdevice_js_assets") { ohos_js_assets("miscdevice_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("miscdevice_js_resources") { ohos_resources("miscdevice_js_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for miscdevice js api Tests", "description": "Configuration for miscdevice js api Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "160000", "test-timeout": "160000",
"package": "ohos.acts.sensors.sensor.function", "shell-timeout": "160000",
"shell-timeout": "60000" "bundle-name": "ohos.acts.sensors.sensor.function",
"package-name": "ohos.acts.sensors.sensor.function"
}, },
"kits": [ "kits": [
{ {
......
文件模式从 100755 更改为 100644
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "ohos.acts.sensors.sensor.function", "package": "ohos.acts.sensors.sensor.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.sensors.sensor.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,6 +71,16 @@ ...@@ -54,6 +71,16 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
} }
], ],
"reqPermissions": [ "reqPermissions": [
...@@ -61,6 +88,12 @@ ...@@ -61,6 +88,12 @@
"name": "ohos.permission.VIBRATE", "name": "ohos.permission.VIBRATE",
"reason": "need use ohos.permission.VIBRATE" "reason": "need use ohos.permission.VIBRATE"
} }
] ],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
} }
} }
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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");
}
};
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2021 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,26 +13,20 @@ ...@@ -13,26 +13,20 @@
* limitations under the License. * limitations under the License.
*/ */
import app from '@system.app'
import device from '@system.device' const injectRef = Object.getPrototypeOf(global) || global
import router from '@system.router' injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
import {Core} from 'deccjsunit/index'
export default { export default {
data: { data: {
title: '' title: ""
}, },
onInit() { onInit() {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance()
core.init()
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('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
\ 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
<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);
})
}
};
/*
* 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 VibratorJsTest_misc_1 from './Vibrator_old.test.js'
import VibratorJsTest_misc_2 from './Vibrator_new.test.js'
export default function testsuite() {
VibratorJsTest_misc_1()
VibratorJsTest_misc_2()
}
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
*/ */
import vibrator from '@ohos.vibrator' import vibrator from '@ohos.vibrator'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function VibratorJsTest_misc_2() {
describe("VibratorJsTest_misc_2", function () { describe("VibratorJsTest_misc_2", function () {
beforeAll(function () { beforeAll(function () {
...@@ -54,7 +55,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -54,7 +55,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0010 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0010
*/ */
it("VibratorJsTest001", FUNCTION|MEDIUMTEST|LEVEL0, async function (done) { it("VibratorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest001 vibrator error'); console.info('VibratorJsTest001 vibrator error');
...@@ -75,7 +76,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -75,7 +76,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0020 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0020
*/ */
it("VibratorJsTest002", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest002 vibrator success'); console.info('VibratorJsTest002 vibrator success');
...@@ -96,7 +97,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -96,7 +97,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0030 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0030
*/ */
it("VibratorJsTest003", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest003 vibrator success'); console.info('VibratorJsTest003 vibrator success');
...@@ -117,7 +118,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -117,7 +118,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0040 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0040
*/ */
it("VibratorJsTest004", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest004 vibrator error'); console.info('VibratorJsTest004 vibrator error');
...@@ -138,7 +139,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -138,7 +139,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0050 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0050
*/ */
it("VibratorJsTest005", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest005 vibrator success'); console.info('VibratorJsTest005 vibrator success');
...@@ -159,7 +160,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -159,7 +160,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0060 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0060
*/ */
it("VibratorJsTest006", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest006 vibrator success'); console.info('VibratorJsTest006 vibrator success');
...@@ -180,7 +181,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -180,7 +181,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0070 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0070
*/ */
it("VibratorJsTest007", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest007 vibrator error'); console.info('VibratorJsTest007 vibrator error');
...@@ -201,7 +202,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -201,7 +202,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0080 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0080
*/ */
it("VibratorJsTest008", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest008 stop error'); console.info('VibratorJsTest008 stop error');
...@@ -222,7 +223,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -222,7 +223,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0090 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0090
*/ */
it("VibratorJsTest009", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------VibratorJsTest001---------------------------'); console.info('----------------------VibratorJsTest001---------------------------');
function stopPromise() { function stopPromise() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -275,7 +276,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -275,7 +276,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0100 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0100
*/ */
it("VibratorJsTest010", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function vibrateCallback(error) { function vibrateCallback(error) {
if (error) { if (error) {
console.info('VibratorJsTest010 stop success'); console.info('VibratorJsTest010 stop success');
...@@ -296,7 +297,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -296,7 +297,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0110 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0110
*/ */
it("VibratorJsTest011", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.vibrate(1000).then(() => { vibrator.vibrate(1000).then(() => {
console.log("VibratorJsTest011 vibrate success"); console.log("VibratorJsTest011 vibrate success");
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -317,7 +318,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -317,7 +318,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0120 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0120
*/ */
it("VibratorJsTest012", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.vibrate(-1).then(() => { vibrator.vibrate(-1).then(() => {
console.log("VibratorJsTest012 vibrate error"); console.log("VibratorJsTest012 vibrate error");
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -338,7 +339,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -338,7 +339,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0130 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0130
*/ */
it("VibratorJsTest013", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.vibrate(1800000 + 1).then(() => { vibrator.vibrate(1800000 + 1).then(() => {
console.log("VibratorJsTest013 vibrate error"); console.log("VibratorJsTest013 vibrate error");
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -359,7 +360,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -359,7 +360,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0140 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0140
*/ */
it("VibratorJsTest014", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(() => { vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(() => {
console.log("VibratorJsTest014 vibrate success"); console.log("VibratorJsTest014 vibrate success");
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -380,7 +381,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -380,7 +381,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150
*/ */
it("VibratorJsTest015", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.vibrate("").then(() => { vibrator.vibrate("").then(() => {
console.log("VibratorJsTest015 vibrate error"); console.log("VibratorJsTest015 vibrate error");
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -401,7 +402,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -401,7 +402,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0160 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0160
*/ */
it("VibratorJsTest016", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.stop("").then(() => { vibrator.stop("").then(() => {
console.log("VibratorJsTest016 stop error"); console.log("VibratorJsTest016 stop error");
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -422,7 +423,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -422,7 +423,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170
*/ */
it("VibratorJsTest017", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
vibrator.stop("preset").then(() => { vibrator.stop("preset").then(() => {
console.log("VibratorJsTest017 off success"); console.log("VibratorJsTest017 off success");
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -443,7 +444,7 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -443,7 +444,7 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0180 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0180
*/ */
it("VibratorJsTest018", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("VibratorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function stopPromise() { function stopPromise() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME).then(() => { vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME).then(() => {
...@@ -486,3 +487,4 @@ describe("VibratorJsTest_misc_2", function () { ...@@ -486,3 +487,4 @@ describe("VibratorJsTest_misc_2", function () {
done(); done();
}) })
}) })
}
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
*/ */
import vibrator from '@system.vibrator'; import vibrator from '@system.vibrator';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
export default function VibratorJsTest_misc_1() {
describe("VibratorJsTest_misc_1", function () { describe("VibratorJsTest_misc_1", function () {
beforeAll(function () { beforeAll(function () {
...@@ -59,7 +60,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -59,7 +60,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0190 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0190
*/ */
it("SubVibratorJsTest0001", FUNCTION|MEDIUMTEST|LEVEL0, async function (done) { it("SubVibratorJsTest0001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------SubVibratorJsTest0001---------------------------'); console.info('----------------------SubVibratorJsTest0001---------------------------');
vibrator.vibrate({ vibrator.vibrate({
mode: 'long', mode: 'long',
...@@ -82,7 +83,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -82,7 +83,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0200 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0200
*/ */
it("SubVibratorJsTest0002", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0002---------------------------'); console.info('----------------------SubVibratorJsTest0002---------------------------');
vibrator.vibrate({ vibrator.vibrate({
mode: 'short', mode: 'short',
...@@ -105,7 +106,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -105,7 +106,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0210 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0210
*/ */
it("SubVibratorJsTest0003", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0003---------------------------'); console.info('----------------------SubVibratorJsTest0003---------------------------');
vibrator.vibrate({ vibrator.vibrate({
mode: 'short', mode: 'short',
...@@ -125,7 +126,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -125,7 +126,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0220 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0220
*/ */
it("SubVibratorJsTest0004", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0004---------------------------'); console.info('----------------------SubVibratorJsTest0004---------------------------');
vibrator.vibrate({ vibrator.vibrate({
mode: 'short', mode: 'short',
...@@ -141,7 +142,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -141,7 +142,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0230 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0230
*/ */
it("SubVibratorJsTest0005", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0005---------------------------'); console.info('----------------------SubVibratorJsTest0005---------------------------');
vibrator.vibrate({ vibrator.vibrate({
success: function () { success: function () {
...@@ -160,7 +161,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -160,7 +161,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0240 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0240
*/ */
it("SubVibratorJsTest0006", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0006---------------------------'); console.info('----------------------SubVibratorJsTest0006---------------------------');
vibrator.vibrate({ vibrator.vibrate({
mode: 'long', mode: 'long',
...@@ -181,7 +182,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -181,7 +182,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0250 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0250
*/ */
it("SubVibratorJsTest0007", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0007---------------------------'); console.info('----------------------SubVibratorJsTest0007---------------------------');
try { try {
vibrator.vibrate({ vibrator.vibrate({
...@@ -205,7 +206,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -205,7 +206,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0260 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0260
*/ */
it("SubVibratorJsTest0008", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0008---------------------------'); console.info('----------------------SubVibratorJsTest0008---------------------------');
vibrator.vibrate({ vibrator.vibrate({
mode: 'short', mode: 'short',
...@@ -237,7 +238,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -237,7 +238,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0270 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0270
*/ */
it("SubVibratorJsTest0009", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0009---------------------------'); console.info('----------------------SubVibratorJsTest0009---------------------------');
try { try {
vibrator.vibrate(); vibrator.vibrate();
...@@ -254,7 +255,7 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -254,7 +255,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0280 * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0280
*/ */
it("SubVibratorJsTest0010", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) { it("SubVibratorJsTest0010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0010---------------------------'); console.info('----------------------SubVibratorJsTest0010---------------------------');
try { try {
vibrator.vibrate({ vibrator.vibrate({
...@@ -275,4 +276,4 @@ describe("VibratorJsTest_misc_1", function () { ...@@ -275,4 +276,4 @@ describe("VibratorJsTest_misc_1", function () {
}) })
}) })
}
\ No newline at end of file
...@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册