1/*
2 * Copyright (c) 2021-2024 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 Core from './src/core';
17import {TestType, Size, Level, DEFAULT} from './src/Constant';
18import DataDriver from './src/module/config/DataDriver';
19import ExpectExtend from './src/module/assert/ExpectExtend';
20import OhReport from './src/module/report/OhReport';
21export { xdescribe, xit, describe, it } from './index.ts';
22
23export declare class Hypium {
24    static setData(data: Object): void
25    static setTimeConfig(systemTime: Object): void
26    static hypiumTest(abilityDelegator: Object, abilityDelegatorArguments: Object, testsuite: Function): void
27    static set(key: string, value: Object): void
28    static get(key: string): Object
29    static registerAssert(customAssertion: Function): void
30    static unregisterAssert(customAssertion: string | Function): void
31    static hypiumWorkerTest(abilityDelegator: Object, abilityDelegatorArguments: Object,
32                            testsuite: Function, workerPort: Object): void;
33    static hypiumInitWorkers(abilityDelegator: Object, scriptURL: string, workerNum: number, params: Object): void;
34}
35
36export {
37    Core,
38    DataDriver,
39    ExpectExtend,
40    OhReport,
41    TestType,
42    Size,
43    Level,
44    DEFAULT
45};
46
47type allExpectType = Object | undefined | null
48
49export declare function beforeItSpecified(testCaseNames: Array<string> | string, callback: Function): void
50
51export declare function afterItSpecified(testCaseNames: Array<string> | string, callback: Function): void
52
53export declare function beforeEach(callback: Function): void
54
55export declare function afterEach(callback: Function): void
56
57export declare function beforeAll(callback: Function): void
58
59export declare function afterAll(callback: Function): void
60
61export declare interface Assert {
62    assertClose(expectValue: number, precision: number): void
63    assertContain(expectValue: allExpectType): void
64    assertEqual(expectValue: allExpectType): void
65    assertFail(): void
66    assertFalse(): void
67    assertTrue(): void
68    assertInstanceOf(expectValue: string): void
69    assertLarger(expectValue: number): void
70    assertLess(expectValue: number): void
71    assertNull(): void
72    assertThrowError(expectValue: string | Function): void
73    assertUndefined(): void
74    assertLargerOrEqual(expectValue: number):void
75    assertLessOrEqual(expectValue: number):void
76    assertNaN():void
77    assertNegUnlimited(): void
78    assertPosUnlimited(): void
79    not(): Assert;
80    assertDeepEquals(expectValue: allExpectType):void
81    assertPromiseIsPending(): Promise<void>
82    assertPromiseIsRejected(): Promise<void>
83    assertPromiseIsRejectedWith(expectValue?: allExpectType): Promise<void>
84    assertPromiseIsRejectedWithError(...expectValue: allExpectType[]): Promise<void>
85    assertPromiseIsResolved(): Promise<void>
86    assertPromiseIsResolvedWith(expectValue?: allExpectType): Promise<void>
87    message(msg: string): Assert
88}
89
90export declare function expect(actualValue?: allExpectType): Assert
91
92export declare class ArgumentMatchers {
93    public static any: allExpectType;
94    public static anyString: string;
95    public static anyBoolean: Boolean;
96    public static anyNumber: Number;
97    public static anyObj: Object;
98    public static anyFunction: Function;
99    public static matchRegexs(regex: RegExp): void
100}
101
102declare interface whenResult {
103    afterReturn: (value: allExpectType) => allExpectType
104    afterReturnNothing: () => undefined
105    afterAction: (action: allExpectType) => allExpectType
106    afterThrow: (e_msg: string) => string
107}
108
109export declare function when(f:Function): (f?: allExpectType | void) => whenResult
110
111export declare interface VerificationMode {
112    times(count: Number): void
113    never(): void
114    once(): void
115    atLeast(count: Number): void
116    atMost(count: Number): void
117}
118
119export declare class MockKit {
120    constructor()
121    mockFunc(obj: Object, func: Function): Function
122    mockObject(obj: Object): Object
123    verify(methodName: String, argsArray: Array<allExpectType>): VerificationMode
124    ignoreMock(obj: Object, func: Function): void
125    clear(obj: Object): void
126    clearAll(): void
127}
128
129export declare class SysTestKit {
130    static getDescribeName(): string;
131    static getItName(): string;
132    static getItAttribute(): TestType | Size | Level
133    static actionStart(tag: string): void
134    static actionEnd(tag: string): void
135    static existKeyword(keyword: string, timeout?: number): boolean
136}
137
138