diff --git a/storage/storagefileioerrorjstest/BUILD.gn b/storage/storagefileioerrorjstest/BUILD.gn
index eede7742fafd9aa82d46e19c2ed6c39baf9454f0..9e354b7a100926d041f3bbf3b23e0e5a510890ad 100644
--- a/storage/storagefileioerrorjstest/BUILD.gn
+++ b/storage/storagefileioerrorjstest/BUILD.gn
@@ -9,7 +9,7 @@
# 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.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
@@ -23,7 +23,9 @@ ohos_js_hap_suite("storagefileioerror_js_test") {
hap_name = "ActsStorageFileIoErrorJsTest"
}
ohos_js_assets("storagefileioerror_js_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("storagefileioerror_js_resources") {
sources = [ "./src/main/resources" ]
diff --git a/storage/storagefileioerrorjstest/Test.json b/storage/storagefileioerrorjstest/Test.json
index da66d751713a731d6598091ca7b86f613c0a0410..e51d814fdfdad6ee7f407f12b23fb0c48c0dfb1e 100644
--- a/storage/storagefileioerrorjstest/Test.json
+++ b/storage/storagefileioerrorjstest/Test.json
@@ -1,18 +1,19 @@
-{
- "description": "Configuration for storage fileio Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "60000",
- "package": "ohos.acts.storage.fileioerror",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsStorageFileIoErrorJsTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
+{
+ "description": "Configuration for storage fileio Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "60000",
+ "shell-timeout": "60000",
+ "bundle-name": "ohos.acts.storage.fileioerror",
+ "package-name": "ohos.acts.storage.fileioerror"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsStorageFileIoErrorJsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
}
\ No newline at end of file
diff --git a/storage/storagefileioerrorjstest/src/main/config.json b/storage/storagefileioerrorjstest/src/main/config.json
index c4441ce4b24a847bd9985eae9dd1cf5e9cfa3b80..db6a5c04e54641ca30d3f80192c3b0a4156599a9 100644
--- a/storage/storagefileioerrorjstest/src/main/config.json
+++ b/storage/storagefileioerrorjstest/src/main/config.json
@@ -1,61 +1,94 @@
-{
- "app": {
- "bundleName": "ohos.acts.storage.fileioerror",
- "vendor": "example",
- "version": {
- "code": 1000000,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "ohos.acts.storage.fileioerror",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": true
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "ohos.acts.storage.fileioerror.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard",
- "visible": true
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ]
- }
+{
+ "app": {
+ "bundleName": "ohos.acts.storage.fileioerror",
+ "vendor": "example",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.storage.fileioerror",
+ "name": ".entry",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": true
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "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
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/app.js b/storage/storagefileioerrorjstest/src/main/js/MainAbility/app.js
similarity index 100%
rename from storage/storagefileioerrorjstest/src/main/js/default/app.js
rename to storage/storagefileioerrorjstest/src/main/js/MainAbility/app.js
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/i18n/en-US.json b/storage/storagefileioerrorjstest/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from storage/storagefileioerrorjstest/src/main/js/default/i18n/en-US.json
rename to storage/storagefileioerrorjstest/src/main/js/MainAbility/i18n/en-US.json
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefileioerrorjstest/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from storage/storagefileioerrorjstest/src/main/js/default/i18n/zh-CN.json
rename to storage/storagefileioerrorjstest/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/pages/index/index.css b/storage/storagefileioerrorjstest/src/main/js/MainAbility/pages/index/index.css
similarity index 100%
rename from storage/storagefileioerrorjstest/src/main/js/default/pages/index/index.css
rename to storage/storagefileioerrorjstest/src/main/js/MainAbility/pages/index/index.css
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/pages/index/index.hml b/storage/storagefileioerrorjstest/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from storage/storagefileioerrorjstest/src/main/js/default/pages/index/index.hml
rename to storage/storagefileioerrorjstest/src/main/js/MainAbility/pages/index/index.hml
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/pages/index/index.js b/storage/storagefileioerrorjstest/src/main/js/MainAbility/pages/index/index.js
similarity index 79%
rename from storage/storagefileioerrorjstest/src/main/js/default/pages/index/index.js
rename to storage/storagefileioerrorjstest/src/main/js/MainAbility/pages/index/index.js
index 9ff705964d87e8aee2dcfb12d7ab228db1ef1239..4df0bbc73cf1a507dd28af650ba2c5d76ace16e3 100644
--- a/storage/storagefileioerrorjstest/src/main/js/default/pages/index/index.js
+++ b/storage/storagefileioerrorjstest/src/main/js/MainAbility/pages/index/index.js
@@ -1,41 +1,34 @@
-/*
- * 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 app from '@system.app'
-
-import {Core} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow finish')
- const core = Core.getInstance()
- core.init()
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- require('../../test/List.test')
- core.execute()
- },
- onReady() {
- },
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import app from '@system.app'
+
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
}
\ No newline at end of file
diff --git a/storage/storagefileioerrorjstest/src/main/js/TestAbility/app.js b/storage/storagefileioerrorjstest/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/storage/storagefileioerrorjstest/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/storage/storagefileioerrorjstest/src/main/js/TestAbility/i18n/en-US.json b/storage/storagefileioerrorjstest/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/storage/storagefileioerrorjstest/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/storage/storagefileioerrorjstest/src/main/js/TestAbility/i18n/zh-CN.json b/storage/storagefileioerrorjstest/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/storage/storagefileioerrorjstest/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.css b/storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.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
diff --git a/storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.hml b/storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/ListTest.js b/storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.js
similarity index 79%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/ListTest.js
rename to storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.js
index e8d02e1111ccebe6cb609e10b0ac4c7ae1658c62..88b083a7f6b979019d6a2c5ad20b19c5fd43286b 100644
--- a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/ListTest.js
+++ b/storage/storagefileioerrorjstest/src/main/js/TestAbility/pages/index/index.js
@@ -1,17 +1,26 @@
-/*
- * 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.
- */
-
-require('./execute.js')
-require('./enumTest.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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/storage/storagefileioerrorjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/storage/storagefileioerrorjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/storage/storagefileioerrorjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/test/Common.js b/storage/storagefileioerrorjstest/src/main/js/test/Common.js
similarity index 96%
rename from storage/storagefileioerrorjstest/src/main/js/default/test/Common.js
rename to storage/storagefileioerrorjstest/src/main/js/test/Common.js
index 701a451215eeec18edaf454ce998f52cd026c1d2..d8b4fe782fc1f50cfcaa0e47f484f58dd4ef9df5 100644
--- a/storage/storagefileioerrorjstest/src/main/js/default/test/Common.js
+++ b/storage/storagefileioerrorjstest/src/main/js/test/Common.js
@@ -1,55 +1,55 @@
-/*
- * 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 fileio from '@ohos.fileio'
-import featureAbility from '@ohos.ability.featureAbility';
-
-export const FILE_CONTENT = 'hello world'
-
-export function prepareFile(fpath, content) {
- try {
- let fd = fileio.openSync(fpath, 0o102, 0o666)
- fileio.ftruncateSync(fd)
- fileio.writeSync(fd, content)
- fileio.fsyncSync(fd)
- fileio.closeSync(fd)
- return true
- }
- catch (e) {
- console.log('Failed to prepareFile for ' + e)
- return false
- }
-}
-
-export async function nextFileName(testName) {
- let context = featureAbility.getContext();
- let data = await context.getCacheDir();
- let BASE_PATH = data + '/';
- return BASE_PATH + testName
-}
-export async function fileName(testName) {
- let context = featureAbility.getContext();
- let data = await context.getFilesDir();
- let BASE_PATH = data + '/';
- return BASE_PATH + testName
-}
-
-export function isIntNum(val) {
- return typeof val === 'number' && val % 1 === 0;
-}
-
-export function isInclude(error, message) {
- return error.toString().indexOf(message) != -1;
+/*
+ * 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 fileio from '@ohos.fileio'
+import featureAbility from '@ohos.ability.featureAbility';
+
+export const FILE_CONTENT = 'hello world'
+
+export function prepareFile(fpath, content) {
+ try {
+ let fd = fileio.openSync(fpath, 0o102, 0o666)
+ fileio.ftruncateSync(fd)
+ fileio.writeSync(fd, content)
+ fileio.fsyncSync(fd)
+ fileio.closeSync(fd)
+ return true
+ }
+ catch (e) {
+ console.log('Failed to prepareFile for ' + e)
+ return false
+ }
+}
+
+export async function nextFileName(testName) {
+ let context = featureAbility.getContext();
+ let data = await context.getCacheDir();
+ let BASE_PATH = data + '/';
+ return BASE_PATH + testName
+}
+export async function fileName(testName) {
+ let context = featureAbility.getContext();
+ let data = await context.getFilesDir();
+ let BASE_PATH = data + '/';
+ return BASE_PATH + testName
+}
+
+export function isIntNum(val) {
+ return typeof val === 'number' && val % 1 === 0;
+}
+
+export function isInclude(error, message) {
+ return error.toString().indexOf(message) != -1;
}
\ No newline at end of file
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js b/storage/storagefileioerrorjstest/src/main/js/test/FileIOError.test.js
similarity index 95%
rename from storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js
rename to storage/storagefileioerrorjstest/src/main/js/test/FileIOError.test.js
index cbc7162de9ae4a31f4ea78f236520652183ec01e..92ceba29d8bf597cf4e885c831e867ba81e1a9b7 100644
--- a/storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js
+++ b/storage/storagefileioerrorjstest/src/main/js/test/FileIOError.test.js
@@ -1,159 +1,161 @@
-/*
- * 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 fileio from '@ohos.fileio'
-import {
- describe,
- it,
- expect
-}
-from 'deccjsunit/index'
-import {
- FILE_CONTENT,
- prepareFile,
- fileName,
- nextFileName,
- isIntNum,
- isInclude
-}
-from './Common'
-
-describe('FileIOError', function () {
-
- /**
- * @tc.number SUB_STORAGE_FileIo_test_error_0000
- * @tc.name fileio_test_error_000
- * @tc.desc Function of API, Delete directories with files
- */
- it('fileio_test_error_000', 0, async function (done) {
- let dpath = await fileName('fileio_test_error_000d');
- let fpath = dpath + '/fileio_test_error_000f';
- fileio.mkdirSync(dpath);
- expect(prepareFile(fpath, 'hello')).assertTrue();
- try {
- let fd = fileio.openSync(dpath);
- expect(isIntNum(fd)).assertTrue();
- fileio.rmdirSync(dpath);
- }
- catch (err) {
- console.info('fileio_test_error_000 has failed for ' + err);
- expect(isInclude(err.message, 'Directory not empty')).assertTrue();
- fileio.unlinkSync(fpath);
- fileio.rmdirSync(dpath);
- done();
- }
- });
-
- /**
- * @tc.number SUB_STORAGE_FileIo_test_error_0100
- * @tc.name fileio_test_error_001
- * @tc.desc Function of API, delete file
- */
- it('fileio_test_error_001', 0, async function (done) {
- let fpath = await fileName('fileio_test_error_001f');
- expect(prepareFile(fpath, 'hello')).assertTrue();
- try {
- let fd = fileio.openSync(fpath);
- expect(isIntNum(fd)).assertTrue();
- fileio.rmdirSync(fpath);
- }
- catch (err) {
- console.info('fileio_test_error_001 has failed for ' + err);
- expect(isInclude(err.message, 'Not a directory')).assertTrue();
- fileio.unlinkSync(fpath);
- done();
- }
- });
-
- /**
- * @tc.number SUB_STORAGE_FileIo_test_error_0200
- * @tc.name fileio_test_error_002
- * @tc.desc Function of API, flags=0o100. missing mode parameter.
- */
- it('fileio_test_error_002', 0, async function (done) {
- let fpath = await nextFileName('fileio_test_error_002');
- expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
- try {
- fileio.openSync(fpath, 0o100);
- }
- catch (err) {
- console.info('fileio_test_error_002 has failed for ' + err);
- expect(isInclude(err.message, 'called with O_CREAT/O_TMPFILE but no mode')).assertTrue();
- fileio.unlinkSync(fpath);
- done();
- }
- });
-
- /**
- * @tc.number SUB_STORAGE_FileIO_OpenSync_0300
- * @tc.name fileio_test_error_003
- * @tc.desc Function of API, flags=0o302. The test file is exist.
- */
- it('fileio_test_error_003', 0, async function (done) {
- let fpath = await nextFileName('fileio_test_error_003');
- expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
- try {
- fileio.openSync(fpath, 0o302, 0o666);
- }
- catch (err) {
- console.info('fileio_test_error_003 has failed for ' + err);
- expect(isInclude(err.message, 'File exists')).assertTrue();
- fileio.unlinkSync(fpath);
- done();
- }
- });
-
- /**
- * @tc.number SUB_STORAGE_FileIO_OpenSync_0400
- * @tc.name fileio_test_error_004
- * @tc.desc Function of API, flags=0o400000. Symbolic link loop.
- */
- it('fileio_test_error_004', 0, async function (done) {
- let fpath = await nextFileName('fileio_test_error_004');
- let ffpath = fpath + 'aaaa';
- expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
- try {
- fileio.symlinkSync(fpath, ffpath);
- fileio.openSync(ffpath, 0o400000);
- }
- catch (err) {
- console.info('fileio_test_error_004 has failed for ' + err);
- expect(isInclude(err.message, 'Symbolic link loop') ||
- isInclude(err.message, 'Too many symbolic links encountered')).assertTrue();
- fileio.unlinkSync(fpath);
- fileio.unlinkSync(ffpath);
- done();
- }
- });
-
- /**
- * @tc.number SUB_STORAGE_FileIO_OpenSync_0500
- * @tc.name fileio_test_error_005
- * @tc.desc Function of API, flags=0o200000. Not a directory.
- */
- it('fileio_test_error_005', 0, async function (done) {
- let fpath = await nextFileName('fileio_test_error_005');
- expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
- try {
- fileio.openSync(fpath, 0o200000, 0o666);
- }
- catch (err) {
- console.info('fileio_test_error_005 has failed for ' + err);
- expect(isInclude(err.message, 'Not a directory')).assertTrue();
- fileio.unlinkSync(fpath);
- done();
- }
- });
-});
+/*
+ * 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 fileio from '@ohos.fileio'
+import {
+ describe,
+ it,
+ expect
+}
+from '@ohos/hypium'
+import {
+ FILE_CONTENT,
+ prepareFile,
+ fileName,
+ nextFileName,
+ isIntNum,
+ isInclude
+}
+from './Common'
+
+export default function FileIOError() {
+describe('FileIOError', function () {
+
+ /**
+ * @tc.number SUB_STORAGE_FileIo_test_error_0000
+ * @tc.name fileio_test_error_000
+ * @tc.desc Function of API, Delete directories with files
+ */
+ it('fileio_test_error_000', 0, async function (done) {
+ let dpath = await fileName('fileio_test_error_000d');
+ let fpath = dpath + '/fileio_test_error_000f';
+ fileio.mkdirSync(dpath);
+ expect(prepareFile(fpath, 'hello')).assertTrue();
+ try {
+ let fd = fileio.openSync(dpath);
+ expect(isIntNum(fd)).assertTrue();
+ fileio.rmdirSync(dpath);
+ }
+ catch (err) {
+ console.info('fileio_test_error_000 has failed for ' + err);
+ expect(isInclude(err.message, 'Directory not empty')).assertTrue();
+ fileio.unlinkSync(fpath);
+ fileio.rmdirSync(dpath);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_STORAGE_FileIo_test_error_0100
+ * @tc.name fileio_test_error_001
+ * @tc.desc Function of API, delete file
+ */
+ it('fileio_test_error_001', 0, async function (done) {
+ let fpath = await fileName('fileio_test_error_001f');
+ expect(prepareFile(fpath, 'hello')).assertTrue();
+ try {
+ let fd = fileio.openSync(fpath);
+ expect(isIntNum(fd)).assertTrue();
+ fileio.rmdirSync(fpath);
+ }
+ catch (err) {
+ console.info('fileio_test_error_001 has failed for ' + err);
+ expect(isInclude(err.message, 'Not a directory')).assertTrue();
+ fileio.unlinkSync(fpath);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_STORAGE_FileIo_test_error_0200
+ * @tc.name fileio_test_error_002
+ * @tc.desc Function of API, flags=0o100. missing mode parameter.
+ */
+ it('fileio_test_error_002', 0, async function (done) {
+ let fpath = await nextFileName('fileio_test_error_002');
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
+ try {
+ fileio.openSync(fpath, 0o100);
+ }
+ catch (err) {
+ console.info('fileio_test_error_002 has failed for ' + err);
+ expect(isInclude(err.message, 'called with O_CREAT/O_TMPFILE but no mode')).assertTrue();
+ fileio.unlinkSync(fpath);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_STORAGE_FileIO_OpenSync_0300
+ * @tc.name fileio_test_error_003
+ * @tc.desc Function of API, flags=0o302. The test file is exist.
+ */
+ it('fileio_test_error_003', 0, async function (done) {
+ let fpath = await nextFileName('fileio_test_error_003');
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
+ try {
+ fileio.openSync(fpath, 0o302, 0o666);
+ }
+ catch (err) {
+ console.info('fileio_test_error_003 has failed for ' + err);
+ expect(isInclude(err.message, 'File exists')).assertTrue();
+ fileio.unlinkSync(fpath);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_STORAGE_FileIO_OpenSync_0400
+ * @tc.name fileio_test_error_004
+ * @tc.desc Function of API, flags=0o400000. Symbolic link loop.
+ */
+ it('fileio_test_error_004', 0, async function (done) {
+ let fpath = await nextFileName('fileio_test_error_004');
+ let ffpath = fpath + 'aaaa';
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
+ try {
+ fileio.symlinkSync(fpath, ffpath);
+ fileio.openSync(ffpath, 0o400000);
+ }
+ catch (err) {
+ console.info('fileio_test_error_004 has failed for ' + err);
+ expect(isInclude(err.message, 'Symbolic link loop') ||
+ isInclude(err.message, 'Too many symbolic links encountered')).assertTrue();
+ fileio.unlinkSync(fpath);
+ fileio.unlinkSync(ffpath);
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_STORAGE_FileIO_OpenSync_0500
+ * @tc.name fileio_test_error_005
+ * @tc.desc Function of API, flags=0o200000. Not a directory.
+ */
+ it('fileio_test_error_005', 0, async function (done) {
+ let fpath = await nextFileName('fileio_test_error_005');
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
+ try {
+ fileio.openSync(fpath, 0o200000, 0o666);
+ }
+ catch (err) {
+ console.info('fileio_test_error_005 has failed for ' + err);
+ expect(isInclude(err.message, 'Not a directory')).assertTrue();
+ fileio.unlinkSync(fpath);
+ done();
+ }
+ });
+});
+}
diff --git a/storage/storagefileioerrorjstest/src/main/js/default/test/List.test.js b/storage/storagefileioerrorjstest/src/main/js/test/List.test.js
similarity index 83%
rename from storage/storagefileioerrorjstest/src/main/js/default/test/List.test.js
rename to storage/storagefileioerrorjstest/src/main/js/test/List.test.js
index 04baba482f481926550ead43e8842f30e461c152..665ffda956aef7ab97eefaec1b57ab11bdb0604b 100644
--- a/storage/storagefileioerrorjstest/src/main/js/default/test/List.test.js
+++ b/storage/storagefileioerrorjstest/src/main/js/test/List.test.js
@@ -1,16 +1,19 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require('./FileIOError.test.js')
+/*
+ * 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 FileIOError from './FileIOError.test.js'
+export default function testsuite() {
+FileIOError()
+}
diff --git a/storage/storagefileioerrorjstest/src/main/resources/base/element/string.json b/storage/storagefileioerrorjstest/src/main/resources/base/element/string.json
index 0fd37c950e3e7c25acb4b632b057c2c4e181fac0..5bdb90000e71dc63c7cfa55cb919ef7473472fc1 100644
--- a/storage/storagefileioerrorjstest/src/main/resources/base/element/string.json
+++ b/storage/storagefileioerrorjstest/src/main/resources/base/element/string.json
@@ -1,12 +1,28 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "storagefileioerrorjstest"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "storagefileioerrorjstest"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/storage/storagesecuritylabeljstest/BUILD.gn b/storage/storagesecuritylabeljstest/BUILD.gn
index cef131ddd483d2743b0813fa3a7271a4e8a8108a..82b82b24f042f6903fd760a050b0fc042d6fc4bf 100644
--- a/storage/storagesecuritylabeljstest/BUILD.gn
+++ b/storage/storagesecuritylabeljstest/BUILD.gn
@@ -9,7 +9,7 @@
# 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.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
@@ -23,7 +23,9 @@ ohos_js_hap_suite("storagesecuritylabel_js_test") {
hap_name = "ActsStorageSecurityLabelJSTest"
}
ohos_js_assets("storagesecuritylabel_js_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("storagesecuritylabel_js_resources") {
sources = [ "./src/main/resources" ]
diff --git a/storage/storagesecuritylabeljstest/Test.json b/storage/storagesecuritylabeljstest/Test.json
index 540d87082d7fc6604f9a676794ad8f9c8974591d..600c9a4db1e0ce063bcffb458b17369c77f69bcb 100644
--- a/storage/storagesecuritylabeljstest/Test.json
+++ b/storage/storagesecuritylabeljstest/Test.json
@@ -1,18 +1,19 @@
-{
- "description": "Configuration for storage securitylabel Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "60000",
- "package": "ohos.acts.storage.securitylabel",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsStorageSecurityLabelJSTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
+{
+ "description": "Configuration for storage securitylabel Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "60000",
+ "shell-timeout": "60000",
+ "bundle-name": "ohos.acts.storage.securitylabel",
+ "package-name": "ohos.acts.storage.securitylabel"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsStorageSecurityLabelJSTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
}
\ No newline at end of file
diff --git a/storage/storagesecuritylabeljstest/src/main/config.json b/storage/storagesecuritylabeljstest/src/main/config.json
index 24dff049de74d4776ebad7d7cc7acd5a37000d49..59d3307bbfd03d3fcb95e1148e7efda7330cadab 100644
--- a/storage/storagesecuritylabeljstest/src/main/config.json
+++ b/storage/storagesecuritylabeljstest/src/main/config.json
@@ -1,61 +1,94 @@
-{
- "app": {
- "bundleName": "ohos.acts.storage.securitylabel",
- "vendor": "example",
- "version": {
- "code": 1000000,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "ohos.acts.storage.securitylabel",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": true
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "ohos.acts.storage.securitylabel.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard",
- "visible": true
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ]
- }
+{
+ "app": {
+ "bundleName": "ohos.acts.storage.securitylabel",
+ "vendor": "example",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.storage.securitylabel",
+ "name": ".entry",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": true
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "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
diff --git a/storage/storagesecuritylabeljstest/src/main/js/default/app.js b/storage/storagesecuritylabeljstest/src/main/js/MainAbility/app.js
similarity index 100%
rename from storage/storagesecuritylabeljstest/src/main/js/default/app.js
rename to storage/storagesecuritylabeljstest/src/main/js/MainAbility/app.js
diff --git a/storage/storagesecuritylabeljstest/src/main/js/default/i18n/en-US.json b/storage/storagesecuritylabeljstest/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from storage/storagesecuritylabeljstest/src/main/js/default/i18n/en-US.json
rename to storage/storagesecuritylabeljstest/src/main/js/MainAbility/i18n/en-US.json
diff --git a/storage/storagesecuritylabeljstest/src/main/js/default/i18n/zh-CN.json b/storage/storagesecuritylabeljstest/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from storage/storagesecuritylabeljstest/src/main/js/default/i18n/zh-CN.json
rename to storage/storagesecuritylabeljstest/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/storage/storagesecuritylabeljstest/src/main/js/default/pages/index/index.css b/storage/storagesecuritylabeljstest/src/main/js/MainAbility/pages/index/index.css
similarity index 100%
rename from storage/storagesecuritylabeljstest/src/main/js/default/pages/index/index.css
rename to storage/storagesecuritylabeljstest/src/main/js/MainAbility/pages/index/index.css
diff --git a/storage/storagesecuritylabeljstest/src/main/js/default/pages/index/index.hml b/storage/storagesecuritylabeljstest/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from storage/storagesecuritylabeljstest/src/main/js/default/pages/index/index.hml
rename to storage/storagesecuritylabeljstest/src/main/js/MainAbility/pages/index/index.hml
diff --git a/storage/storagestatfsjstest/src/main/js/default/pages/index/index.js b/storage/storagesecuritylabeljstest/src/main/js/MainAbility/pages/index/index.js
similarity index 79%
rename from storage/storagestatfsjstest/src/main/js/default/pages/index/index.js
rename to storage/storagesecuritylabeljstest/src/main/js/MainAbility/pages/index/index.js
index 61921cf3ba7d0a16a9c2edb9b9f04c1fb69a6333..5f9fe94e4bc5dc38ed24399a7bc18167d42310fc 100644
--- a/storage/storagestatfsjstest/src/main/js/default/pages/index/index.js
+++ b/storage/storagesecuritylabeljstest/src/main/js/MainAbility/pages/index/index.js
@@ -1,41 +1,34 @@
-/*
- * 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 app from '@system.app'
-
-import {Core} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow finish')
- const core = Core.getInstance()
- core.init()
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- require('../../test/List.test')
- core.execute()
- },
- onReady() {
- },
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import app from '@system.app'
+
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
}
\ No newline at end of file
diff --git a/storage/storagesecuritylabeljstest/src/main/js/TestAbility/app.js b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/storage/storagesecuritylabeljstest/src/main/js/TestAbility/i18n/en-US.json b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/storage/storagesecuritylabeljstest/src/main/js/TestAbility/i18n/zh-CN.json b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.css b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.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
diff --git a/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.hml b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.js b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/storage/storagesecuritylabeljstest/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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');
+ }
+}
+
+
+
diff --git a/storage/storagesecuritylabeljstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/storage/storagesecuritylabeljstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/storage/storagesecuritylabeljstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/storage/storagesecuritylabeljstest/src/main/js/default/test/Common.js b/storage/storagesecuritylabeljstest/src/main/js/test/Common.js
similarity index 89%
rename from storage/storagesecuritylabeljstest/src/main/js/default/test/Common.js
rename to storage/storagesecuritylabeljstest/src/main/js/test/Common.js
index b6f14c9c5b3f9ffb6d17705a469cd29829012cab..ff4d298fe066bce143ae70f11a06b89ea689831f 100644
--- a/storage/storagesecuritylabeljstest/src/main/js/default/test/Common.js
+++ b/storage/storagesecuritylabeljstest/src/main/js/test/Common.js
@@ -1,42 +1,39 @@
-/*
- * 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 securityLabel from '@ohos.securityLabel';
-import fileio from '@ohos.fileio';
-import featureAbility from '@ohos.ability.featureAbility';
-
-import {
- describe, beforeAll, beforeEach, afterEach, afterAll, it, expect
-}
-from 'deccjsunit/index'
-
-export async function nextFileName(testName) {
- let context = featureAbility.getContext();
- let data = await context.getFilesDir();
- let BASE_PATH = data.substring(0, data.length - 5) + 'cache/';
- return BASE_PATH + testName;
-}
-
-export {
- describe,
- beforeAll,
- beforeEach,
- afterEach,
- afterAll,
- it,
- expect,
- securityLabel,
- fileio
+/*
+ * 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 securityLabel from '@ohos.securityLabel';
+import fileio from '@ohos.fileio';
+import featureAbility from '@ohos.ability.featureAbility';
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+export async function nextFileName(testName) {
+ let context = featureAbility.getContext();
+ let data = await context.getFilesDir();
+ let BASE_PATH = data.substring(0, data.length - 5) + 'cache/';
+ return BASE_PATH + testName;
+}
+
+export {
+ describe,
+ beforeAll,
+ beforeEach,
+ afterEach,
+ afterAll,
+ it,
+ expect,
+ securityLabel,
+ fileio
};
\ No newline at end of file
diff --git a/storage/storagestatfsjstest/src/main/js/default/test/List.test.js b/storage/storagesecuritylabeljstest/src/main/js/test/List.test.js
similarity index 82%
rename from storage/storagestatfsjstest/src/main/js/default/test/List.test.js
rename to storage/storagesecuritylabeljstest/src/main/js/test/List.test.js
index 620587e841199504229bcb49bd3a750a1e6753bc..12704969bc505914a60b85eef49b6e167134d2f7 100644
--- a/storage/storagestatfsjstest/src/main/js/default/test/List.test.js
+++ b/storage/storagesecuritylabeljstest/src/main/js/test/List.test.js
@@ -1,16 +1,19 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require('./statfs.test.js')
+/*
+ * 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 securitylabel from './securitylabel.test.js'
+export default function testsuite() {
+securitylabel()
+}
diff --git a/storage/storagesecuritylabeljstest/src/main/js/default/test/securitylabel.test.js b/storage/storagesecuritylabeljstest/src/main/js/test/securitylabel.test.js
similarity index 97%
rename from storage/storagesecuritylabeljstest/src/main/js/default/test/securitylabel.test.js
rename to storage/storagesecuritylabeljstest/src/main/js/test/securitylabel.test.js
index 42cf9a60f16d257342b94df6e833dcd038839e66..db94547a71e31a0d606a23bd135f939bc39a463b 100644
--- a/storage/storagesecuritylabeljstest/src/main/js/default/test/securitylabel.test.js
+++ b/storage/storagesecuritylabeljstest/src/main/js/test/securitylabel.test.js
@@ -1,566 +1,568 @@
-/*
- * 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 {
- describe, it, expect, securityLabel, nextFileName, fileio
-} from './Common';
-
-describe('securitylabel', function () {
-
- /**
- * @tc.number SUB_DF_SECURITYLABEL_SET_SECURITY_LABEL_SYNC_0000
- * @tc.name securitylabel_test_set_security_label_sync_000
- * @tc.desc Test the setSecurityLabelSync() interface,and the getSecurityLabelSync() interface to get the data label.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('securitylabel_test_set_security_label_sync_000', 0, async function () {
- try {
- let dataLevel = ["s0","s1","s2","s3","s4"];
- for(let i=0;i
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/storage/storagestatfsjstest/src/main/js/TestAbility/pages/index/index.js b/storage/storagestatfsjstest/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/storage/storagestatfsjstest/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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');
+ }
+}
+
+
+
diff --git a/storage/storagestatfsjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/storage/storagestatfsjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/storage/storagestatfsjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/storage/storagestatfsjstest/src/main/js/default/test/Common.js b/storage/storagestatfsjstest/src/main/js/test/Common.js
similarity index 86%
rename from storage/storagestatfsjstest/src/main/js/default/test/Common.js
rename to storage/storagestatfsjstest/src/main/js/test/Common.js
index e05e4f3aed0f54a85d2479d720fb76f17c248fa4..bc92fb897a86dac1274acd4c50a4963e938307b4 100644
--- a/storage/storagestatfsjstest/src/main/js/default/test/Common.js
+++ b/storage/storagestatfsjstest/src/main/js/test/Common.js
@@ -1,39 +1,36 @@
-/*
- * 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 statfs from '@ohos.statfs';
-
-export const FILE_CONTENT = 'hello world';
-
-import {
- describe, beforeAll, beforeEach, afterEach, afterAll, it, expect
-}
-from 'deccjsunit/index'
-
-function isIntNum(val) {
- return typeof val === 'number' && val % 1 === 0;
-}
-
-export {
- isIntNum,
- describe,
- beforeAll,
- beforeEach,
- afterEach,
- afterAll,
- it,
- expect,
- statfs
+/*
+ * 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 statfs from '@ohos.statfs';
+
+export const FILE_CONTENT = 'hello world';
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+function isIntNum(val) {
+ return typeof val === 'number' && val % 1 === 0;
+}
+
+export {
+ isIntNum,
+ describe,
+ beforeAll,
+ beforeEach,
+ afterEach,
+ afterAll,
+ it,
+ expect,
+ statfs
};
\ No newline at end of file
diff --git a/storage/storagesecuritylabeljstest/src/main/js/default/test/List.test.js b/storage/storagestatfsjstest/src/main/js/test/List.test.js
similarity index 85%
rename from storage/storagesecuritylabeljstest/src/main/js/default/test/List.test.js
rename to storage/storagestatfsjstest/src/main/js/test/List.test.js
index 1d4d537418fcc60242afcf921a74c922d5133580..5d427bab4e5932d910c07ba6b5ea43a93288a305 100644
--- a/storage/storagesecuritylabeljstest/src/main/js/default/test/List.test.js
+++ b/storage/storagestatfsjstest/src/main/js/test/List.test.js
@@ -1,16 +1,19 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require('./securitylabel.test.js');
+/*
+ * 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 statfs from './statfs.test.js'
+export default function testsuite() {
+statfs()
+}
diff --git a/storage/storagestatfsjstest/src/main/js/default/test/statfs.test.js b/storage/storagestatfsjstest/src/main/js/test/statfs.test.js
similarity index 96%
rename from storage/storagestatfsjstest/src/main/js/default/test/statfs.test.js
rename to storage/storagestatfsjstest/src/main/js/test/statfs.test.js
index dd634f9a56b7ca5a9d3acc77ff59455680d461ee..73482a0203db43ce2c9cda12c6018ae8a1904d11 100644
--- a/storage/storagestatfsjstest/src/main/js/default/test/statfs.test.js
+++ b/storage/storagestatfsjstest/src/main/js/test/statfs.test.js
@@ -1,224 +1,226 @@
-/*
- * 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 {describe, it, expect, isIntNum, statfs} from './Common';
-import featureAbility from '@ohos.ability.featureAbility';
-
-describe('statfs', function () {
-
- /**
- * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0000
- * @tc.name statfs_test_get_free_bytes_async_000
- * @tc.desc Test getFreeBytes() interfaces, When the path is a sandbox path, promise way back.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_free_bytes_async_000', 0, async function (done) {
- try {
- let context = featureAbility.getContext();
- let data = await context.getFilesDir();
- let number = await statfs.getFreeBytes(data);
- console.info("getFreeBytes getFilesDir===>" + (number / 1024));
- expect(isIntNum(number)).assertTrue();
- done();
- } catch (e) {
- console.info('statfs_test_get_free_bytes_async_000 has failed for ' + e);
- expect(null).assertFail();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0010
- * @tc.name statfs_test_get_free_bytes_async_001
- * @tc.desc Test getFreeBytes() interfaces, When the path is dev, callback way back.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_free_bytes_async_001', 0, async function (done) {
- try {
- statfs.getFreeBytes("/dev",(err,number)=>{
- console.info("getFreeBytesNumber dev===>:" + (number / 1024));
- expect(isIntNum(number)).assertTrue();
- done();
- });
- } catch (e) {
- console.info('statfs_test_get_free_bytes_async_001 has failed for ' + e);
- expect(null).assertFail();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0020
- * @tc.name statfs_test_get_free_bytes_async_002
- * @tc.desc Test getFreeBytes() interfaces, When the parameter type is wrong.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_free_bytes_async_002', 0, async function (done) {
- try {
- await statfs.getFreeBytes(1);
- } catch (err) {
- console.info('statfs_test_get_free_bytes_async_002 has failed for ' + err);
- expect(err.message == "Invalid path").assertTrue();
- done();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0030
- * @tc.name statfs_test_get_free_bytes_async_003
- * @tc.desc Test getFreeBytes() interfaces, When there are no parameters.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_free_bytes_async_003', 0, async function (done) {
- try {
- await statfs.getFreeBytes();
- } catch (err) {
- console.info('statfs_test_get_free_bytes_async_003 has failed for ' + err);
- expect(err.message == "Number of arguments unmatched").assertTrue();
- done();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0040
- * @tc.name statfs_test_get_free_bytes_async_004
- * @tc.desc Test getFreeBytes() interfaces, When the path is empty.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_free_bytes_async_004', 0, async function (done) {
- try {
- await statfs.getFreeBytes("");
- } catch (err) {
- console.info('statfs_test_get_free_bytes_async_004 has failed for ' + err);
- expect(err.message == "No such file or directory").assertTrue();
- done();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0000
- * @tc.name statfs_test_get_total_bytes_async_000
- * @tc.desc Test getTotalBytes() interfaces, When the path is a sandbox path, promise way back.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_total_bytes_async_000', 0, async function (done) {
- try {
- let context = featureAbility.getContext();
- let data = await context.getFilesDir();
- let number = await statfs.getTotalBytes(data);
- console.info("getTotalBytesNumber GetFilesDir====>:" + (number / 1024));
- expect(isIntNum(number)).assertTrue();
- done();
- } catch (e) {
- console.info('statfs_test_get_total_bytes_async_000 has failed for ' + e);
- expect(null).assertFail();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0010
- * @tc.name statfs_test_get_total_bytes_async_001
- * @tc.desc Test getTotalBytes() interfaces, When the path is dev, callback way back.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_total_bytes_async_001', 0, async function (done) {
- try {
- statfs.getTotalBytes("/dev",(err,number)=>{
- console.info("getTotalBytesNumber dev===>:" + (number / 1024));
- expect(isIntNum(number)).assertTrue();
- done();
- });
- } catch (e) {
- console.info('statfs_test_get_total_bytes_async_001 has failed for ' + e);
- expect(null).assertFail();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0020
- * @tc.name statfs_test_get_total_bytes_async_002
- * @tc.desc Test getTotalBytes() interfaces, When the parameter type is wrong.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_total_bytes_async_002', 0, async function (done) {
- try {
- await statfs.getTotalBytes(1);
- } catch (err) {
- console.info('statfs_test_get_total_bytes_async_002 has failed for ' + err);
- expect(err.message == "Invalid path").assertTrue();
- done();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0030
- * @tc.name statfs_test_get_total_bytes_async_003
- * @tc.desc Test getTotalBytes() interfaces, When there are no parameters.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_total_bytes_async_003', 0, async function (done) {
- try {
- await statfs.getTotalBytes();
- } catch (err) {
- console.info('statfs_test_get_total_bytes_async_003 has failed for ' + err);
- expect(err.message == "Number of arguments unmatched").assertTrue();
- done();
- }
- });
-
- /**
- * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0040
- * @tc.name statfs_test_get_total_bytes_async_004
- * @tc.desc Test getTotalBytes() interfaces, When the path is empty.
- * @tc.size MEDIUM
- * @tc.type Function
- * @tc.level Level 0
- * @tc.require
- */
- it('statfs_test_get_total_bytes_async_004', 0, async function (done) {
- try {
- await statfs.getTotalBytes("");
- } catch (err) {
- console.info('statfs_test_get_total_bytes_async_004 has failed for ' + err);
- expect(err.message == "No such file or directory").assertTrue();
- done();
- }
- });
-});
+/*
+ * 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 {describe, it, expect, isIntNum, statfs} from './Common';
+import featureAbility from '@ohos.ability.featureAbility';
+
+export default function statfs() {
+describe('statfs', function () {
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0000
+ * @tc.name statfs_test_get_free_bytes_async_000
+ * @tc.desc Test getFreeBytes() interfaces, When the path is a sandbox path, promise way back.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_free_bytes_async_000', 0, async function (done) {
+ try {
+ let context = featureAbility.getContext();
+ let data = await context.getFilesDir();
+ let number = await statfs.getFreeBytes(data);
+ console.info("getFreeBytes getFilesDir===>" + (number / 1024));
+ expect(isIntNum(number)).assertTrue();
+ done();
+ } catch (e) {
+ console.info('statfs_test_get_free_bytes_async_000 has failed for ' + e);
+ expect(null).assertFail();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0010
+ * @tc.name statfs_test_get_free_bytes_async_001
+ * @tc.desc Test getFreeBytes() interfaces, When the path is dev, callback way back.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_free_bytes_async_001', 0, async function (done) {
+ try {
+ statfs.getFreeBytes("/dev",(err,number)=>{
+ console.info("getFreeBytesNumber dev===>:" + (number / 1024));
+ expect(isIntNum(number)).assertTrue();
+ done();
+ });
+ } catch (e) {
+ console.info('statfs_test_get_free_bytes_async_001 has failed for ' + e);
+ expect(null).assertFail();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0020
+ * @tc.name statfs_test_get_free_bytes_async_002
+ * @tc.desc Test getFreeBytes() interfaces, When the parameter type is wrong.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_free_bytes_async_002', 0, async function (done) {
+ try {
+ await statfs.getFreeBytes(1);
+ } catch (err) {
+ console.info('statfs_test_get_free_bytes_async_002 has failed for ' + err);
+ expect(err.message == "Invalid path").assertTrue();
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0030
+ * @tc.name statfs_test_get_free_bytes_async_003
+ * @tc.desc Test getFreeBytes() interfaces, When there are no parameters.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_free_bytes_async_003', 0, async function (done) {
+ try {
+ await statfs.getFreeBytes();
+ } catch (err) {
+ console.info('statfs_test_get_free_bytes_async_003 has failed for ' + err);
+ expect(err.message == "Number of arguments unmatched").assertTrue();
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0040
+ * @tc.name statfs_test_get_free_bytes_async_004
+ * @tc.desc Test getFreeBytes() interfaces, When the path is empty.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_free_bytes_async_004', 0, async function (done) {
+ try {
+ await statfs.getFreeBytes("");
+ } catch (err) {
+ console.info('statfs_test_get_free_bytes_async_004 has failed for ' + err);
+ expect(err.message == "No such file or directory").assertTrue();
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0000
+ * @tc.name statfs_test_get_total_bytes_async_000
+ * @tc.desc Test getTotalBytes() interfaces, When the path is a sandbox path, promise way back.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_total_bytes_async_000', 0, async function (done) {
+ try {
+ let context = featureAbility.getContext();
+ let data = await context.getFilesDir();
+ let number = await statfs.getTotalBytes(data);
+ console.info("getTotalBytesNumber GetFilesDir====>:" + (number / 1024));
+ expect(isIntNum(number)).assertTrue();
+ done();
+ } catch (e) {
+ console.info('statfs_test_get_total_bytes_async_000 has failed for ' + e);
+ expect(null).assertFail();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0010
+ * @tc.name statfs_test_get_total_bytes_async_001
+ * @tc.desc Test getTotalBytes() interfaces, When the path is dev, callback way back.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_total_bytes_async_001', 0, async function (done) {
+ try {
+ statfs.getTotalBytes("/dev",(err,number)=>{
+ console.info("getTotalBytesNumber dev===>:" + (number / 1024));
+ expect(isIntNum(number)).assertTrue();
+ done();
+ });
+ } catch (e) {
+ console.info('statfs_test_get_total_bytes_async_001 has failed for ' + e);
+ expect(null).assertFail();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0020
+ * @tc.name statfs_test_get_total_bytes_async_002
+ * @tc.desc Test getTotalBytes() interfaces, When the parameter type is wrong.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_total_bytes_async_002', 0, async function (done) {
+ try {
+ await statfs.getTotalBytes(1);
+ } catch (err) {
+ console.info('statfs_test_get_total_bytes_async_002 has failed for ' + err);
+ expect(err.message == "Invalid path").assertTrue();
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0030
+ * @tc.name statfs_test_get_total_bytes_async_003
+ * @tc.desc Test getTotalBytes() interfaces, When there are no parameters.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_total_bytes_async_003', 0, async function (done) {
+ try {
+ await statfs.getTotalBytes();
+ } catch (err) {
+ console.info('statfs_test_get_total_bytes_async_003 has failed for ' + err);
+ expect(err.message == "Number of arguments unmatched").assertTrue();
+ done();
+ }
+ });
+
+ /**
+ * @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0040
+ * @tc.name statfs_test_get_total_bytes_async_004
+ * @tc.desc Test getTotalBytes() interfaces, When the path is empty.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it('statfs_test_get_total_bytes_async_004', 0, async function (done) {
+ try {
+ await statfs.getTotalBytes("");
+ } catch (err) {
+ console.info('statfs_test_get_total_bytes_async_004 has failed for ' + err);
+ expect(err.message == "No such file or directory").assertTrue();
+ done();
+ }
+ });
+});
+}
diff --git a/storage/storagestatfsjstest/src/main/resources/base/element/string.json b/storage/storagestatfsjstest/src/main/resources/base/element/string.json
index a3b97c0acfe6cf4a1ff00dcfcf5eea4656fb3a8e..c550020f7a261df273c99a31fe8f39e77f544d97 100644
--- a/storage/storagestatfsjstest/src/main/resources/base/element/string.json
+++ b/storage/storagestatfsjstest/src/main/resources/base/element/string.json
@@ -1,12 +1,28 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "Storagestatfsjstest"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "Storagestatfsjstest"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/BUILD.gn b/useriam/face_auth/js_api_test/function_test/userauth/BUILD.gn
index 49437a6dfa1c844e26ff4ccda0074cf01f7744c0..b4e2cfe91b0053e86d821ff2c6e73d7a845e31c7 100644
--- a/useriam/face_auth/js_api_test/function_test/userauth/BUILD.gn
+++ b/useriam/face_auth/js_api_test/function_test/userauth/BUILD.gn
@@ -9,12 +9,12 @@
# 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.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsUserauthTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsUserauthTest") {
hap_name = "ActsUserauthTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/Test.json b/useriam/face_auth/js_api_test/function_test/userauth/Test.json
index 639bd86e70753bd0713ea677570631e9337c4ff5..dbc66873c909c0a0913d91fecb07d9d2d62543bc 100644
--- a/useriam/face_auth/js_api_test/function_test/userauth/Test.json
+++ b/useriam/face_auth/js_api_test/function_test/userauth/Test.json
@@ -1,38 +1,39 @@
-{
- "description": "Configuration for hjunit demo Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "600000",
- "package": "com.example.myapplication101",
- "shell-timeout": "600000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsUserauthTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- },
- {
- "type": "ShellKit",
- "run-command": [
- "remount",
- "mkdir /data/test"
- ]
- },
- {
- "type": "PushKit",
- "push": [
- "ActsUserauthTest.hap->/data/test/ActsUserauthTest.hap"
- ]
- },
- {
- "type": "ShellKit",
- "run-command": [
- "chmod 644 /data/test/*.hap",
- "chmod 777 -R data"
- ]
- }
- ]
-}
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "600000",
+ "shell-timeout": "600000",
+ "bundle-name": "com.example.myapplication101",
+ "package-name": "com.example.myapplication101"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsUserauthTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "remount",
+ "mkdir /data/test"
+ ]
+ },
+ {
+ "type": "PushKit",
+ "push": [
+ "ActsUserauthTest.hap->/data/test/ActsUserauthTest.hap"
+ ]
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "chmod 644 /data/test/*.hap",
+ "chmod 777 -R data"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/config.json b/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/config.json
deleted file mode 100644
index 3a9c1d22d40625050e4e461f1afc3587ea97ad17..0000000000000000000000000000000000000000
--- a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/config.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.myapplication101",
- "vendor": "example",
- "version": {
- "code": 12,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.myapplication101",
- "name": ".MyApplication",
- "mainAbility": "com.example.myapplication101.MainAbility",
- "deviceType": [
- "phone",
- "tablet",
- "tv",
- "wearable"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": false
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.myapplication101.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "standard",
- "visible": true
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ],
- "reqPermissions": [
- {
- "reason": "reason_manage_face",
- "usedScene": {
- "ability": ["com.myface.Ability","com.myface.AbilityBackground"],
- "when": "always"
- },
- "name": "ohos.permission.MANAGE_FACE"
- },
- {
- "reason": "reason_access_biometric",
- "usedScene": {
- "ability": ["com.mybiometric.Ability","com.mybiometric.AbilityBackground"],
- "when": "always"
- },
- "name": "ohos.permission.ACCESS_BIOMETRIC"
- }
- ]
- }
-}
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/resources/base/element/string.json b/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..0000000000000000000000000000000000000000
--- a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "entry_MainAbility"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/config.json b/useriam/face_auth/js_api_test/function_test/userauth/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..707536ee73d5df178d03b0506eb228ee8ad876b1
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/config.json
@@ -0,0 +1,132 @@
+{
+ "app": {
+ "bundleName": "com.example.myapplication101",
+ "vendor": "example",
+ "version": {
+ "code": 12,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.myapplication101",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "deviceType": [
+ "phone",
+ "tablet",
+ "tv",
+ "wearable"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ },
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": true
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "reqPermissions": [
+ {
+ "reason": "reason_manage_face",
+ "usedScene": {
+ "ability": [
+ "com.myface.Ability",
+ "com.myface.AbilityBackground"
+ ],
+ "when": "always"
+ },
+ "name": "ohos.permission.MANAGE_FACE"
+ },
+ {
+ "reason": "reason_access_biometric",
+ "usedScene": {
+ "ability": [
+ "com.mybiometric.Ability",
+ "com.mybiometric.AbilityBackground"
+ ],
+ "when": "always"
+ },
+ "name": "ohos.permission.ACCESS_BIOMETRIC"
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "srcPath": ""
+ }
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/app.js b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..71bc14aeca4d9840060a4760d68d3f6d4881f37f
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
+
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/i18n/en-US.json b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/i18n/en-US.json
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/i18n/en-US.json
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/i18n/zh-CN.json b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/i18n/zh-CN.json
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/pages/index/index.css b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/pages/index/index.css
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/pages/index/index.css
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/pages/index/index.css
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/pages/index/index.hml b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/pages/index/index.hml
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/pages/index/index.hml
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/pages/index/index.js b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/pages/index/index.js
similarity index 80%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/pages/index/index.js
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/pages/index/index.js
index f818fec4c403426ebf70c10ed501370690ce0057..7c3c73abb61f335c27367c4ef5b54d49c2ea96c8 100644
--- a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/pages/index/index.js
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/MainAbility/pages/index/index.js
@@ -1,72 +1,60 @@
-/*
- * 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 {Core, ExpectExtend} from 'deccjsunit/index'
-import fileio from '@ohos.fileio'
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow start')
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
- const configService = core.getDefaultService('config')
- this.timeout = 35000;
- configService.setConfig(this)
- require('../../../test/ListTest')
- core.execute()
- console.info('onShow end')
- },
- onReady() {
- },
- fileSave(caseNum, codeNum, ...code) {
- console.log(caseNum + ' fileSave start');
- var path = "/data/config.dat"
- let fd = fileio.openSync(path, 0o102, 0o666);
- var message = caseNum + "\r\n" + codeNum + "\r\n";
- for(var i = 0; i < code.length; i++){
- message = message + code[i] + "\r\n";
- }
- fileio.writeSync(fd, message);
- fileio.closeSync(fd);
- console.log(caseNum + ' fileSave end');
- },
- fileSaveB(caseNum, code) {
- console.log(caseNum + ' fileSave start');
- var path = "/data/config.dat"
- let fd = fileio.openSync(path, 0o102, 0o666);
- var message = code;
- fileio.writeSync(fd, message);
- fileio.closeSync(fd);
- console.log(caseNum + ' fileSave end');
- },
- saveNull() {
- console.log('JSAPI null file faceid.dat start');
- var path = "/data/faceId.dat"
- let fd = fileio.openSync(path, 0o102, 0o666);
- var message = "";
- fileio.writeSync(fd, message);
- fileio.closeSync(fd);
- console.log('JSAPI null file faceid.dat end');
- },
-}
+/*
+ * 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 fileio from '@ohos.fileio'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow start')
+
+ },
+ onReady() {
+ },
+ fileSave(caseNum, codeNum, ...code) {
+ console.log(caseNum + ' fileSave start');
+ var path = "/data/config.dat"
+ let fd = fileio.openSync(path, 0o102, 0o666);
+ var message = caseNum + "\r\n" + codeNum + "\r\n";
+ for(var i = 0; i < code.length; i++){
+ message = message + code[i] + "\r\n";
+ }
+ fileio.writeSync(fd, message);
+ fileio.closeSync(fd);
+ console.log(caseNum + ' fileSave end');
+ },
+ fileSaveB(caseNum, code) {
+ console.log(caseNum + ' fileSave start');
+ var path = "/data/config.dat"
+ let fd = fileio.openSync(path, 0o102, 0o666);
+ var message = code;
+ fileio.writeSync(fd, message);
+ fileio.closeSync(fd);
+ console.log(caseNum + ' fileSave end');
+ },
+ saveNull() {
+ console.log('JSAPI null file faceid.dat start');
+ var path = "/data/faceId.dat"
+ let fd = fileio.openSync(path, 0o102, 0o666);
+ var message = "";
+ fileio.writeSync(fd, message);
+ fileio.closeSync(fd);
+ console.log('JSAPI null file faceid.dat end');
+ },
+}
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/app.js b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/app.js
similarity index 96%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/app.js
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/app.js
index 2d316a0a089b332c5c28729be9ff937aa46618c5..875191631733a62e2bdff76d6b5a2e2f1b130937 100644
--- a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/default/app.js
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/app.js
@@ -1,22 +1,23 @@
-/*
- * 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');
- }
-};
+/*
+ * 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');
+ }
+};
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/i18n/en-US.json b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/i18n/zh-CN.json b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.css b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.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
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.hml b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.js b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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');
+ }
+}
+
+
+
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/ListTest.js b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/ListTest.js
new file mode 100644
index 0000000000000000000000000000000000000000..67380c83ac3adbb08ecda2136f17ea66531bd079
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/ListTest.js
@@ -0,0 +1,21 @@
+/*
+ * 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 ActsAmsCallBackFourthScene from './execute.js'
+import ActsAmsCallBackFourthScene from './enumTest.js'
+export default function testsuite() {
+ userAuthTestEnum()
+ userAuthTestExecute()
+}
+
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/enumTest.js b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/enumTest.js
similarity index 93%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/enumTest.js
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/enumTest.js
index ea7953e13ddc1fa33f66fbe67e5d37bb856c2925..f16ef4adf2dafbdfb2aa7061bdc653f151249f8d 100644
--- a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/enumTest.js
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/enumTest.js
@@ -14,12 +14,13 @@
*/
import userAuth from '@ohos.userIAM.userAuth'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-var index = require('../default/pages/index/index.js');
+var index = require('../MainAbility/pages/index/index.js');
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/**
* test case
*/
+export default function userAuthTestEnum() {
describe('userAuthTestEnum', function () {
beforeEach(function(done) {
let waitTime = 1000;
@@ -161,4 +162,5 @@ describe('userAuthTestEnum', function () {
expect(typeof userAuth.AuthenticationResult.GENERAL_ERROR !==undefined).assertTrue()
expect(userAuth.AuthenticationResult.GENERAL_ERROR).assertEqual(100)
})
-})
\ No newline at end of file
+})
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/execute.js b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/execute.js
similarity index 95%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/execute.js
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/execute.js
index 948e89560c8c1d9c43c8f24d96fd0353c0cb2107..3fb916a265366b0d93b750de5adf05e185b71865 100644
--- a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/test/execute.js
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/js/test/execute.js
@@ -14,13 +14,14 @@
*/
import userAuth from '@ohos.userIAM.userAuth'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-var index = require('../default/pages/index/index.js');
+var index = require('../MainAbility/pages/index/index.js');
var waitFlag = false;
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
/**
* test case
*/
+export default function AbilityDisable() {
describe('userAuthTestExecute', function () {
beforeEach(function(done) {
let waitTime = 1000;
@@ -120,3 +121,4 @@ describe('userAuthTestExecute', function () {
console.log("JSAPI_Function_Execute_2100 end");
})
})
+}
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/resources/base/element/string.json b/useriam/face_auth/js_api_test/function_test/userauth/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..6341f7fcb957820f746d6519613d61f84d5aa655
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/resources/base/element/string.json
@@ -0,0 +1,44 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Empty Ability"
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "label"
+ },
+ {
+ "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
diff --git a/useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/resources/base/media/icon.png b/useriam/face_auth/js_api_test/function_test/userauth/src/main/resources/base/media/icon.png
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauth/entry/src/main/js/resources/base/media/icon.png
rename to useriam/face_auth/js_api_test/function_test/userauth/src/main/resources/base/media/icon.png
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/BUILD.gn b/useriam/face_auth/js_api_test/function_test/userauthpart2/BUILD.gn
index e3eeb5921bcc60f2031ba6448f85d3948cc57cf5..4f839ab20e550c1f3d1999b8dfb757e2933c7526 100644
--- a/useriam/face_auth/js_api_test/function_test/userauthpart2/BUILD.gn
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/BUILD.gn
@@ -9,12 +9,12 @@
# 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.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsUserauthTwoTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsUserauthTwoTest") {
hap_name = "ActsUserauthTwoTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/Test.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/Test.json
index 1f6f0b2318934dbbf1c0ef07873dc451285fa2b4..b083f183ecf70caf109c0d0b1c0aca4d09a82fe8 100644
--- a/useriam/face_auth/js_api_test/function_test/userauthpart2/Test.json
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/Test.json
@@ -1,38 +1,39 @@
-{
- "description": "Configuration for hjunit demo Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "900000",
- "package": "com.example.myapplication101",
- "shell-timeout": "600000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsUserauthTwoTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- },
- {
- "type": "ShellKit",
- "run-command": [
- "remount",
- "mkdir /data/test"
- ]
- },
- {
- "type": "PushKit",
- "push": [
- "ActsUserauthTwoTest.hap->/data/test/ActsUserauthTwoTest.hap"
- ]
- },
- {
- "type": "ShellKit",
- "run-command": [
- "chmod 644 /data/test/*.hap",
- "chmod 777 -R data"
- ]
- }
- ]
-}
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "900000",
+ "shell-timeout": "900000",
+ "bundle-name": "com.example.myapplication101",
+ "package-name": "com.example.myapplication101"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsUserauthTwoTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "remount",
+ "mkdir /data/test"
+ ]
+ },
+ {
+ "type": "PushKit",
+ "push": [
+ "ActsUserauthTwoTest.hap->/data/test/ActsUserauthTwoTest.hap"
+ ]
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "chmod 644 /data/test/*.hap",
+ "chmod 777 -R data"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/config.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/config.json
deleted file mode 100644
index d87573df94a499a4806b7bc2939c086cd442550b..0000000000000000000000000000000000000000
--- a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/config.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.myapplication101",
- "vendor": "example",
- "version": {
- "code": 12,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.myapplication101",
- "name": ".MyApplication",
- "mainAbility": "com.example.myapplication101.MainAbility",
- "deviceType": [
- "phone",
- "tablet",
- "tv",
- "wearable"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": false
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.myapplication101.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "standard",
- "visible": true
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ],
- "reqPermissions": [
- {
- "name": "ohos.permission.ACCESS_BIOMETRIC"
- },
- {
- "name": "ohos.permission.USE_USER_IDM"
- },
- {
- "name": "ohos.permission.MANAGE_USER_IDM"
- },
- {
- "name": "ohos.permission.ACCESS_USER_AUTH_INTERNAL"
- },
- {
- "name": "ohos.permission.ACCESS_PIN_AUTH"
- }
- ]
- }
-}
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/pages/index/index.js b/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index 0676b40b1987e9c5e9d0d27b159bcc8cd197637c..0000000000000000000000000000000000000000
--- a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 {Core, ExpectExtend} from 'deccjsunit/index'
-import fileio from '@ohos.fileio'
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow start')
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
- const configService = core.getDefaultService('config')
- this.timeout = 35000;
- configService.setConfig(this)
- require('../../../test/List.test.js')
- core.execute()
- console.info('onShow end')
- },
- onReady() {
- },
-}
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/resources/base/element/string.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..0000000000000000000000000000000000000000
--- a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "entry_MainAbility"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/config.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..358611b8678dcebf5d97e5be5f22f9a751812770
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/config.json
@@ -0,0 +1,115 @@
+{
+ "app": {
+ "bundleName": "com.example.myapplication101",
+ "vendor": "example",
+ "version": {
+ "code": 12,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.myapplication101",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "deviceType": [
+ "phone",
+ "tablet",
+ "tv",
+ "wearable"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": true
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name": "ohos.permission.ACCESS_BIOMETRIC"
+ },
+ {
+ "name": "ohos.permission.USE_USER_IDM"
+ },
+ {
+ "name": "ohos.permission.MANAGE_USER_IDM"
+ },
+ {
+ "name": "ohos.permission.ACCESS_USER_AUTH_INTERNAL"
+ },
+ {
+ "name": "ohos.permission.ACCESS_PIN_AUTH"
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "srcPath": ""
+ }
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/app.js b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/app.js
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/app.js
rename to useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/app.js
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/i18n/en-US.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/i18n/en-US.json
rename to useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/i18n/en-US.json
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/i18n/zh-CN.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/i18n/zh-CN.json
rename to useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/pages/index/index.css b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/pages/index/index.css
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/pages/index/index.css
rename to useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/pages/index/index.css
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/pages/index/index.hml b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/default/pages/index/index.hml
rename to useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/pages/index/index.hml
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/pages/index/index.js b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..440a39998849bb21f637437dbb8a72910b72329b
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,30 @@
+/*
+ * 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 fileio from '@ohos.fileio'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow start')
+ },
+ onReady() {
+ },
+}
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/app.js b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/i18n/en-US.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/i18n/zh-CN.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.css b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.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
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.hml b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.js b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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');
+ }
+}
+
+
+
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/List.test.js b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/List.test.js
similarity index 80%
rename from useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/List.test.js
rename to useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/List.test.js
index 19131de468e419d41e29783e4b3714a318fc953f..62b597a384a7cd642fe0ba6caac34c76e6ba80f4 100644
--- a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/List.test.js
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/List.test.js
@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-require('./Security_IAM_PIN_Kit_CallbackJsunit.test.js')
-
+import userauthTest from './Security_IAM_PIN_Kit_CallbackJsunit.test.js'
+export default function testsuite() {
+ userauthTest()
+}
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
similarity index 96%
rename from useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
rename to useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
index 5d6e92b0c4280db1ad93159c9b7629289eb37ab5..7beb362d338e0ce455072eff8f1e8b538a234c0d 100644
--- a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
@@ -13,12 +13,13 @@
* limitations under the License.
*/
-import {describe, it, expect} from 'deccjsunit/index'
+import {describe, it, expect} from '@ohos/hypium'
import userAuthNorth from '@ohos.userIAM.userAuth'
let UserAuthKit = new userAuthNorth.UserAuth()
+export default function userauthTest() {
describe('userauthTest', function () {
/*
@@ -208,3 +209,4 @@ describe('userauthTest', function () {
})
+}
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/resources/base/element/string.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..8afb12da3b72e7b085a608d62d98beb65fe83030
--- /dev/null
+++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/resources/base/media/icon.png b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/resources/base/media/icon.png
similarity index 100%
rename from useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/resources/base/media/icon.png
rename to useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/resources/base/media/icon.png