@bugbug-io/sdk 13.39.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/README.md +576 -0
- package/dist/constants/sdk-error-codes.d.ts +35 -0
- package/dist/constants/sdk-error-codes.d.ts.map +1 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3844 -0
- package/dist/modules/auth/auth.d.ts +11 -0
- package/dist/modules/auth/auth.d.ts.map +1 -0
- package/dist/modules/auth/auth.types.d.ts +34 -0
- package/dist/modules/auth/auth.types.d.ts.map +1 -0
- package/dist/modules/auth/auth.utils.d.ts +4 -0
- package/dist/modules/auth/auth.utils.d.ts.map +1 -0
- package/dist/modules/components/components.d.ts +43 -0
- package/dist/modules/components/components.d.ts.map +1 -0
- package/dist/modules/config/config.d.ts +48 -0
- package/dist/modules/config/config.d.ts.map +1 -0
- package/dist/modules/groups/groups.d.ts +62 -0
- package/dist/modules/groups/groups.d.ts.map +1 -0
- package/dist/modules/profiles/profiles.d.ts +71 -0
- package/dist/modules/profiles/profiles.d.ts.map +1 -0
- package/dist/modules/project/project.d.ts +58 -0
- package/dist/modules/project/project.d.ts.map +1 -0
- package/dist/modules/projectArtifacts/projectArtifacts.d.ts +8 -0
- package/dist/modules/projectArtifacts/projectArtifacts.d.ts.map +1 -0
- package/dist/modules/projectArtifacts/projectArtifacts.types.d.ts +14 -0
- package/dist/modules/projectArtifacts/projectArtifacts.types.d.ts.map +1 -0
- package/dist/modules/projects/projects.d.ts +36 -0
- package/dist/modules/projects/projects.d.ts.map +1 -0
- package/dist/modules/projects/projects.types.d.ts +6 -0
- package/dist/modules/projects/projects.types.d.ts.map +1 -0
- package/dist/modules/stepRuns/stepRuns.d.ts +22 -0
- package/dist/modules/stepRuns/stepRuns.d.ts.map +1 -0
- package/dist/modules/steps/steps.d.ts +47 -0
- package/dist/modules/steps/steps.d.ts.map +1 -0
- package/dist/modules/steps/steps.utils.d.ts +11 -0
- package/dist/modules/steps/steps.utils.d.ts.map +1 -0
- package/dist/modules/suites/suites.d.ts +153 -0
- package/dist/modules/suites/suites.d.ts.map +1 -0
- package/dist/modules/suites/suites.types.d.ts +31 -0
- package/dist/modules/suites/suites.types.d.ts.map +1 -0
- package/dist/modules/tests/tests.d.ts +253 -0
- package/dist/modules/tests/tests.d.ts.map +1 -0
- package/dist/modules/tests/tests.types.d.ts +34 -0
- package/dist/modules/tests/tests.types.d.ts.map +1 -0
- package/dist/modules/tests/tests.utils.d.ts +11 -0
- package/dist/modules/tests/tests.utils.d.ts.map +1 -0
- package/dist/modules/variables/variables.d.ts +14 -0
- package/dist/modules/variables/variables.d.ts.map +1 -0
- package/dist/modules/variables/variables.types.d.ts +7 -0
- package/dist/modules/variables/variables.types.d.ts.map +1 -0
- package/dist/modules/visualRegression/visualRegression.constants.d.ts +7 -0
- package/dist/modules/visualRegression/visualRegression.constants.d.ts.map +1 -0
- package/dist/modules/visualRegression/visualRegression.d.ts +69 -0
- package/dist/modules/visualRegression/visualRegression.d.ts.map +1 -0
- package/dist/modules/visualRegression/visualRegression.types.d.ts +12 -0
- package/dist/modules/visualRegression/visualRegression.types.d.ts.map +1 -0
- package/dist/sdk.d.ts +126 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/services/apiClient/apiClient.d.ts +167 -0
- package/dist/services/apiClient/apiClient.d.ts.map +1 -0
- package/dist/services/apiClient/apiClient.types.d.ts +19 -0
- package/dist/services/apiClient/apiClient.types.d.ts.map +1 -0
- package/dist/services/apiClient/apiClient.utils.d.ts +32 -0
- package/dist/services/apiClient/apiClient.utils.d.ts.map +1 -0
- package/dist/services/rateLimiter/rateLimiter.constants.d.ts +5 -0
- package/dist/services/rateLimiter/rateLimiter.constants.d.ts.map +1 -0
- package/dist/services/rateLimiter/rateLimiter.d.ts +49 -0
- package/dist/services/rateLimiter/rateLimiter.d.ts.map +1 -0
- package/dist/services/rateLimiter/rateLimiter.types.d.ts +34 -0
- package/dist/services/rateLimiter/rateLimiter.types.d.ts.map +1 -0
- package/dist/testUtils/fakeFactory.d.ts +15 -0
- package/dist/testUtils/fakeFactory.d.ts.map +1 -0
- package/dist/testUtils/setup.d.ts +2 -0
- package/dist/testUtils/setup.d.ts.map +1 -0
- package/dist/types/config.d.ts +121 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/errors.d.ts +162 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/sdk.d.ts +28 -0
- package/dist/types/sdk.d.ts.map +1 -0
- package/dist/utils/pagination.d.ts +10 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/polling.d.ts +20 -0
- package/dist/utils/polling.d.ts.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { BugBugApiClient } from '../../services/apiClient/apiClient';
|
|
2
|
+
import type { RequestOptions } from '../../types/config';
|
|
3
|
+
import type { ListSuiteRunsOptions, ListSuitesOptions, RunSuiteNoWatchProgressOptions, RunSuiteWatchProgressOptions } from './suites.types';
|
|
4
|
+
import type { DebugArtifactsListResponse, SuitesListResponse, Suite, SuiteSummary, SuiteRun, SuiteRunState, SuiteRunsListResponse, SuiteRunScreenshotsResponse, SuiteCreateRequest, SuiteUpdateRequest, SuitePartialUpdateRequest } from '@bugbug-io/api-schema';
|
|
5
|
+
/**
|
|
6
|
+
* Suites module — manage BugBug test suites and their runs.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors the shape of {@link TestsModule}: CRUD over `/suites/` + run
|
|
9
|
+
* lifecycle over `/suiteruns/`. Use {@link startRun} for the recommended
|
|
10
|
+
* high-level entry point with optional progress watching.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SuitesModule {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(client: BugBugApiClient);
|
|
15
|
+
/**
|
|
16
|
+
* List suites with pagination, search, and ordering.
|
|
17
|
+
*
|
|
18
|
+
* @param options.cursor - Opaque cursor returned as `nextToken` by the previous page.
|
|
19
|
+
* @param options.pageSize - Items per page.
|
|
20
|
+
* @param options.query - Search query matched against suite name.
|
|
21
|
+
* @param options.ordering - Sort key; prefix with `-` for descending.
|
|
22
|
+
* @returns Paginated `SuitesListResponse` envelope (validated via Zod).
|
|
23
|
+
* @throws {UnexpectedResponseError} On Zod validation failure.
|
|
24
|
+
*/
|
|
25
|
+
list: (options?: ListSuitesOptions) => Promise<SuitesListResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch every suite across all pages.
|
|
28
|
+
*/
|
|
29
|
+
getAll: (options?: Omit<ListSuitesOptions, "cursor">) => Promise<SuiteSummary[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Fetch a single suite by ID.
|
|
32
|
+
*
|
|
33
|
+
* @throws {NotFoundError} When no suite matches `suiteId`.
|
|
34
|
+
*/
|
|
35
|
+
get: (suiteId: string, options?: RequestOptions) => Promise<Suite>;
|
|
36
|
+
/**
|
|
37
|
+
* Create a new suite.
|
|
38
|
+
*
|
|
39
|
+
* @throws {ValidationError} On invalid payload.
|
|
40
|
+
*/
|
|
41
|
+
create: (data: SuiteCreateRequest, options?: RequestOptions) => Promise<Suite>;
|
|
42
|
+
/**
|
|
43
|
+
* Fully replace a suite via PUT (all fields required).
|
|
44
|
+
* Use {@link partialUpdate} for sparse PATCH semantics.
|
|
45
|
+
*
|
|
46
|
+
* @throws {NotFoundError} When the suite does not exist.
|
|
47
|
+
* @throws {ValidationError} On invalid payload.
|
|
48
|
+
*/
|
|
49
|
+
update: (suiteId: string, data: SuiteUpdateRequest, options?: RequestOptions) => Promise<Suite>;
|
|
50
|
+
/**
|
|
51
|
+
* Patch selected fields on a suite (PATCH semantics).
|
|
52
|
+
*
|
|
53
|
+
* @throws {NotFoundError} When the suite does not exist.
|
|
54
|
+
* @throws {ValidationError} On invalid payload.
|
|
55
|
+
*/
|
|
56
|
+
partialUpdate: (suiteId: string, data: SuitePartialUpdateRequest, options?: RequestOptions) => Promise<Suite>;
|
|
57
|
+
/**
|
|
58
|
+
* Delete a suite by ID.
|
|
59
|
+
*
|
|
60
|
+
* @throws {NotFoundError} When the suite does not exist.
|
|
61
|
+
*/
|
|
62
|
+
delete: (suiteId: string, options?: RequestOptions) => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Start a suite run, optionally watching progress until completion.
|
|
65
|
+
*
|
|
66
|
+
* @param suiteId - UUID of the suite to run.
|
|
67
|
+
* @param options.profileName - Run profile name or UUID; resolved via {@link ProfilesModule.resolveId}.
|
|
68
|
+
* @param options.variables - Per-run variable overrides.
|
|
69
|
+
* @param options.watchProgress - When `true`, block until all child runs finish.
|
|
70
|
+
* @param options.pollInterval - Poll interval in ms when watching progress (default 2000).
|
|
71
|
+
* @param options.timeout - Progress watching timeout in ms (default 10 minutes for suites).
|
|
72
|
+
* @param options.onProgress - Callback invoked on each poll with the latest `SuiteRunState`.
|
|
73
|
+
* @throws {NotFoundError} When `profileName` does not resolve.
|
|
74
|
+
* @throws {TimeoutError} When `watchProgress` is true and the run does not finish in time.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const run = await sdk.suites.startRun(suiteId, {
|
|
79
|
+
* watchProgress: true,
|
|
80
|
+
* profileName: 'Production',
|
|
81
|
+
* onProgress: (s) => console.log(`${s.status} ${s.finishedTests}/${s.totalTests}`),
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
startRun(suiteId: string, options: RunSuiteWatchProgressOptions): Promise<SuiteRun>;
|
|
86
|
+
startRun(suiteId: string, options?: RunSuiteNoWatchProgressOptions): Promise<SuiteRunState>;
|
|
87
|
+
/**
|
|
88
|
+
* Fetch full suite-run details including child test runs.
|
|
89
|
+
*
|
|
90
|
+
* @throws {NotFoundError} When the run does not exist.
|
|
91
|
+
*/
|
|
92
|
+
getRun: (runId: string, options?: RequestOptions) => Promise<SuiteRun>;
|
|
93
|
+
/**
|
|
94
|
+
* Get list of suite runs.
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
listRuns: (options?: ListSuiteRunsOptions) => Promise<SuiteRunsListResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Get recent suite runs within a time window
|
|
100
|
+
*/
|
|
101
|
+
getRecentRuns: (options?: {
|
|
102
|
+
hours?: number;
|
|
103
|
+
pageSize?: ListSuiteRunsOptions["pageSize"];
|
|
104
|
+
ordering?: ListSuiteRunsOptions["ordering"];
|
|
105
|
+
suiteId?: ListSuiteRunsOptions["suiteId"];
|
|
106
|
+
} & RequestOptions) => Promise<SuiteRunsListResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Fetch only the lightweight status of a suite run. Prefer this over
|
|
109
|
+
* {@link getRun} when polling.
|
|
110
|
+
*/
|
|
111
|
+
getRunProgress: (runId: string, options?: RequestOptions) => Promise<SuiteRunState>;
|
|
112
|
+
/**
|
|
113
|
+
* Request cancellation of an in-progress suite run.
|
|
114
|
+
*
|
|
115
|
+
* @returns The updated status; the run may still take a moment to settle.
|
|
116
|
+
*/
|
|
117
|
+
stopRun: (runId: string, options?: RequestOptions) => Promise<SuiteRunState>;
|
|
118
|
+
/**
|
|
119
|
+
* Fetch screenshots captured across all child test runs of a suite run.
|
|
120
|
+
*/
|
|
121
|
+
getRunScreenshots: (runId: string, options?: RequestOptions) => Promise<SuiteRunScreenshotsResponse["testsRuns"]>;
|
|
122
|
+
/**
|
|
123
|
+
* Download the combined JUnit XML report for a suite run, aggregating all
|
|
124
|
+
* child test runs.
|
|
125
|
+
*
|
|
126
|
+
* @returns The JUnit report body as a string.
|
|
127
|
+
*/
|
|
128
|
+
downloadRunJunitReport: (runId: string, options?: RequestOptions) => Promise<string>;
|
|
129
|
+
/**
|
|
130
|
+
* List artifacts attached to a suite run. The current public API exposes the
|
|
131
|
+
* combined JUnit report artifact here.
|
|
132
|
+
*/
|
|
133
|
+
listRunDebugArtifacts: (runId: string, options?: RequestOptions) => Promise<DebugArtifactsListResponse>;
|
|
134
|
+
/**
|
|
135
|
+
* Poll a suite run's lightweight `/status/` endpoint until it reaches a
|
|
136
|
+
* terminal status, then return the full `SuiteRun` once.
|
|
137
|
+
*
|
|
138
|
+
* Transient network errors are retried; non-network errors propagate.
|
|
139
|
+
*
|
|
140
|
+
* @param runId - UUID of the suite run.
|
|
141
|
+
* @param onProgress - Invoked on every successful poll with the latest `SuiteRunState`
|
|
142
|
+
* (including the terminal one). Receives `finishedTests`/`totalTests`/`webappUrl`
|
|
143
|
+
* for in-flight progress UI.
|
|
144
|
+
* @param options.pollInterval - Poll interval in ms (default 2000).
|
|
145
|
+
* @param options.timeout - Wait timeout in ms (default 600_000 = 10 minutes; suites typically take longer than single tests).
|
|
146
|
+
* @throws {TimeoutError} When the run does not complete in time.
|
|
147
|
+
*/
|
|
148
|
+
watchRunProgress: (runId: string, onProgress: (status: SuiteRunState) => void | Promise<void>, options?: {
|
|
149
|
+
pollInterval?: number;
|
|
150
|
+
timeout?: number;
|
|
151
|
+
} & RequestOptions) => Promise<SuiteRun>;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=suites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suites.d.ts","sourceRoot":"","sources":["../../../src/modules/suites/suites.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,8BAA8B,EAC9B,4BAA4B,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,qBAAqB,EAErB,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAO/B;;;;;;GAMG;AACH,qBAAa,YAA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,aAAa,GACX,UAAS;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAC5C,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAC5C,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;KAC3C,GAAG,cAAmB,KACtB,OAAO,CAAC,qBAAqB,CAAC,CAsB/B;IAEF;;;OAGG;IACH,cAAc,GAAU,OAAO,MAAM,EAAE,UAAS,cAAmB,KAAG,OAAO,CAAC,aAAa,CAAC,CAIvF;IAEL;;;;OAIG;IACH,OAAO,GAAU,OAAO,MAAM,EAAE,UAAS,cAAmB,KAAG,OAAO,CAAC,aAAa,CAAC,CAIhF;IAEL;;OAEG;IACH,iBAAiB,GACf,OAAO,MAAM,EACb,UAAS,cAAmB,KAC3B,OAAO,CAAC,2BAA2B,CAAC,WAAW,CAAC,CAAC,CASlD;IAEF;;;;;OAKG;IACH,sBAAsB,GAAU,OAAO,MAAM,EAAE,UAAS,cAAmB,KAAG,OAAO,CAAC,MAAM,CAAC,CAIxF;IAEL;;;OAGG;IACH,qBAAqB,GACnB,OAAO,MAAM,EACb,UAAS,cAAmB,KAC3B,OAAO,CAAC,0BAA0B,CAAC,CASpC;IAEF;;;;;;;;;;;;;OAaG;IACH,gBAAgB,GACd,OAAO,MAAM,EACb,YAAY,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC3D,UAAS;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,cAAmB,KACzE,OAAO,CAAC,QAAQ,CAAC,CAclB;CACH"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RequestOptions } from '../../types/config';
|
|
2
|
+
import type { RunSuiteRequest, SuiteRunsListQuery, SuitesListQuery, SuiteRunState } from '@bugbug-io/api-schema';
|
|
3
|
+
export interface ListSuitesOptions extends RequestOptions {
|
|
4
|
+
cursor?: SuitesListQuery['cursor'];
|
|
5
|
+
pageSize?: SuitesListQuery['page_size'];
|
|
6
|
+
query?: SuitesListQuery['query'];
|
|
7
|
+
ordering?: SuitesListQuery['ordering'];
|
|
8
|
+
}
|
|
9
|
+
export interface ListSuiteRunsOptions extends RequestOptions {
|
|
10
|
+
cursor?: SuiteRunsListQuery['cursor'];
|
|
11
|
+
pageSize?: SuiteRunsListQuery['page_size'];
|
|
12
|
+
ordering?: SuiteRunsListQuery['ordering'];
|
|
13
|
+
startedAfter?: SuiteRunsListQuery['started_after'];
|
|
14
|
+
startedBefore?: SuiteRunsListQuery['started_before'];
|
|
15
|
+
status?: SuiteRunsListQuery['status'];
|
|
16
|
+
suiteId?: SuiteRunsListQuery['suiteId'];
|
|
17
|
+
}
|
|
18
|
+
export interface RunSuiteBaseOptions extends RequestOptions {
|
|
19
|
+
profileName?: string;
|
|
20
|
+
variables?: NonNullable<RunSuiteRequest['variables']>;
|
|
21
|
+
}
|
|
22
|
+
export interface RunSuiteWatchProgressOptions extends RunSuiteBaseOptions {
|
|
23
|
+
watchProgress: true;
|
|
24
|
+
pollInterval?: number;
|
|
25
|
+
timeout?: number;
|
|
26
|
+
onProgress?: (status: SuiteRunState) => void | Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export interface RunSuiteNoWatchProgressOptions extends RunSuiteBaseOptions {
|
|
29
|
+
watchProgress?: false;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=suites.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suites.types.d.ts","sourceRoot":"","sources":["../../../src/modules/suites/suites.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,aAAa,EACd,MAAM,uBAAuB,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
|
|
|
1
|
+
import type { BugBugApiClient } from '../../services/apiClient/apiClient';
|
|
2
|
+
import type { RequestOptions } from '../../types/config';
|
|
3
|
+
import type { ImportTestOptions, ListTestRunsOptions, ListTestsOptions, RunTestNoWatchProgressOptions, RunTestWatchProgressOptions } from './tests.types';
|
|
4
|
+
import type { ImportFormat, TestsListResponse, TestSummary, Test, TestRun, TestRunState, TestRunsListResponse, TestRunScreenshotsResponse, TestCreateRequest, TestUpdateRequest, InsertGroup, InsertGroupResponse, UnlinkComponentRequest, UnlinkComponentResponse, UpdateStepPositionRequest, UpdateStepPositionResponse, DebugArtifact, DebugArtifactByType, DebugArtifactsListResponse } from '@bugbug-io/api-schema';
|
|
5
|
+
/**
|
|
6
|
+
* Tests module — manage BugBug tests and their runs.
|
|
7
|
+
*
|
|
8
|
+
* Exposes CRUD over `/tests/`, run lifecycle over `/testruns/`, component
|
|
9
|
+
* linking, debug artifacts, and YAML/ZIP export/import. Use {@link startRun}
|
|
10
|
+
* for the recommended high-level entry point with optional progress watching.
|
|
11
|
+
*/
|
|
12
|
+
export declare class TestsModule {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(client: BugBugApiClient);
|
|
15
|
+
/**
|
|
16
|
+
* List tests with pagination, search, and ordering.
|
|
17
|
+
*
|
|
18
|
+
* @param options.cursor - Opaque cursor returned as `nextToken` by the previous page.
|
|
19
|
+
* @param options.pageSize - Number of items per page.
|
|
20
|
+
* @param options.query - Search query matched against test name.
|
|
21
|
+
* @param options.ordering - Sort key; prefix with `-` for descending.
|
|
22
|
+
* @returns Paginated `TestsListResponse` envelope (validated via Zod).
|
|
23
|
+
* @throws {UnexpectedResponseError} When the server response fails Zod validation.
|
|
24
|
+
*/
|
|
25
|
+
list: (options?: ListTestsOptions) => Promise<TestsListResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch every test across all pages.
|
|
28
|
+
*/
|
|
29
|
+
getAll: (options?: Omit<ListTestsOptions, "cursor">) => Promise<TestSummary[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Fetch a single test by ID.
|
|
32
|
+
*
|
|
33
|
+
* @param testId - UUID of the test.
|
|
34
|
+
* @returns The full `Test` resource.
|
|
35
|
+
* @throws {NotFoundError} When no test matches `testId`.
|
|
36
|
+
*/
|
|
37
|
+
get: (testId: string, options?: RequestOptions) => Promise<Test>;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new empty test.
|
|
40
|
+
*
|
|
41
|
+
* @param data - Test creation payload (at minimum, `name` and `screenSizeType`).
|
|
42
|
+
* @returns The newly-created `Test`.
|
|
43
|
+
* @throws {ValidationError} On invalid payload (DRF field errors on `error.fields`).
|
|
44
|
+
*/
|
|
45
|
+
create: (data: TestCreateRequest, options?: RequestOptions) => Promise<Test>;
|
|
46
|
+
/**
|
|
47
|
+
* Update a test. The tests endpoint accepts partial payloads via PATCH, so
|
|
48
|
+
* this and {@link partialUpdate} share the same semantics.
|
|
49
|
+
*
|
|
50
|
+
* @param testId - UUID of the test to update.
|
|
51
|
+
* @param data - Fields to patch.
|
|
52
|
+
* @throws {NotFoundError} When the test does not exist.
|
|
53
|
+
* @throws {ValidationError} When the payload fails server-side validation.
|
|
54
|
+
*/
|
|
55
|
+
update: (testId: string, data: TestUpdateRequest, options?: RequestOptions) => Promise<Test>;
|
|
56
|
+
/** Alias for {@link update}. The tests endpoint already uses PATCH semantics. */
|
|
57
|
+
partialUpdate: (testId: string, data: TestUpdateRequest, options?: RequestOptions) => Promise<Test>;
|
|
58
|
+
/**
|
|
59
|
+
* Delete a test by ID.
|
|
60
|
+
*
|
|
61
|
+
* @throws {NotFoundError} When the test does not exist.
|
|
62
|
+
*/
|
|
63
|
+
delete: (testId: string, options?: RequestOptions) => Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Link an existing component/group into a test at an optional position.
|
|
66
|
+
*
|
|
67
|
+
* @param testId - UUID of the test to insert into.
|
|
68
|
+
* @param data - `{ groupId, atIndex? }` insertion descriptor.
|
|
69
|
+
* @returns Insert response with the resulting step layout.
|
|
70
|
+
*/
|
|
71
|
+
linkComponent: (testId: string, data: InsertGroup, options?: RequestOptions) => Promise<InsertGroupResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Unlink a component/group from a test.
|
|
74
|
+
*
|
|
75
|
+
* @param testId - UUID of the test to unlink from.
|
|
76
|
+
* @param data - Unlink descriptor identifying which component to remove.
|
|
77
|
+
*/
|
|
78
|
+
unlinkComponent: (testId: string, data: UnlinkComponentRequest, options?: RequestOptions) => Promise<UnlinkComponentResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Start a test run by name or ID, optionally watching progress until completion.
|
|
81
|
+
*
|
|
82
|
+
* When `testNameOrId` is a UUID the test is run directly. Otherwise it is
|
|
83
|
+
* looked up by name first ({@link NotFoundError} on miss). When
|
|
84
|
+
* `watchProgress` is `true`, the call polls until the run reaches a
|
|
85
|
+
* terminal status and returns the full `TestRun`; otherwise it returns the
|
|
86
|
+
* initial `TestRunState` synchronously after enqueueing the run.
|
|
87
|
+
*
|
|
88
|
+
* @param testNameOrId - Test UUID or human-readable test name.
|
|
89
|
+
* @param options.profileName - Run profile name or UUID; resolved via {@link ProfilesModule.resolveId}.
|
|
90
|
+
* @param options.variables - Per-run variable overrides (`{ key, value? }[]`).
|
|
91
|
+
* @param options.watchProgress - When `true`, block until the run completes.
|
|
92
|
+
* @param options.pollInterval - Poll interval in ms when watching progress (default 2000).
|
|
93
|
+
* @param options.timeout - Progress watching timeout in ms (default 5 minutes for tests).
|
|
94
|
+
* @param options.onProgress - Callback invoked on each poll with the latest `TestRunState`.
|
|
95
|
+
* @throws {NotFoundError} When `testNameOrId` is not a UUID and no test matches that name.
|
|
96
|
+
* @throws {TimeoutError} When `watchProgress` is true and the run does not finish in time.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* // Fire-and-forget run by name
|
|
101
|
+
* const status = await sdk.tests.startRun('Smoke / login');
|
|
102
|
+
*
|
|
103
|
+
* // Run by ID, watch progress for up to 10 minutes
|
|
104
|
+
* const run = await sdk.tests.startRun('11111111-1111-4111-8111-111111111111', {
|
|
105
|
+
* watchProgress: true,
|
|
106
|
+
* timeout: 600_000,
|
|
107
|
+
* profileName: 'Production',
|
|
108
|
+
* onProgress: (s) => console.log(`${s.id}: ${s.status} (${s.finishedSteps}/${s.totalSteps})`),
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
startRun(testNameOrId: string, options: RunTestWatchProgressOptions): Promise<TestRun>;
|
|
113
|
+
startRun(testNameOrId: string, options?: RunTestNoWatchProgressOptions): Promise<TestRunState>;
|
|
114
|
+
/**
|
|
115
|
+
* Fetch full test-run details including step runs.
|
|
116
|
+
*
|
|
117
|
+
* @param runId - UUID of the test run.
|
|
118
|
+
* @throws {NotFoundError} When the run does not exist.
|
|
119
|
+
*/
|
|
120
|
+
getRun: (runId: string, options?: RequestOptions) => Promise<TestRun>;
|
|
121
|
+
/**
|
|
122
|
+
* Fetch only the lightweight status of a test run (no step detail).
|
|
123
|
+
* Prefer this over {@link getRun} when polling.
|
|
124
|
+
*/
|
|
125
|
+
getRunProgress: (runId: string, options?: RequestOptions) => Promise<TestRunState>;
|
|
126
|
+
/**
|
|
127
|
+
* Request cancellation of an in-progress test run.
|
|
128
|
+
*
|
|
129
|
+
* @param runId - UUID of the run to stop.
|
|
130
|
+
* @returns The updated status; the run may still take a moment to settle.
|
|
131
|
+
*/
|
|
132
|
+
stopRun: (runId: string, options?: RequestOptions) => Promise<TestRunState>;
|
|
133
|
+
/**
|
|
134
|
+
* Fetch step-level screenshots captured during a run.
|
|
135
|
+
*
|
|
136
|
+
* @returns Per-step-run screenshot entries; empty array when none available.
|
|
137
|
+
*/
|
|
138
|
+
getRunScreenshots: (runId: string, options?: RequestOptions) => Promise<TestRunScreenshotsResponse["stepsRuns"]>;
|
|
139
|
+
/**
|
|
140
|
+
* List test runs filtered by status, time window, and optional test ID.
|
|
141
|
+
*
|
|
142
|
+
* @param options.testId - When set, restricts to runs of that test (UUID).
|
|
143
|
+
* @param options.startedAfter - ISO timestamp; only runs started after this point.
|
|
144
|
+
* @param options.startedBefore - ISO timestamp; only runs started before this point.
|
|
145
|
+
* @param options.status - Filter by `TestRunState['status']`.
|
|
146
|
+
* @returns Paginated `TestRunsListResponse`.
|
|
147
|
+
*/
|
|
148
|
+
listRuns: (options?: ListTestRunsOptions) => Promise<TestRunsListResponse>;
|
|
149
|
+
/**
|
|
150
|
+
* Move a step to a new position within a test's step list.
|
|
151
|
+
*
|
|
152
|
+
* @param testId - UUID of the test to reorder.
|
|
153
|
+
* @param data - `{ stepId, atIndex }` move descriptor.
|
|
154
|
+
* @returns The updated `Test` with the new step ordering.
|
|
155
|
+
*/
|
|
156
|
+
updateStepPosition: (testId: string, data: UpdateStepPositionRequest, options?: RequestOptions) => Promise<UpdateStepPositionResponse>;
|
|
157
|
+
/**
|
|
158
|
+
* Convenience wrapper around {@link listRuns} that returns runs started in
|
|
159
|
+
* the last N hours, newest first by default.
|
|
160
|
+
*
|
|
161
|
+
* @param options.hours - Look-back window in hours (default 24).
|
|
162
|
+
* @param options.pageSize - Max runs per page (default 50).
|
|
163
|
+
* @param options.ordering - Sort order; defaults to most-recent first.
|
|
164
|
+
*/
|
|
165
|
+
getRecentRuns: (options?: {
|
|
166
|
+
hours?: number;
|
|
167
|
+
pageSize?: number;
|
|
168
|
+
ordering?: "-started" | "started";
|
|
169
|
+
} & RequestOptions) => Promise<TestRunsListResponse>;
|
|
170
|
+
/**
|
|
171
|
+
* Download the JUnit XML report for a test run. Useful for CI integrations
|
|
172
|
+
* that consume JUnit (e.g. Jenkins, GitLab CI, GitHub Actions test reporters).
|
|
173
|
+
*
|
|
174
|
+
* @returns The JUnit report body as a string.
|
|
175
|
+
*/
|
|
176
|
+
downloadRunJunitReport: (runId: string, options?: RequestOptions) => Promise<string>;
|
|
177
|
+
/**
|
|
178
|
+
* Fetch test-run log output. The server may return either log content
|
|
179
|
+
* inline or a redirect/URL string — both are returned verbatim as text.
|
|
180
|
+
*/
|
|
181
|
+
getRunLogs: (runId: string, options?: RequestOptions) => Promise<string>;
|
|
182
|
+
/**
|
|
183
|
+
* Poll a test run's lightweight `/status/` endpoint until it reaches a
|
|
184
|
+
* terminal status.
|
|
185
|
+
*
|
|
186
|
+
* Transient network errors are retried; non-network errors propagate.
|
|
187
|
+
*
|
|
188
|
+
* @param runId - UUID of the test run to watch.
|
|
189
|
+
* @param onProgress - Invoked on every successful poll with the latest `TestRunState`
|
|
190
|
+
* (including the terminal one). Receives `finishedSteps`/`totalSteps`/`webappUrl`
|
|
191
|
+
* for in-flight progress UI.
|
|
192
|
+
* @param options.pollInterval - Poll interval in ms (default 2000).
|
|
193
|
+
* @param options.timeout - Wait timeout in ms (default 300_000 = 5 minutes).
|
|
194
|
+
* @throws {TimeoutError} When the run does not complete within the timeout.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* const run = await sdk.tests.watchRunProgress(
|
|
199
|
+
* runId,
|
|
200
|
+
* (s) => console.log(`${s.status} ${s.finishedSteps}/${s.totalSteps}`),
|
|
201
|
+
* { pollInterval: 3000, timeout: 600_000 },
|
|
202
|
+
* );
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
watchRunProgress: (runId: string, onProgress: (status: TestRunState) => void | Promise<void>, options?: {
|
|
206
|
+
pollInterval?: number;
|
|
207
|
+
timeout?: number;
|
|
208
|
+
} & RequestOptions) => Promise<TestRun>;
|
|
209
|
+
/**
|
|
210
|
+
* List debug artifacts (HARs, traces, etc.) produced by a test run.
|
|
211
|
+
*/
|
|
212
|
+
listRunDebugArtifacts: (runId: string, options?: RequestOptions) => Promise<DebugArtifactsListResponse>;
|
|
213
|
+
/**
|
|
214
|
+
* Fetch a single debug artifact (e.g. HAR, network trace) for a run.
|
|
215
|
+
*
|
|
216
|
+
* @param runId - UUID of the run.
|
|
217
|
+
* @param artifactType - Artifact discriminator (e.g. `'har'`).
|
|
218
|
+
*/
|
|
219
|
+
getRunDebugArtifact: (runId: string, artifactType: DebugArtifactByType, options?: RequestOptions) => Promise<DebugArtifact>;
|
|
220
|
+
/**
|
|
221
|
+
* Export a test as YAML (string) or ZIP (Uint8Array).
|
|
222
|
+
*
|
|
223
|
+
* @param testId - UUID of the test to export.
|
|
224
|
+
* @param fmt - `'yaml'` returns a string body; `'zip'` returns binary bytes.
|
|
225
|
+
* @returns YAML text or raw ZIP bytes, matching `fmt`.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* const yaml = await sdk.tests.export(testId, 'yaml');
|
|
230
|
+
* const zipBytes = await sdk.tests.export(testId, 'zip');
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export(testId: string, fmt: 'yaml', options?: RequestOptions): Promise<string>;
|
|
234
|
+
export(testId: string, fmt: 'zip', options?: RequestOptions): Promise<Uint8Array>;
|
|
235
|
+
/**
|
|
236
|
+
* Import a single test from YAML (string) or ZIP (Uint8Array). Returns the
|
|
237
|
+
* created test summary.
|
|
238
|
+
*
|
|
239
|
+
* @param payload - YAML text or raw ZIP bytes.
|
|
240
|
+
* @param fmt - Format matching `payload` (`'yaml'` or `'zip'`).
|
|
241
|
+
* @param options.conflictMode - How to resolve naming collisions on the server
|
|
242
|
+
* (e.g. `'rename'`). Forwarded as a query string parameter.
|
|
243
|
+
* @throws {ValidationError} When the server rejects the payload.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```typescript
|
|
247
|
+
* const yaml = await readFile('test.yaml', 'utf8');
|
|
248
|
+
* const test = await sdk.tests.import(yaml, 'yaml', { conflictMode: 'rename' });
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
import: (payload: string | Uint8Array, fmt: ImportFormat, options?: ImportTestOptions) => Promise<TestSummary>;
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=tests.d.ts.map
|
|
@@ -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C;IAC9E,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAkBjF;;;;;;;;;;;;;;;OAeG;IACH,MAAM,GACJ,SAAS,MAAM,GAAG,UAAU,EAC5B,KAAK,YAAY,EACjB,UAAS,iBAAsB,KAC9B,OAAO,CAAC,WAAW,CAAC,CASrB;CACH"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RequestOptions } from '../../types/config';
|
|
2
|
+
import type { RunTestRequest, TestRunState, TestRunsListQuery, TestsListQuery } from '@bugbug-io/api-schema';
|
|
3
|
+
export interface ImportTestOptions extends RequestOptions {
|
|
4
|
+
conflictMode?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ListTestsOptions extends RequestOptions {
|
|
7
|
+
cursor?: TestsListQuery['cursor'];
|
|
8
|
+
pageSize?: TestsListQuery['page_size'];
|
|
9
|
+
query?: TestsListQuery['query'];
|
|
10
|
+
ordering?: TestsListQuery['ordering'];
|
|
11
|
+
}
|
|
12
|
+
export interface ListTestRunsOptions extends RequestOptions {
|
|
13
|
+
cursor?: TestRunsListQuery['cursor'];
|
|
14
|
+
pageSize?: TestRunsListQuery['page_size'];
|
|
15
|
+
ordering?: TestRunsListQuery['ordering'];
|
|
16
|
+
startedAfter?: TestRunsListQuery['started_after'];
|
|
17
|
+
startedBefore?: TestRunsListQuery['started_before'];
|
|
18
|
+
status?: TestRunsListQuery['status'];
|
|
19
|
+
testId?: TestRunsListQuery['testId'];
|
|
20
|
+
}
|
|
21
|
+
export interface RunTestBaseOptions extends RequestOptions {
|
|
22
|
+
profileName?: string;
|
|
23
|
+
variables?: NonNullable<RunTestRequest['variables']>;
|
|
24
|
+
}
|
|
25
|
+
export interface RunTestWatchProgressOptions extends RunTestBaseOptions {
|
|
26
|
+
watchProgress: true;
|
|
27
|
+
pollInterval?: number;
|
|
28
|
+
timeout?: number;
|
|
29
|
+
onProgress?: (status: TestRunState) => void | Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export interface RunTestNoWatchProgressOptions extends RunTestBaseOptions {
|
|
32
|
+
watchProgress?: false;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=tests.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tests.types.d.ts","sourceRoot":"","sources":["../../../src/modules/tests/tests.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,MAAM,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAClD,aAAa,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,2BAA4B,SAAQ,kBAAkB;IACrE,aAAa,EAAE,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,6BAA8B,SAAQ,kBAAkB;IACvE,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ImportFormat } from '@bugbug-io/api-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Build a multipart form payload for `POST /tests/import/`.
|
|
4
|
+
*
|
|
5
|
+
* The endpoint expects a single `file` part. YAML payloads are sent as
|
|
6
|
+
* `application/x-yaml`; ZIP payloads as `application/zip`. The filename is
|
|
7
|
+
* cosmetic but required so the server's content-disposition parser accepts
|
|
8
|
+
* the upload.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildTestImportFormData(payload: string | Uint8Array, fmt: ImportFormat): FormData;
|
|
11
|
+
//# sourceMappingURL=tests.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tests.utils.d.ts","sourceRoot":"","sources":["../../../src/modules/tests/tests.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE,GAAG,EAAE,YAAY,GAAG,QAAQ,CAUjG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BugBugApiClient } from '../../services/apiClient/apiClient';
|
|
2
|
+
import type { RequestOptions } from '../../types/config';
|
|
3
|
+
import type { CreateVariableOptions, UpdateVariableOptions } from './variables.types';
|
|
4
|
+
import type { CreatedVariable, Variable, VariablesListResponse } from '@bugbug-io/api-schema';
|
|
5
|
+
export declare class VariablesModule {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(client: BugBugApiClient);
|
|
8
|
+
list: (options?: RequestOptions) => Promise<VariablesListResponse>;
|
|
9
|
+
get: (key: string, options?: RequestOptions) => Promise<Variable>;
|
|
10
|
+
create: (options: CreateVariableOptions) => Promise<CreatedVariable>;
|
|
11
|
+
update: (key: string, options: UpdateVariableOptions) => Promise<Variable>;
|
|
12
|
+
}
|
|
13
|
+
export type { CreatedVariable, Variable, VariablesListResponse };
|
|
14
|
+
//# sourceMappingURL=variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/modules/variables/variables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9F,qBAAa,eAAe;;gBAGd,MAAM,EAAE,eAAe;IAInC,IAAI,GAAU,UAAS,cAAmB,KAAG,OAAO,CAAC,qBAAqB,CAAC,CACT;IAElE,GAAG,GAAU,KAAK,MAAM,EAAE,UAAS,cAAmB,KAAG,OAAO,CAAC,QAAQ,CAAC,CAIrE;IAEL,MAAM,GAAU,SAAS,qBAAqB,KAAG,OAAO,CAAC,eAAe,CAAC,CAavE;IAEF,MAAM,GAAU,KAAK,MAAM,EAAE,SAAS,qBAAqB,KAAG,OAAO,CAAC,QAAQ,CAAC,CAa7E;CACH;AAED,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RequestOptions } from '../../types/config';
|
|
2
|
+
import type { CreateVariableRequest, UpdateVariableRequest } from '@bugbug-io/api-schema';
|
|
3
|
+
export interface CreateVariableOptions extends CreateVariableRequest, RequestOptions {
|
|
4
|
+
}
|
|
5
|
+
export interface UpdateVariableOptions extends UpdateVariableRequest, RequestOptions {
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=variables.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variables.types.d.ts","sourceRoot":"","sources":["../../../src/modules/variables/variables.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB,EAAE,cAAc;CAAG;AAEvF,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB,EAAE,cAAc;CAAG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const VISUAL_REGRESSION_RESOLUTION_ACTIONS: readonly ["acceptBaseline", "increaseMaxDifference"];
|
|
2
|
+
export type VisualRegressionResolutionAction = (typeof VISUAL_REGRESSION_RESOLUTION_ACTIONS)[number];
|
|
3
|
+
export declare const VISUAL_REGRESSION_RESOLUTION_TYPE_BY_ACTION: {
|
|
4
|
+
readonly acceptBaseline: "set_new_reference";
|
|
5
|
+
readonly increaseMaxDifference: "set_new_max_difference";
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=visualRegression.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualRegression.constants.d.ts","sourceRoot":"","sources":["../../../src/modules/visualRegression/visualRegression.constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oCAAoC,sDAGvC,CAAC;AAEX,MAAM,MAAM,gCAAgC,GAC1C,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,2CAA2C;;;CAGqC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { BugBugApiClient } from '../../services/apiClient/apiClient';
|
|
2
|
+
import type { RequestOptions } from '../../types/config';
|
|
3
|
+
import type { VisualRegressionResolutionType, VisualRegressionResolveResponse } from './visualRegression.types';
|
|
4
|
+
import type { VisualRegressionRefScreenshot, VisualRegressionRefScreenshotCreate, VisualRegressionRefScreenshotPatch, VisualRegressionRefScreenshotsListQuery, VisualRegressionRefScreenshotsListResponse } from '@bugbug-io/api-schema';
|
|
5
|
+
/**
|
|
6
|
+
* Visual regression module — manage reference screenshots that anchor
|
|
7
|
+
* element/page visual-regression steps.
|
|
8
|
+
*
|
|
9
|
+
* A reference screenshot represents the "expected" pixels for a step; the
|
|
10
|
+
* runner compares each run's screenshot against the active reference.
|
|
11
|
+
*/
|
|
12
|
+
export declare class VisualRegressionModule {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(client: BugBugApiClient);
|
|
15
|
+
/**
|
|
16
|
+
* List reference screenshots for a given step.
|
|
17
|
+
*
|
|
18
|
+
* @param options.stepId - UUID of the visual-regression step (required).
|
|
19
|
+
* @param options.cursor - Opaque cursor returned as `nextToken` by the previous page.
|
|
20
|
+
* @param options.pageSize - Items per page.
|
|
21
|
+
*/
|
|
22
|
+
listReferenceScreenshots: (options: {
|
|
23
|
+
stepId: VisualRegressionRefScreenshotsListQuery["step_id"];
|
|
24
|
+
cursor?: VisualRegressionRefScreenshotsListQuery["cursor"];
|
|
25
|
+
pageSize?: VisualRegressionRefScreenshotsListQuery["page_size"];
|
|
26
|
+
} & RequestOptions) => Promise<VisualRegressionRefScreenshotsListResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Fetch a single reference screenshot.
|
|
29
|
+
*
|
|
30
|
+
* @throws {NotFoundError} When no reference screenshot matches `id`.
|
|
31
|
+
*/
|
|
32
|
+
getReferenceScreenshot: (id: string, options?: RequestOptions) => Promise<VisualRegressionRefScreenshot>;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new reference screenshot for a visual-regression step.
|
|
35
|
+
*
|
|
36
|
+
* @throws {ValidationError} On invalid payload.
|
|
37
|
+
*/
|
|
38
|
+
createReferenceScreenshot: (data: VisualRegressionRefScreenshotCreate, options?: RequestOptions) => Promise<VisualRegressionRefScreenshot>;
|
|
39
|
+
/**
|
|
40
|
+
* Patch a reference screenshot.
|
|
41
|
+
*
|
|
42
|
+
* @throws {NotFoundError} When the reference screenshot does not exist.
|
|
43
|
+
* @throws {ValidationError} On invalid payload.
|
|
44
|
+
*/
|
|
45
|
+
updateReferenceScreenshot: (id: string, data: VisualRegressionRefScreenshotPatch, options?: RequestOptions) => Promise<VisualRegressionRefScreenshot>;
|
|
46
|
+
/**
|
|
47
|
+
* Delete a reference screenshot.
|
|
48
|
+
*
|
|
49
|
+
* @throws {NotFoundError} When the reference screenshot does not exist.
|
|
50
|
+
*/
|
|
51
|
+
deleteReferenceScreenshot: (id: string, options?: RequestOptions) => Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve failed visual-regression checks.
|
|
54
|
+
*
|
|
55
|
+
* @param options.type - `set_new_reference` accepts the observed screenshot as the new
|
|
56
|
+
* baseline; `set_new_max_difference` raises the step's allowed difference to just above
|
|
57
|
+
* the observed value. The value is computed server-side and cannot be supplied.
|
|
58
|
+
* @param options.stepRunId - Resolve a single step run.
|
|
59
|
+
* @param options.testRunId - Resolve every failed visual-regression step in a test run.
|
|
60
|
+
*
|
|
61
|
+
* Provide exactly one of `stepRunId` or `testRunId`.
|
|
62
|
+
*/
|
|
63
|
+
resolveReview: (options: {
|
|
64
|
+
type: VisualRegressionResolutionType;
|
|
65
|
+
testRunId?: string;
|
|
66
|
+
stepRunId?: string;
|
|
67
|
+
} & RequestOptions) => Promise<VisualRegressionResolveResponse>;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=visualRegression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualRegression.d.ts","sourceRoot":"","sources":["../../../src/modules/visualRegression/visualRegression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,6BAA6B,EAC7B,mCAAmC,EACnC,kCAAkC,EAClC,uCAAuC,EACvC,0CAA0C,EAC3C,MAAM,uBAAuB,CAAC;AAE/B;;;;;;GAMG;AACH,qBAAa,sBAAsB;;gBAGrB,MAAM,EAAE,eAAe;IAInC;;;;;;OAMG;IACH,wBAAwB,GACtB,SAAS;QACP,MAAM,EAAE,uCAAuC,CAAC,SAAS,CAAC,CAAC;QAC3D,MAAM,CAAC,EAAE,uCAAuC,CAAC,QAAQ,CAAC,CAAC;QAC3D,QAAQ,CAAC,EAAE,uCAAuC,CAAC,WAAW,CAAC,CAAC;KACjE,GAAG,cAAc,KACjB,OAAO,CAAC,0CAA0C,CAAC,CASpD;IAEF;;;;OAIG;IACH,sBAAsB,GACpB,IAAI,MAAM,EACV,UAAS,cAAmB,KAC3B,OAAO,CAAC,6BAA6B,CAAC,CAIrC;IAEJ;;;;OAIG;IACH,yBAAyB,GACvB,MAAM,mCAAmC,EACzC,UAAS,cAAmB,KAC3B,OAAO,CAAC,6BAA6B,CAAC,CAIpC;IAEL;;;;;OAKG;IACH,yBAAyB,GACvB,IAAI,MAAM,EACV,MAAM,kCAAkC,EACxC,UAAS,cAAmB,KAC3B,OAAO,CAAC,6BAA6B,CAAC,CAIrC;IAEJ;;;;OAIG;IACH,yBAAyB,GAAU,IAAI,MAAM,EAAE,UAAS,cAAmB,KAAG,OAAO,CAAC,IAAI,CAAC,CAItF;IAEL;;;;;;;;;;OAUG;IACH,aAAa,GACX,SAAS;QACP,IAAI,EAAE,8BAA8B,CAAC;QACrC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,cAAc,KACjB,OAAO,CAAC,+BAA+B,CAAC,CAUzC;CACH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type VisualRegressionResolutionType = 'set_new_reference' | 'set_new_max_difference';
|
|
2
|
+
export interface VisualRegressionResolveResult {
|
|
3
|
+
stepId: string;
|
|
4
|
+
stepRunId: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
referenceUrl?: string;
|
|
7
|
+
visualRegressionMaxDiff?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface VisualRegressionResolveResponse {
|
|
10
|
+
results: VisualRegressionResolveResult[];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=visualRegression.types.d.ts.map
|