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

!4352 modified FA-JS PART8

Merge pull request !4352 from jiyong/local-20220716-0003
......@@ -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" ]
......
{
"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
{
"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
/*
* 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 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');
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* Copyright (C) 2021 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
/*
* 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();
}
});
});
}
/*
* 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 FileIOError from './FileIOError.test.js'
export default function testsuite() {
FileIOError()
}
{
"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
......@@ -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" ]
......
{
"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
{
"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
/*
* 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* Copyright (C) 2021 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
/*
* 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 securitylabel from './securitylabel.test.js'
export default function testsuite() {
securitylabel()
}
{
"string": [
{
"name": "app_name",
"value": "Storagesecuritylabeljstest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
{
"string": [
{
"name": "app_name",
"value": "Storagesecuritylabeljstest"
},
{
"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
......@@ -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("storagestatfs_js_test") {
hap_name = "ActsStorageStatfsJsTest"
}
ohos_js_assets("storagestatfs_js_assets") {
source_dir = "./src/main/js/default"
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("storagestatfs_js_resources") {
sources = [ "./src/main/resources" ]
......
{
"description": "Configuration for storage statfs Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "ohos.acts.storage.statfs",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsStorageStatfsJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
{
"description": "Configuration for storage statfs Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "60000",
"shell-timeout": "60000",
"bundle-name": "ohos.acts.storage.statfs",
"package-name": "ohos.acts.storage.statfs"
},
"kits": [
{
"test-file-name": [
"ActsStorageStatfsJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.acts.storage.statfs",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.storage.statfs",
"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.statfs.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.statfs",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.storage.statfs",
"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
/*
* 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* Copyright (C) 2021 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
/*
* 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_test from './statfs.test.js'
export default function testsuite() {
statfs_test()
}
/*
* 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_test() {
describe('statfs_test', 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();
}
});
});
}
{
"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
......@@ -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"
}
{
"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
{
"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"
}
]
}
}
{
"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
}
}
],
"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
/*
* 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");
}
};
/*
* 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');
},
}
/*
* 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');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* Copyright (c) 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 userAuthTestExecute from './execute.js'
import userAuthTestEnum from './enumTest.js'
export default function testsuite() {
userAuthTestEnum()
userAuthTestExecute()
}
......@@ -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
......@@ -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 userAuthTestExecute() {
describe('userAuthTestExecute', function () {
beforeEach(function(done) {
let waitTime = 1000;
......@@ -120,3 +121,4 @@ describe('userAuthTestExecute', function () {
console.log("JSAPI_Function_Execute_2100 end");
})
})
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"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
......@@ -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"
}
{
"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
{
"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"
}
]
}
}
/*
* 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() {
},
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
{
"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
/*
* 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() {
},
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册