Skip to content

Commit 5be160d

Browse files
author
guomingliang
committed
fix:更新d.ts到4.1.0
1 parent b67ca84 commit 5be160d

18 files changed

+296
-31
lines changed

other/hbuilderx-autotest/common/git.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { SimpleGit } from 'simple-git';
2+
/**
3+
* 基于simple-git封装的git操作
4+
*/
25
export default class Git {
36
private options;
47
private localDir;

other/hbuilderx-autotest/common/utils.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export declare const getInitTestFile: (fileOrProjectKey: string) => string;
44
export declare const sleep: (time?: number) => Promise<unknown>;
55
export declare const getTmpdir: (time?: number) => string;
66
export declare const isWin: () => boolean;
7+
export declare const isMac: () => boolean;
8+
export declare const getTaskPlatform: () => string;
79
export declare const getPlatform: () => string;
810
export declare const generateCode: (file: any, recordOpt: any) => string;
911
export declare const requireFunc: any;

other/hbuilderx-autotest/core/autotest.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ export interface AutoTestAutoEditCase extends AutoTestCase<AutoEditExpect> {
4747
input: string;
4848
}
4949
export interface DefinitionExpect {
50+
continueAfterjumping: any;
5051
uri: string;
5152
line: string | RegExp;
5253
cursor?: number;
5354
}
5455
export interface AutoTestDefinitionCase extends AutoTestCase<DefinitionExpect> {
5556
kind: 'definition';
57+
continueAfterjumping?: boolean;
5658
range: Range;
5759
}
5860
export interface HoverExpect {
@@ -82,6 +84,22 @@ export interface AutoTestOutlineCase extends AutoTestCase<OutlineExpect> {
8284
programData: string;
8385
programPlugin: string;
8486
}
87+
export interface FoldExpect {
88+
filePath: string;
89+
}
90+
export interface AutoTestFoldCase extends AutoTestCase<FoldExpect> {
91+
kind: 'fold';
92+
needCreate?: boolean;
93+
project: string;
94+
lsDir: string;
95+
programData: string;
96+
programPlugin: string;
97+
}
98+
export interface OpenFileExpect {
99+
uri: string;
100+
}
101+
export interface AutoTestOpenFileCase extends AutoTestCase<OpenFileExpect> {
102+
}
85103
export interface ReferencesExpect {
86104
filePath: string;
87105
}

other/hbuilderx-autotest/core/caseHandler.d.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AutoTestCheckEditorCase, AutoTestCompletionCase, AutoTestDbClickCase, AutoTestDefinitionCase, AutoTestHoverCase, AutoTestKeybindCase, AutoTestOutlineCase, AutoTestPerformanceCase, AutoTestReferencesCase } from './autotest';
1+
import { AutoTestCheckEditorCase, AutoTestCompletionCase, AutoTestDbClickCase, AutoTestDefinitionCase, AutoTestFoldCase, AutoTestHoverCase, AutoTestKeybindCase, AutoTestOpenFileCase, AutoTestOutlineCase, AutoTestPerformanceCase, AutoTestReferencesCase } from './autotest';
22
import { Editor } from './editor';
33
declare function runDbClickCase(test: AutoTestDbClickCase, editor: Editor): Promise<({
44
casename: string;
@@ -11,7 +11,7 @@ declare function runDbClickCase(test: AutoTestDbClickCase, editor: Editor): Prom
1111
})[]>;
1212
declare function runCompletionCase(test: AutoTestCompletionCase, editor: Editor, config?: any): Promise<any[]>;
1313
declare function runKeybindCase(test: AutoTestKeybindCase, editor: Editor): Promise<any[]>;
14-
declare function runDefinitionCase(test: AutoTestDefinitionCase, editor: Editor): Promise<({
14+
declare function runDefinitionCase(test: AutoTestDefinitionCase, editor: Editor, config?: any): Promise<({
1515
casename: string;
1616
passed: boolean;
1717
message: string;
@@ -41,5 +41,18 @@ declare function runPerformanceCase(test: AutoTestPerformanceCase, editor: Edito
4141
timer?: undefined;
4242
})[]>;
4343
declare function runOutlineCase(test: AutoTestOutlineCase, editor: Editor): Promise<any[]>;
44+
declare function runFoldCase(test: AutoTestFoldCase, editor: Editor): Promise<any[]>;
4445
declare function runReferencesCase(test: AutoTestReferencesCase, editor: Editor): Promise<any[]>;
45-
export { runCheckEditor, runCompletionCase, runDbClickCase, runDefinitionCase, runErrorCase, runHoverCase, runKeybindCase, runNoErrorCase, runOutlineCase, runPerformanceCase, runReferencesCase };
46+
declare function runTypeAheadCase(test: AutoTestCompletionCase, editor: Editor): Promise<void>;
47+
declare function runOpenFileCase(test: AutoTestOpenFileCase, config?: any): Promise<({
48+
casename: string;
49+
passed: boolean;
50+
message: string;
51+
context: any;
52+
} | {
53+
casename: string;
54+
passed: boolean;
55+
context: any;
56+
message?: undefined;
57+
})[]>;
58+
export { runCheckEditor, runCompletionCase, runDbClickCase, runDefinitionCase, runErrorCase, runFoldCase, runHoverCase, runKeybindCase, runNoErrorCase, runOpenFileCase, runOutlineCase, runPerformanceCase, runReferencesCase, runTypeAheadCase };
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { AutoTestFoldCase } from '../autotest';
2+
import { Editor, FoldData } from '../editor';
3+
import { HBuilderX } from '../hxdriver';
4+
import { TreeItem } from '../treeItem';
5+
declare class Fold {
6+
readonly hx: HBuilderX;
7+
protected treeItem: TreeItem;
8+
constructor(hx: HBuilderX);
9+
private getFilePath;
10+
/**
11+
* 获取折叠文件数据
12+
*/
13+
private getFoldFileData;
14+
/**
15+
* 对比结果
16+
*/
17+
comparativeData(mainData: FoldData, targetData: FoldData): Promise<string>;
18+
/**
19+
* 执行测试用例
20+
*/
21+
runFoldCase(test: AutoTestFoldCase, editor: Editor): Promise<any[]>;
22+
}
23+
export { Fold };

other/hbuilderx-autotest/core/caseHandler/outline.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ declare class Outline {
1818
/**
1919
* 处理点击跳转
2020
*/
21-
doTreeItemJump(test: AutoTestOutlineCase, jsonData: TreeItemInfo, filePath: string, title: string, result: any[]): Promise<void>;
21+
doTreeItemJump(test: AutoTestOutlineCase, jsonData: TreeItemInfo, filePath: string, title: string, needCreate: boolean, result: any[]): Promise<void>;
2222
/**
2323
* 执行大纲测试用例
2424
*/

other/hbuilderx-autotest/core/caseHandler/references.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ declare class References {
1818
/**
1919
* 处理点击跳转
2020
*/
21-
doTreeItemJump(test: AutoTestReferencesCase, jsonData: TreeItemInfo, filePath: string, title: string, result: any[]): Promise<void>;
21+
doTreeItemJump(test: AutoTestReferencesCase, jsonData: TreeItemInfo, filePath: string, title: string, needCreate: boolean, result: any[]): Promise<void>;
2222
/**
2323
* 执行查找引用测试用例
2424
* @param test

other/hbuilderx-autotest/core/editor.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ export interface DefinitionResult {
1212
range: Range;
1313
editor: Editor;
1414
}
15+
export interface FoldData {
16+
[line: string]: number;
17+
}
1518
export interface TextDocument extends FullTextDocument {
1619
lineAt(line: number): TextDocumentLine;
1720
getText(range?: Range): string;
@@ -38,14 +41,15 @@ export declare class Editor {
3841
applyCompletion(index: number): Promise<void>;
3942
functionSignatures(range: Range): Promise<string>;
4043
hxSleep(ms: number): Promise<unknown>;
41-
hover(range: Range): Promise<string>;
44+
hover(range: Range, content?: string): Promise<string>;
4245
grammarRrror(range: Range): Promise<string>;
4346
gotoDefinition(range: Range): Promise<DefinitionResult>;
4447
/**
4548
* 触发大纲, 获取大纲结果
4649
*/
4750
outline(): Promise<TreeItemInfo | undefined>;
4851
closeOutline(): Promise<void>;
52+
getFoldData(): Promise<FoldData | undefined>;
4953
/**
5054
* 获取查找引用结果
5155
* @param range

other/hbuilderx-autotest/core/expect.d.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/**
2+
* 断言目标数据包含在源数据中
3+
* @param {string} casename
4+
* @param {string[]} targetArray
5+
* @param {string[]} includeArray
6+
* @return
7+
*/
18
declare function expectArrayIncludes(casename: string, targetArray: string[], includeArray: string[]): {
29
casename: string;
310
passed: boolean;
@@ -7,6 +14,13 @@ declare function expectArrayIncludes(casename: string, targetArray: string[], in
714
passed: boolean;
815
message?: undefined;
916
};
17+
/**
18+
* 断言目标数据不包含在源数据中
19+
* @param {string} casename
20+
* @param {string[]} targetArray
21+
* @param {string[]} excludeArray
22+
* @return
23+
*/
1024
declare function expectArrayExcludes(casename: string, targetArray: string[], excludeArray: string[]): {
1125
casename: string;
1226
passed: boolean;
@@ -16,6 +30,13 @@ declare function expectArrayExcludes(casename: string, targetArray: string[], ex
1630
passed: boolean;
1731
message?: undefined;
1832
};
33+
/**
34+
* 断言两个值是否相等
35+
* @param {string} casename
36+
* @param {any} target
37+
* @param {any} expect
38+
* @return
39+
*/
1940
declare function expectEquals(casename: string, target: any, expect: any): {
2041
casename: string;
2142
passed: boolean;
@@ -25,6 +46,13 @@ declare function expectEquals(casename: string, target: any, expect: any): {
2546
passed: boolean;
2647
message?: undefined;
2748
};
49+
/**
50+
* 断言是否匹配,通过正则匹配值
51+
* @param {string} casename
52+
* @param {string} target
53+
* @param {RegExp} expect
54+
* @return
55+
*/
2856
declare function expectMatches(casename: string, target: string, expect: RegExp): {
2957
casename: string;
3058
passed: boolean;
@@ -34,6 +62,13 @@ declare function expectMatches(casename: string, target: string, expect: RegExp)
3462
passed: boolean;
3563
message?: undefined;
3664
};
65+
/**
66+
* 断言值是否为真
67+
* @param {string} casename
68+
* @param {boolean} value
69+
* @param {any} context
70+
* @return
71+
*/
3772
declare function expectTrue(casename: string, value: boolean, context?: any): {
3873
casename: string;
3974
passed: boolean;

other/hbuilderx-autotest/core/hxdriver.d.ts

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface SelectorItem {
2424
interface HBuilderOption {
2525
program: string;
2626
args: string[];
27+
platform?: string;
2728
env?: any;
2829
}
2930
/**
@@ -44,59 +45,148 @@ export declare class HBuilderX {
4445
private program;
4546
private fakeDriver;
4647
private peocess;
48+
private platform;
4749
applicationActive: boolean;
4850
constructor(option: HBuilderOption);
51+
/**
52+
* 获取当前启动程序
53+
*/
4954
getProgram(): string;
55+
/**
56+
* 获取当前启动程序的cli
57+
*/
58+
getCliProgram(): string;
59+
/**
60+
* 获取当前启动程序的env
61+
*/
5062
getEnv(): any;
63+
/**
64+
* 检验通讯链接状态
65+
*/
5166
private checkConnection;
67+
/**
68+
* 执行command
69+
*/
5270
executeCommand(command: string, commandArgs?: any): Promise<unknown>;
71+
/**
72+
* 发送request
73+
*/
5374
request(key: string, params: Record<string, any>): Promise<unknown>;
75+
/**
76+
* 关闭测试实例
77+
*/
5478
waitForClose(): Promise<void>;
79+
/**
80+
* delay方法
81+
*/
5582
delay<T>(delay: number, fn?: () => Promise<T>): Promise<T>;
83+
/**
84+
* 关闭测试实例,和waitForClose类似
85+
*/
5686
hxClose(): void;
87+
/**
88+
* 判断测试实例是否已关闭
89+
*/
5790
hxClosed(): boolean;
91+
/**
92+
* 等待测试实例启动并建立通讯完成
93+
*/
5894
waitForStartAndConnect(): Promise<void>;
95+
/**
96+
* 获取当前Windows的列表
97+
*/
5998
getWindowsIds(): Promise<number[]>;
99+
/**
100+
* 获取当前激活的Windows
101+
*/
60102
getActiveWindowId(): Promise<number>;
103+
/**
104+
* 对当前界面做截图
105+
*/
61106
capturePage(output: string, selector: string, windowId?: number): Promise<string>;
107+
/**
108+
* 执行指定的快捷键
109+
*/
62110
dispatchKeybinding(keybinding: string, selector?: string, windowId?: number, useCommandOnWindows?: boolean): Promise<void>;
63111
/**
64-
* xy不传,默认是选中控件的中心
112+
* 等待点击(点击)操作完成,不等待点击的后续任务是否执行,xy不传,默认是选中控件的中心
65113
*/
66114
waitAndClick(selector: string, xy?: {
67115
x: number;
68116
y: number;
69117
}, tryCount?: number): Promise<void>;
70118
/**
71-
* xy不传,默认是选中控件的中心
119+
* 等待点击(双击)操作完成,不等待点击的后续任务是否执行,xy不传,默认是选中控件的中心
72120
*/
73121
waitAndDbClick(selector: string, xy?: {
74122
x: number;
75123
y: number;
76124
}): Promise<void | undefined>;
77125
/**
78-
* xy不传,默认是选中控件的中心
126+
* 等待点击(右键单击)操作完成,不等待点击的后续任务是否执行,xy不传,默认是选中控件的中心
79127
*/
80128
waitAndRightClick(selector: string, xy?: {
81129
x: number;
82130
y: number;
83131
}, keyModifier?: string): Promise<void | undefined>;
132+
/**
133+
* 移动鼠标到指定位置,xy不传,默认是选中控件的中心
134+
*/
84135
waitForMouseMove(selector: string, xy: {
85136
x: number;
86137
y: number;
87138
}): Promise<void | undefined>;
139+
/**
140+
* 在指定的元素上输入指定的内容
141+
*/
88142
waitForTypeInElement(selector: string, input: string): Promise<void | undefined>;
143+
/**
144+
* 获取指定元素上的Content属性的值
145+
*/
89146
waitForTextContent(selector: string, acceptFn?: (text: string) => boolean, tryCount?: number): Promise<string>;
147+
/**
148+
* 获取指定选择器的第一个元素,必须是激活的状态
149+
*/
90150
waitForActiveElement(selector: string, tryCount?: number): Promise<IElement>;
151+
/**
152+
* 获取指定选择器的第全部元素
153+
*/
91154
waitForElements(selector: string, tryCount?: number): Promise<IElement[]>;
155+
/**
156+
* 获取指定选择器的第一个元素
157+
*/
92158
waitForElement(selector: string, tryCount?: number): Promise<IElement | undefined>;
159+
/**
160+
* 获取指定选择器指定属性,返回的是全部元素
161+
*/
93162
waitForElementsWithAttrs(selector: string, containAttributes?: string[], tryCount?: number): Promise<IElement[]>;
163+
/**
164+
* 获取指定选择器指定属性,返回的是第一个元素
165+
*/
94166
waitForElementWithAttrs(selector: string, containAttributes?: string[], tryCount?: number): Promise<IElement | undefined>;
167+
/**
168+
* 指定元素设置属性值
169+
*/
95170
waitForSetValue(selector: string, property: string, value: any): Promise<void | undefined>;
171+
/**
172+
* 指定元素获取属性值
173+
*/
96174
waitForGetValue(selector: string, property: string, tryCount?: number): Promise<any>;
175+
/**
176+
* 启动录制
177+
*/
97178
startRecording(path?: string, detail?: boolean): Promise<void | undefined>;
179+
/**
180+
* 停止录制
181+
*/
98182
stopRecording(): Promise<any>;
99-
importPlugins(name: string): Promise<void>;
183+
/**
184+
* 通过插件名称,导入插件市场的插件
185+
*/
186+
importPlugins(name: string, installed: boolean | undefined, dirName: string): Promise<boolean>;
187+
/**
188+
* 等待重启hx
189+
*/
100190
withRestart(call: Function): Promise<void>;
101191
}
102192
export {};

0 commit comments

Comments
 (0)