@tinywork/glass 0.0.34 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +31 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -63,6 +63,21 @@ export type NetLog = {
63
63
  resourceType?: ResourceType;
64
64
  response?: any;
65
65
  };
66
+ export type Case = {
67
+ id: string;
68
+ versionId: string;
69
+ name: string;
70
+ desc?: string;
71
+ origin: string;
72
+ pathname: string;
73
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
74
+ params?: string;
75
+ headers?: string;
76
+ body?: string;
77
+ apiId?: string;
78
+ /** 校验结果的ts类型声明 */
79
+ response?: string;
80
+ };
66
81
  export interface IProgress {
67
82
  update: (option: {
68
83
  percent: number;
@@ -154,6 +169,20 @@ export interface IGlassExtension {
154
169
  params?: Record<string, any>;
155
170
  data?: any;
156
171
  }): Promise<void>;
172
+ /** 在用例批量执行前触发 */
173
+ beforeCasesExec?(context: IGlassContext, data: {
174
+ list: Case[];
175
+ }): Promise<void>;
176
+ /** 在单条用例执行时触发 */
177
+ onCaseExec?(context: IGlassContext, data: Case): Promise<void>;
178
+ /** 在用例批量执行后触发 */
179
+ afterCasesExec?(context: IGlassContext, data: {
180
+ list: Case[];
181
+ failCases: {
182
+ id: string;
183
+ message?: string;
184
+ }[];
185
+ }): Promise<void>;
157
186
  /** 在postMessage到页面之前 */
158
187
  onMessagePost?(context: IGlassContext, message: Partial<NetLog>): Promise<void>;
159
188
  onResponse?(context: IGlassContext, params: {
@@ -180,5 +209,7 @@ export interface IGlassExtension {
180
209
  }[];
181
210
  apiId: string;
182
211
  }>): Promise<void>;
212
+ /** 根据doc或者log来初始化case */
213
+ getDefaultCase?(context: IGlassContext, docs: DocSchema[], log?: NetLog, defaultCase?: Partial<Case>): Promise<void>;
183
214
  }
184
215
  export { fs, qs, path, http, https, axios, crypto, BrowserWindow, type Session };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinywork/glass",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [