-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
guomingliang
committed
Nov 13, 2024
1 parent
a37726c
commit 133c72b
Showing
43 changed files
with
1,128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @description 获取HBuilderX数据目录 | ||
* @returns | ||
*/ | ||
export declare const hxAppDataDir: () => string; | ||
/** | ||
* @description 获取HBuilderX .log文件路径 | ||
* @returns | ||
*/ | ||
export declare const getHXLogFile: () => string; | ||
/** | ||
* @description 获取HBuilderX autosaves文件路径 | ||
* @returns | ||
*/ | ||
export declare const clearHXAutosavesPath: () => Promise<void>; | ||
/** | ||
* @description 清空HBuilderX数据目录.log文件 | ||
*/ | ||
export declare const clearHXLogFile: () => void; | ||
/** | ||
* @description 格式化【测试用例文件】字符串 | ||
* @param openfile | ||
* @returns | ||
*/ | ||
export declare const format_str_case_file: (openfile: string) => string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare const setContext: (c: Record<any, any>) => void; | ||
export declare const getContext: () => Record<any, any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare function installProjectModule(projectDir: string): Promise<void>; | ||
export declare function runScript(projectDir: string, scriptName: string): Promise<void>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { SimpleGit } from 'simple-git'; | ||
export default class Git { | ||
private options; | ||
private localDir; | ||
private url; | ||
private gitExample; | ||
constructor(localDir: string, url: string); | ||
get git(): SimpleGit; | ||
clone(): Promise<void>; | ||
status(): Promise<void>; | ||
clean(): Promise<void>; | ||
reset(): Promise<void>; | ||
checkout(branch?: string): Promise<void>; | ||
pull(): Promise<void>; | ||
fetch(): Promise<void>; | ||
resetCodeToLatestByBranch(branch?: string): Promise<void>; | ||
checkIfRepoHasUpdates(): Promise<boolean>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export declare function getLocalIP(): string; | ||
export declare function purgeCache(moduleName: string): any; | ||
export declare const getInitTestFile: (fileOrProjectKey: string) => string; | ||
export declare const sleep: (time?: number) => Promise<unknown>; | ||
export declare const getTmpdir: (time?: number) => string; | ||
export declare const isWin: () => boolean; | ||
export declare const getPlatform: () => string; | ||
export declare const generateCode: (file: any, recordOpt: any) => string; | ||
export declare const requireFunc: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as convict from 'convict'; | ||
declare const config: convict.Config<{ | ||
dev: string; | ||
alpha: string; | ||
release: string; | ||
testsStorage: string; | ||
lsTestsStorage: string; | ||
lsTestReportDir: string; | ||
hxMarketPLuginDir: string; | ||
mountSmbfs: string; | ||
tagrelease: string; | ||
tagdev: string; | ||
tagalpha: string; | ||
autoUpdate: boolean; | ||
mainStorage: string; | ||
}>; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default class Assert { | ||
private res; | ||
private file; | ||
constructor(file: string); | ||
expectArrayIncludes(casename: string, targetArray: string[], includeArray: string[]): void; | ||
expectEquals(casename: string, target: any, expect: any): void; | ||
expectMatches(casename: string, target: string, expect: RegExp): void; | ||
expectTrue(casename: string, value: boolean, context?: any): void; | ||
get result(): { | ||
count: number; | ||
caseFail: any[]; | ||
cassAll: any[]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
import { Position, Range } from 'vscode-languageserver'; | ||
import { Editor, TextDocument } from './editor'; | ||
export interface AutoTestCase<T> { | ||
kind: string; | ||
title: string; | ||
tag?: string; | ||
expect: T; | ||
error?: { | ||
message: string; | ||
cause: string; | ||
}; | ||
} | ||
export interface KeybindingExpect { | ||
/** | ||
* apply之后对应的函内容匹配 | ||
*/ | ||
lines: string[] | RegExp[]; | ||
/** | ||
* apply之后对应的光标位置 | ||
*/ | ||
cursor?: Position; | ||
} | ||
export interface AutoTestKeybindCase extends AutoTestCase<KeybindingExpect> { | ||
kind: 'keybind'; | ||
range: Range; | ||
input: string; | ||
typeInNewLine?: boolean; | ||
keybind: string; | ||
} | ||
export interface AutoTestCheckEditorCase extends AutoTestCase<KeybindingExpect> { | ||
kind: 'checkEditor'; | ||
} | ||
export interface AutoEditExpect { | ||
/** | ||
* apply之后对应的函内容匹配 | ||
*/ | ||
lines: string[] | RegExp[]; | ||
/** | ||
* apply之后对应的光标位置 | ||
*/ | ||
cursor?: Position; | ||
} | ||
export interface AutoTestAutoEditCase extends AutoTestCase<AutoEditExpect> { | ||
kind: 'autoedit'; | ||
range: Range; | ||
typeInNewLine?: boolean; | ||
input: string; | ||
} | ||
export interface DefinitionExpect { | ||
uri: string; | ||
line: string | RegExp; | ||
cursor?: number; | ||
} | ||
export interface AutoTestDefinitionCase extends AutoTestCase<DefinitionExpect> { | ||
kind: 'definition'; | ||
range: Range; | ||
} | ||
export interface HoverExpect { | ||
/** | ||
* hover的内容 | ||
*/ | ||
content: string | RegExp; | ||
/** | ||
* 是否支持F1打开帮助文档 | ||
*/ | ||
supportF1?: boolean; | ||
} | ||
export interface AutoTestHoverCase extends AutoTestCase<HoverExpect> { | ||
kind: 'hover' | 'noerror' | 'error'; | ||
range: Range; | ||
docOffsetAt: number; | ||
type: 'string'; | ||
} | ||
export interface OutlineExpect { | ||
filePath: string; | ||
} | ||
export interface AutoTestOutlineCase extends AutoTestCase<OutlineExpect> { | ||
kind: 'outline'; | ||
needCreate?: boolean; | ||
project: string; | ||
lsDir: string; | ||
programData: string; | ||
programPlugin: string; | ||
} | ||
export interface ReferencesExpect { | ||
filePath: string; | ||
} | ||
export interface AutoTestReferencesCase extends AutoTestCase<ReferencesExpect> { | ||
kind: 'references'; | ||
needCreate?: boolean; | ||
range: Range; | ||
docOffsetAt: number; | ||
project: string; | ||
lsDir: string; | ||
programData: string; | ||
programPlugin: string; | ||
} | ||
export interface ErrorExpect { | ||
content: string | RegExp; | ||
} | ||
export interface CompletionExpect { | ||
/** | ||
* 代码助手列表项 | ||
*/ | ||
items: string[]; | ||
/** | ||
* 代码助手列表项-不能包含项 | ||
*/ | ||
excludeItems: string[]; | ||
/** | ||
* apply之后对应的函内容匹配 | ||
*/ | ||
lines: string[] | RegExp[]; | ||
/** | ||
* apply之后对应的光标位置 | ||
*/ | ||
cursor?: Position; | ||
/** | ||
* apply的item的详细信息 | ||
*/ | ||
detail?: string | RegExp; | ||
} | ||
export interface AutoTestCompletionCase extends AutoTestCase<CompletionExpect> { | ||
kind: 'completion' | 'init'; | ||
/** | ||
* 是否在新的一行写,如为true,则会在range位置回车后开始写 | ||
*/ | ||
typeInNewLine?: boolean; | ||
/** | ||
* 要输入的位置 | ||
*/ | ||
range: Range; | ||
/** | ||
* 要输入的文字 | ||
*/ | ||
input: string; | ||
/** | ||
* 选择哪一项,默认是第一项。下标从`0`开始 | ||
*/ | ||
applyIndex?: number; | ||
} | ||
export interface AutoTestDbClickCase extends AutoTestCase<DbClickExpect> { | ||
kind: 'dbclick'; | ||
range: Range; | ||
} | ||
export interface DbClickExpect { | ||
begin: string; | ||
end: string; | ||
match: string; | ||
} | ||
export interface PerformanceExpect { | ||
expect: AutoTestDefinitionCase | AutoTestHoverCase | AutoTestCompletionCase; | ||
} | ||
export interface AutoTestPerformanceCase extends AutoTestCase<PerformanceExpect> { | ||
kind: 'performance'; | ||
type: string; | ||
num: number; | ||
timer: number; | ||
range: Range; | ||
} | ||
interface TestCaseResult { | ||
casename: string; | ||
passed: boolean; | ||
message?: string; | ||
filePath?: string; | ||
} | ||
export declare function getTestMergedResults(testResults: TestCaseResult[], project_name: string, autotestOptions: any): unknown[]; | ||
export declare function generateTestReport(testResults: TestCaseResult[], testBaseInfo: any, allCase: number): any; | ||
export declare function matchTestcaseContent(line: string): string | undefined; | ||
export declare function scan(doc: TextDocument, project: string, config: any, range?: { | ||
startLine: number; | ||
endLine: number; | ||
}): AutoTestCase<any>[][]; | ||
export declare function runCaseItem(testcase: AutoTestCase<any>, editor: Editor, config?: any): Promise<any[]>; | ||
export declare function runcase(testcase: AutoTestCase<any>, editor: Editor, config?: any): Promise<any[]>; | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { AutoTestCheckEditorCase, AutoTestCompletionCase, AutoTestDbClickCase, AutoTestDefinitionCase, AutoTestHoverCase, AutoTestKeybindCase, AutoTestOutlineCase, AutoTestPerformanceCase, AutoTestReferencesCase } from './autotest'; | ||
import { Editor } from './editor'; | ||
declare function runDbClickCase(test: AutoTestDbClickCase, editor: Editor): Promise<({ | ||
casename: string; | ||
passed: boolean; | ||
message: string; | ||
} | { | ||
casename: string; | ||
passed: boolean; | ||
message?: undefined; | ||
})[]>; | ||
declare function runCompletionCase(test: AutoTestCompletionCase, editor: Editor, config?: any): Promise<any[]>; | ||
declare function runKeybindCase(test: AutoTestKeybindCase, editor: Editor): Promise<any[]>; | ||
declare function runDefinitionCase(test: AutoTestDefinitionCase, editor: Editor): Promise<({ | ||
casename: string; | ||
passed: boolean; | ||
message: string; | ||
} | { | ||
casename: string; | ||
passed: boolean; | ||
message?: undefined; | ||
})[]>; | ||
declare function runHoverCase(test: AutoTestHoverCase, editor: Editor): Promise<any[]>; | ||
declare function runNoErrorCase(test: AutoTestHoverCase, editor: Editor): Promise<any[]>; | ||
declare function runCheckEditor(test: AutoTestCheckEditorCase, editor: Editor): Promise<void>; | ||
declare function runErrorCase(test: AutoTestHoverCase, editor: Editor): Promise<any[]>; | ||
declare function runPerformanceCase(test: AutoTestPerformanceCase, editor: Editor): Promise<({ | ||
casename: string; | ||
passed: boolean; | ||
timer: any; | ||
message: string; | ||
} | { | ||
casename: string; | ||
timer: any; | ||
passed: boolean; | ||
message?: undefined; | ||
} | { | ||
casename: string; | ||
passed: boolean; | ||
message: string; | ||
timer?: undefined; | ||
})[]>; | ||
declare function runOutlineCase(test: AutoTestOutlineCase, editor: Editor): Promise<any[]>; | ||
declare function runReferencesCase(test: AutoTestReferencesCase, editor: Editor): Promise<any[]>; | ||
export { runCheckEditor, runCompletionCase, runDbClickCase, runDefinitionCase, runErrorCase, runHoverCase, runKeybindCase, runNoErrorCase, runOutlineCase, runPerformanceCase, runReferencesCase }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { AutoTestOutlineCase } from '../autotest'; | ||
import { Editor } from '../editor'; | ||
import { HBuilderX } from '../hxdriver'; | ||
import { TreeItem, TreeItemInfo } from '../treeItem'; | ||
declare class Outline { | ||
readonly hx: HBuilderX; | ||
protected treeItem: TreeItem; | ||
constructor(hx: HBuilderX); | ||
private getFilePath; | ||
/** | ||
* 获取大纲文件数据 | ||
*/ | ||
getFileOutlineData(jsonFilePath: string, needCreate: boolean): TreeItemInfo | undefined; | ||
/** | ||
* 对比结果 | ||
*/ | ||
comparativeData(mainData: TreeItemInfo, targetData: TreeItemInfo, title: string, result: any[]): Promise<boolean>; | ||
/** | ||
* 处理点击跳转 | ||
*/ | ||
doTreeItemJump(test: AutoTestOutlineCase, jsonData: TreeItemInfo, filePath: string, title: string, result: any[]): Promise<void>; | ||
/** | ||
* 执行大纲测试用例 | ||
*/ | ||
runOutlineCase(test: AutoTestOutlineCase, editor: Editor): Promise<any[]>; | ||
} | ||
export { Outline }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { AutoTestReferencesCase } from '../autotest'; | ||
import { Editor } from '../editor'; | ||
import { HBuilderX } from '../hxdriver'; | ||
import { TreeItem, TreeItemInfo } from '../treeItem'; | ||
declare class References { | ||
readonly hx: HBuilderX; | ||
protected treeItem: TreeItem; | ||
constructor(hx: HBuilderX); | ||
private getFilePath; | ||
/** | ||
* 获取文件数据 | ||
*/ | ||
getFileReferencesData(jsonFilePath: string, needCreate: boolean): TreeItemInfo | undefined; | ||
/** | ||
* 对比结果 | ||
*/ | ||
comparativeData(mainData: TreeItemInfo, targetData: TreeItemInfo, title: string, result: any[]): Promise<boolean>; | ||
/** | ||
* 处理点击跳转 | ||
*/ | ||
doTreeItemJump(test: AutoTestReferencesCase, jsonData: TreeItemInfo, filePath: string, title: string, result: any[]): Promise<void>; | ||
/** | ||
* 执行查找引用测试用例 | ||
* @param test | ||
* @param editor | ||
* @returns | ||
*/ | ||
runReferencesCase(test: AutoTestReferencesCase, editor: Editor): Promise<any[]>; | ||
} | ||
export { References }; |
Oops, something went wrong.