提交 862d1964 编写于 作者: D du-zhihai

continuationManager测试套添加自动点击授权

Signed-off-by: Ndu-zhihai <duzhihai@huawei.com>
Change-Id: If0fa02a4cee8cd0487473836e7c0cabb722591dd
上级 d2662917
......@@ -17,6 +17,19 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
import featureAbility from '@ohos.ability.featureAbility';
async function requestPermission() {
try {
let context = featureAbility.getContext();
await context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, (data) => {
console.info('TestApplication requestPermission data: ' + JSON.stringify(data));
});
} catch (err) {
console.error('TestApplication permission' + JSON.stringify(err));
}
}
export default {
onCreate() {
console.info('TestApplication onCreate')
......@@ -24,6 +37,7 @@ export default {
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
requestPermission()
},
onDestroy() {
console.info("TestApplication onDestroy");
......
......@@ -13,6 +13,7 @@
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { UiDriver, BY } from '@ohos.uitest'
import continuationManager from '@ohos.continuation.continuationManager';
const TEST_DEVICE_ID = "test_deviceId";
......@@ -24,6 +25,26 @@ describe('continuationManagerTest', function() {
beforeAll(async function (done) {
console.info('beforeAll');
var driver = UiDriver.create()
await driver.delayMs(2000);
var data_sync_allow = await driver.findComponent(BY.text("允许"))
await driver.delayMs(1000)
var wait_count = 0
while (data_sync_allow == null || data_sync_allow == undefined) {
data_sync_allow = await driver.findComponent(BY.text("允许"))
wait_count += 1
await driver.delayMs(1000)
if (wait_count == 3) {
break
}
}
if (data_sync_allow == null) {
console.info('应用非首次开启')
} else {
await data_sync_allow.click()
console.log('点击多设备授权框的允许按钮')
}
done();
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册