1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License") 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { Driver, ON } from '@ohos.UiTest'; 17import { beforeAll, describe, expect, it } from '@ohos/hypium'; 18import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; 19import { WantParams } from '../../../../main/ets/common/vm/Constants'; 20import Want from '@ohos.app.ability.Want'; 21 22const delegator = abilityDelegatorRegistry.getAbilityDelegator(); 23const bundleName = abilityDelegatorRegistry.getArguments().bundleName; 24 25const delayTime: number = 1000; 26 27export default function PinTest() { 28 describe('PinTest', () => { 29 beforeAll(async () => { 30 const data: WantParams = { 31 "cmd": [{ 32 "event": "CMD_NOTIFY_AUTH_START", 33 "payload": { 34 "lockoutDuration": 1123, 35 "remainAttempts": 0, 36 "type": "pin", 37 "result": 1, 38 }, 39 }], 40 "pinSubType": "PIN_SIX", 41 "title": "", 42 "type": ["pin"], 43 "widgetContextId": 17202660292065450000, 44 "windowModeType": "DIALOG_BOX" 45 } 46 47 let want: Want = { 48 bundleName: bundleName, 49 abilityName: "PasswordSixAbility", 50 parameters: { 51 useriamCmdData: data 52 } 53 } 54 await delegator.startAbility(want); 55 }) 56 57 it('pinSix_test', 0, async (done: Function) => { 58 let driver = Driver.create(); 59 await driver.delayMs(delayTime); 60 await driver.findComponent(ON.id('pinSix')); 61 expect(true).assertTrue(); 62 done(); 63 }) 64 65 it('cancelBtn_dialog_sixPwd_test', 0, async (done: Function) => { 66 let driver = Driver.create(); 67 await driver.delayMs(delayTime); 68 await driver.findComponent(ON.id('cancelBtnDialogSixPwd')); 69 expect(true).assertTrue(); 70 done(); 71 }) 72 }) 73}