@grafana/k6-test-builder 0.6.0 → 0.6.1-alpha.1

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.
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface RampingStage {
14
14
  target: '' | number | null;
15
15
  duration: string;
16
16
  }
17
+ type RequestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'OPTIONS' | 'DELETE' | 'HEAD';
17
18
  declare const ScenarioExecutor: {
18
19
  readonly SharedIterations: "shared-iterations";
19
20
  readonly PerVUIterations: "per-vu-iterations";
@@ -71,6 +72,17 @@ interface RampingArrivalRateOptions extends ScenarioCommonOptions {
71
72
  maxVUs?: number;
72
73
  }
73
74
  type ScenarioOptions = SharedIterationsOptions | PerVUIterationsOptions | ConstantVUsOptions | RampingVUsOptions | ConstantArrivalRateOptions | RampingArrivalRateOptions;
75
+ enum CheckType {
76
+ Text = 0,
77
+ JSONPathValue = 1,
78
+ JSONPath = 2,
79
+ RegEx = 3
80
+ }
81
+ enum VariableType {
82
+ JSONPath = 0,
83
+ RegEx = 1,
84
+ CSSSelector = 2
85
+ }
74
86
  interface PrometheusTokenCredentials {
75
87
  token: string;
76
88
  }
@@ -188,6 +200,76 @@ export interface LogOptions {
188
200
  thresholds: Thresholds;
189
201
  scenarios: Record<string, ScenarioOptions>;
190
202
  }
203
+ enum SleepType {
204
+ Before = "before",
205
+ After = "after"
206
+ }
207
+ type Sleep = Partial<Record<SleepType, number>>;
208
+ interface Page {
209
+ id: string;
210
+ name: string;
211
+ title: string;
212
+ sleep?: Sleep[];
213
+ startedDateTime: string;
214
+ }
215
+ type NameValueRecord = Record<'name' | 'value', string>;
216
+ interface EntryCheck {
217
+ type: CheckType;
218
+ expression?: string;
219
+ subject?: number;
220
+ condition?: number;
221
+ value?: string;
222
+ }
223
+ type PostDataType = 'keyValuePairs' | 'json' | 'text' | 'file' | string;
224
+ interface PostData {
225
+ mimeType: string;
226
+ comment: PostDataType;
227
+ text?: string;
228
+ params?: NameValueRecord[];
229
+ }
230
+ interface EntryRequest {
231
+ headers: NameValueRecord[];
232
+ method: RequestMethod;
233
+ queryString: NameValueRecord[];
234
+ postData?: PostData;
235
+ url: string;
236
+ sleep?: Sleep[];
237
+ }
238
+ interface EntryVariable {
239
+ type: VariableType;
240
+ name: string;
241
+ expression: string;
242
+ attribute?: string;
243
+ }
244
+ interface Entry {
245
+ pageref: string;
246
+ checks: EntryCheck[];
247
+ comment: string;
248
+ request: EntryRequest;
249
+ variables: EntryVariable[];
250
+ sleep?: Sleep[];
251
+ startedDateTime: string;
252
+ }
253
+ interface LogCreator {
254
+ name: string;
255
+ version: string;
256
+ }
257
+ interface ArchiveLog {
258
+ entries: Array<Entry>;
259
+ id?: string;
260
+ name?: string;
261
+ version?: string;
262
+ creator?: LogCreator;
263
+ options?: LogOptions;
264
+ pages?: Array<Page>;
265
+ exportAs?: string;
266
+ namedExport?: boolean;
267
+ comment?: string;
268
+ }
269
+ interface Archive {
270
+ log: ArchiveLog;
271
+ optionsPlaceholder?: boolean;
272
+ }
191
273
  export function convertDurationToSeconds(duration?: string): number;
192
274
  export function isDurationValid(duration: string): boolean;
193
275
  export function isStageTargetValid(target: any): boolean;
@@ -235,6 +317,17 @@ interface StagesVirtualizationComponentProps {
235
317
  type LoadZoneDataItem = {
236
318
  id: number;
237
319
  } & K6LoadZone;
320
+ interface BaseBuilderContextValue {
321
+ ScriptEditorComponent?: (props: ScriptEditorProps) => ReactElement;
322
+ enableViewLinkHref?: boolean;
323
+ onViewChange?: (view: string) => void;
324
+ DocsLinkComponent?: ElementType<DocsLinkProps>;
325
+ k6Test?: TestBuilderTest;
326
+ readonlyScriptScenarios: boolean;
327
+ TestBuilderIconComponent: typeof TestBuilderIcon;
328
+ openImportModal?: () => Promise<Archive | null>;
329
+ startRecorder?: () => void;
330
+ }
238
331
  interface TestBuilderInternalContextProviderProps {
239
332
  children?: ReactNode;
240
333
  }
@@ -263,8 +356,10 @@ interface TestBuilderStandaloneProps {
263
356
  apmConfigs?: APMConfig[];
264
357
  hasCloudAPM?: boolean;
265
358
  disableAPM?: boolean;
359
+ openImportModal?: BaseBuilderContextValue['openImportModal'];
360
+ startRecorder?: BaseBuilderContextValue['startRecorder'];
266
361
  }
267
- export function TestBuilder({ loading, saving, k6Test, hasCloudExecution, availableLoadZones, DocsLinkComponent, onViewChange, StagesVirtualizationComponent, ScriptEditorComponent, TestBuilderIconComponent, readonlyScriptScenarios, apmConfigs, hasCloudAPM, disableAPM, }: TestBuilderStandaloneProps): JSX.Element;
362
+ export function TestBuilder({ loading, saving, k6Test, hasCloudExecution, availableLoadZones, DocsLinkComponent, onViewChange, StagesVirtualizationComponent, ScriptEditorComponent, TestBuilderIconComponent, readonlyScriptScenarios, apmConfigs, hasCloudAPM, disableAPM, openImportModal, startRecorder, }: TestBuilderStandaloneProps): JSX.Element;
268
363
  interface Label {
269
364
  name: string;
270
365
  value: string;