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 Want from '@ohos.app.ability.Want';
20
21const delegator = abilityDelegatorRegistry.getAbilityDelegator();
22const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
23
24const delayTime: number = 1000;
25
26export default function FaceFingerFailTest() {
27  describe('FaceFingerFailTest', () => {
28    beforeAll(async () => {
29      const data = {
30        "cmd": [{
31          "event": "CMD_NOTIFY_AUTH_START", "payload": {
32            "lockoutDuration": 1111111, "remainAttempts": 0, "type": "face"
33          }, "version": "1"
34        }, {
35          "event": "CMD_NOTIFY_AUTH_START", "payload": {
36            "lockoutDuration": 111110,
37            "remainAttempts": 0,
38            "sensorInfo": "{\"sensorType\":\"SensorType1\",\"udSensorCenterXInThousandth\":500,\"udSensorCenterYInThousandth\":500,\"udSensorRadiusInPx\":30}",
39            "type": "fingerprint"
40          }, "version": "1"
41        }],
42        "pinSubType": "PIN_SIX",
43        "title": "",
44        "type": ["face", "fingerprint"],
45        "widgetContextId": 7728484037972500000,
46        "windowModeType": "DIALOG_BOX"
47      }
48
49      let want: Want = {
50        bundleName: bundleName,
51        abilityName: 'FaceMixTimesAbility',
52        parameters: {
53          useriamCmdData: data
54        }
55      }
56      await delegator.startAbility(want);
57    })
58
59    it('cancelImg_allFaceAuth_test', 0, async (done: Function) => {
60      let driver = Driver.create();
61      await driver.delayMs(delayTime);
62      await driver.findComponent(ON.id('cancelImgAllFaceAuth'));
63      expect(true).assertTrue();
64      done();
65    })
66  })
67}