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

!2019 【location】增加rk3568 LBS测试用例

Merge pull request !2019 from 权力/myfeature1
...@@ -35,6 +35,21 @@ var WifiSecurityType = { ...@@ -35,6 +35,21 @@ var WifiSecurityType = {
WIFI_SEC_TYPE_SAE: 4, WIFI_SEC_TYPE_SAE: 4,
} }
var SuppState = {
DISCONNECTED: 0,
INTERFACE_DISABLED: 1,
INACTIVE : 2,
SCANNING: 3,
AUTHENTICATING: 4,
ASSOCIATING: 5,
ASSOCIATED: 6,
FOUR_WAY_HANDSHAKE: 7,
GROUP_HANDSHAKE: 8,
COMPLETED: 9,
UNINITIALIZED: 10,
INVALID: 11,
}
var wifiDeviceConfig = { var wifiDeviceConfig = {
"ssid": "TEST", "ssid": "TEST",
"bssid": "A1:B1:C1:D1:E1:F1", "bssid": "A1:B1:C1:D1:E1:F1",
...@@ -43,6 +58,17 @@ var wifiDeviceConfig = { ...@@ -43,6 +58,17 @@ var wifiDeviceConfig = {
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
} }
var ConnState = {
SCANNING: 0,
CONNECTING: 1,
AUTHENTICATING: 2,
OBTAINING_IPADDR: 3,
CONNECTED: 4,
DISCONNECTING: 5,
DISCONNECTED: 6,
UNKNOWN: 7,
}
var ipConfig = { var ipConfig = {
"ipAddress": 1284752956, "ipAddress": 1284752956,
"gateway": 17017024, "gateway": 17017024,
...@@ -352,7 +378,7 @@ describe('ACTS_WifiTest', function() { ...@@ -352,7 +378,7 @@ describe('ACTS_WifiTest', function() {
expect(true).assertEqual(netWorkId != -1); expect(true).assertEqual(netWorkId != -1);
console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId)); console.info("[wifi_test]connectdevice result: " + wifi.connectToNetwork(netWorkId));
expect(wifi.connectToNetwork(netWorkId)).assertTrue(); expect(wifi.connectToNetwork(netWorkId)).assertTrue();
console.info("[wifi_test] get empty linked information and getIpInfo."); console.info("[wifi_test] disableNetwork test start.");
var disconNet = wifi.disableNetwork(netWorkId); var disconNet = wifi.disableNetwork(netWorkId);
console.log("[wifi_test] wifi disableNetwork result: " + disconNet); console.log("[wifi_test] wifi disableNetwork result: " + disconNet);
expect(disconNet).assertTrue(); expect(disconNet).assertTrue();
...@@ -382,9 +408,33 @@ describe('ACTS_WifiTest', function() { ...@@ -382,9 +408,33 @@ describe('ACTS_WifiTest', function() {
}) })
/** /**
* @tc.number Info_0002 * @tc.number SUB_Communication_WiFi_Sta_info_0001
* @tc.name SUB_Communication_WiFi_Sta_Info_0002 * @tc.name testgetMacAddress
* @tc.desc Test get CountryCode * @tc.desc Test getMacAddress api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_info_0001', 0, function () {
if (!wifi.isWifiActive()) {
var enable = wifi.enableWifi();
sleep(3000);
expect(enable).assertTrue();
}
expect(wifi.isWifiActive()).assertTrue();
console.info('[wifi_test] getDeviceMacAddress test start ...');
var result = wifi.getDeviceMacAddress();
console.info("[wifi_test] getDeviceMacAddress -> " + JSON.stringify(result));
expect(true).assertEqual(result.length >= 1)
})
/**
* @tc.number SUB_Communication_WiFi_Sta_info_0002
* @tc.name testgetCountryCode
* @tc.desc Test getCountryCode api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/ */
it('SUB_Communication_WiFi_Sta_Info_0002', 0, function() { it('SUB_Communication_WiFi_Sta_Info_0002', 0, function() {
if (!wifi.isWifiActive()) { if (!wifi.isWifiActive()) {
...@@ -400,37 +450,84 @@ describe('ACTS_WifiTest', function() { ...@@ -400,37 +450,84 @@ describe('ACTS_WifiTest', function() {
}) })
/** /**
* @tc.number Config_0002 * @tc.number SUB_Communication_WiFi_Sta_info_0004
* @tc.name testFeatureSupported
* @tc.desc Test FeatureSupported api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_info_0004', 0, function () {
console.info('[wifi_test]FeatureSupported test start ...');
var result = wifi.getSupportedFeatures();
console.info("[wifi_test] getFeatureSupported -> " + JSON.stringify(result));
console.info("[wifi_test] isFeatureSupported: " + result +"->" + wifi.isFeatureSupported(result));
expect(wifi.isFeatureSupported(result)).assertTrue();
})
/**
* @tc.number Conn_Info_0001
* @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0001 * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0001
* @tc.desc Test cnnnection a PSK SecurityType wifi deviceconfig * @tc.desc Test reconnect wifi
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, async function() { it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, function () {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Config_0002]"); console.info("[wifi_test] wifi connectToDevice test.");
console.info("[wifi_test] create a PSK SecurityType wifi device config start.");
var wifiDeviceConfigConn = { var wifiDeviceConfigConn = {
"ssid": "TEST_CONN", "ssid": "TESTCONN",
"bssid": "", "bssid": "",
"preSharedKey": "12345678", "preSharedKey": "12345678",
"isHiddenSsid": false, "isHiddenSsid": false,
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
}; };
console.info("[wifi_test] check add device configs successfully "); var active = wifi.isWifiActive();
var configs = wifi.getDeviceConfigs(); sleep(3000);
console.info("[wifi_test] wifi getDeviceConfigs result1 : " + JSON.stringify(configs)); console.log("[wifi_test] wifi active result2: " + active);
console.info("[wifi_test] connect wifi start."); if(!active){
var conn1 = wifi.connectToDevice(wifiDeviceConfigConn); var enable = wifi.enableWifi();
expect(enable).assertTrue();
sleep(3000);
}
var result1 = wifi.connectToDevice(wifiDeviceConfigConn);
sleep(5000); sleep(5000);
console.log("[wifi_test] wifi Connected result: " + conn1); console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue();
console.info("[wifi_test] check isconnected wifi"); console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected(); var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected); console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse(); expect(isConnected).assertFalse();
wifi.getLinkedInfo((err, data) => { console.info("[wifi_test] reconnect wifi");
var result= wifi.reconnect();
sleep(5000);
console.log("[wifi_test] wifi reconnect result: " + result);
expect(result).assertTrue();
})
/**
* @tc.number conn_Config_0002
* @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0002
* @tc.desc Test getLinkedInfo information
*/
it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, async function(done) {
console.info("[wifi_test][SUB_Communication_WiFi_Sta_Conn_Info_0001]");
console.info(' console.info("[wifi_js] Wifi get link infos test[1]."');
wifi.getLinkedInfo()
.then((result) => {
console.info("[wifi_js] get wifi link [promise] -> " + JSON.stringify(result));
expect(JSON.stringify(result)).assertContain('band');
console.info("[wifi_js] get wifi link [promise].");
done();
}).catch((error) => {
console.info("[wifi_js] promise then error." + JSON.stringify(error));
expect().assertFail();
});
wifi.getLinkedInfo((err, result) => {
if (err) { if (err) {
return console.error('failed to get link infos callback because ' + JSON.stringify(err)); return console.error('failed to getlink infos callback because ' + JSON.stringify(err));
}else { }else {
console.info("[wifi_test] get wifi link [callback] -> " + JSON.stringify(data)); console.info("[wifi_test] get wifi link [callback] -> " + JSON.stringify(result));
for (var j = 0; j < JSON.stringify(data).length; ++j) { for (var j = 0; j < JSON.stringify(result).length; ++j) {
console.info("ssid: " + result[j].ssid); console.info("ssid: " + result[j].ssid);
console.info("bssid: " + result[j].bssid); console.info("bssid: " + result[j].bssid);
console.info("band: " + result[j].band); console.info("band: " + result[j].band);
...@@ -447,24 +544,38 @@ describe('ACTS_WifiTest', function() { ...@@ -447,24 +544,38 @@ describe('ACTS_WifiTest', function() {
console.info("suppState: " + result[j].suppState); console.info("suppState: " + result[j].suppState);
console.info("connState: " + result[j].connState); console.info("connState: " + result[j].connState);
} }
} }
done();
}); });
console.info("[wifi_test] get empty linked information and getIpInfo.");
var discon2 = wifi.disconnect();
console.log("[wifi_test] wifi disconnect result: " + discon2);
expect(discon2).assertTrue();
}) })
/** /**
* @tc.number Conn_Info_0002 * @tc.number Conn_Info_0003
* @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0002 * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0003
* @tc.desc Test get IpInfo information * @tc.desc Test get IpInfo information
*/ */
it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, function () { it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, function () {
console.info("[wifi_test] wifi connectToDevice test.");
var wifiDeviceConfigIp = {
"ssid": "TEST1",
"bssid": "",
"preSharedKey": "87654321",
"isHiddenSsid": "false",
"securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK,
};
var result1 = wifi.connectToDevice(wifiDeviceConfigIp);
sleep(5000);
console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue();
console.info("[wifi_test] check isconnected wifi");
var isConnected= wifi.isConnected();
console.log("[wifi_test] wifi isConnected result: " + isConnected);
expect(isConnected).assertFalse();
console.info("[wifi_test] reassociate wifi");
var result= wifi.reassociate();
sleep(5000);
console.log("[wifi_test] wifi reassociate result: " + result);
expect(result).assertTrue();
console.info("[wifi_test] get IpInfo."); console.info("[wifi_test] get IpInfo.");
var ipInfo = wifi.getIpInfo(); var ipInfo = wifi.getIpInfo();
console.info("[wifi_test] getIpInfo -> " + JSON.stringify(ipInfo)); console.info("[wifi_test] getIpInfo -> " + JSON.stringify(ipInfo));
...@@ -478,43 +589,6 @@ describe('ACTS_WifiTest', function() { ...@@ -478,43 +589,6 @@ describe('ACTS_WifiTest', function() {
console.info("serverIp: " + ipInfo.serverIp); console.info("serverIp: " + ipInfo.serverIp);
}) })
/**
* @tc.number SUB_Communication_WiFi_Sta_info_0004
* @tc.name testFeatureSupported
* @tc.desc Test FeatureSupported api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_info_0004', 0, function () {
console.info('[wifi_test]FeatureSupported test start ...');
var result = wifi.getSupportedFeatures();
console.info("[wifi_test] getFeatureSupported -> " + JSON.stringify(result));
console.info("[wifi_test] isFeatureSupported: " + result +"->" + wifi.isFeatureSupported(result));
expect(wifi.isFeatureSupported(result)).assertTrue();
})
/**
* @tc.number SUB_Communication_WiFi_Sta_info_0001
* @tc.name testgetMacAddress
* @tc.desc Test getMacAddress api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_Communication_WiFi_Sta_info_0001', 0, function () {
if (!wifi.isWifiActive()) {
var enable = wifi.enableWifi();
sleep(3000);
expect(enable).assertTrue();
}
expect(wifi.isWifiActive()).assertTrue();
console.info('[wifi_test] getDeviceMacAddress test start ...');
var result = wifi.getDeviceMacAddress();
console.info("[wifi_test] getDeviceMacAddress -> " + JSON.stringify(result));
expect(true).assertEqual(result.length >= 1)
})
/** /**
* @tc.number SUB_Communication_WiFi_Sta_ON_0001 * @tc.number SUB_Communication_WiFi_Sta_ON_0001
* @tc.name testwifiStateChangeOn * @tc.name testwifiStateChangeOn
...@@ -694,3 +768,4 @@ describe('ACTS_WifiTest', function() { ...@@ -694,3 +768,4 @@ describe('ACTS_WifiTest', function() {
console.log("*************[wifi_test] start wifi js unit test end*************"); console.log("*************[wifi_test] start wifi js unit test end*************");
}) })
# 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("//build/ohos_var.gni")
group("location") {
testonly = true
if (is_standard_system) {
deps = [ "geolocation_standard:ActslocationJsTest" ]
} else {
deps = [ "geolocation_standard:ActslocationJsTest" ]
}
}
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActslocationJsTest") {
hap_profile = "./src/main/config.json"
deps = [
":geolocation_js_assets",
":geolocation_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActslocationJSApiTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("geolocation_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("geolocation_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for geolocation js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "600000",
"package": "ohos.acts.location.geolocation.function",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActslocationJSApiTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "ohos.acts.location.geolocation.function",
"vendor": "acts",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.location.geolocation.function",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "ohos.acts.location.geolocation.function.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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, ExpectExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
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.
*/
require('./Geolocation.test.js')
{
"string": [
{
"name": "app_name",
"value": "OsAccountTest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
...@@ -39,6 +39,7 @@ _all_test_packages = [ ...@@ -39,6 +39,7 @@ _all_test_packages = [
"${ACTS_ROOT}/resourceschedule:resourceschedule", "${ACTS_ROOT}/resourceschedule:resourceschedule",
"${ACTS_ROOT}/telephony:telephony", "${ACTS_ROOT}/telephony:telephony",
"${ACTS_ROOT}/hiviewdfx:hiviewdfxtestacts", "${ACTS_ROOT}/hiviewdfx:hiviewdfxtestacts",
"${ACTS_ROOT}/location:location",
] ]
_all_test_packages_ivi = [ _all_test_packages_ivi = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册