@browserstack/mcp-server 2.2.5-beta.2 → 2.2.5-beta.3

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 (36) hide show
  1. package/dist/lib/accessibility-routing.d.ts +5 -0
  2. package/dist/lib/accessibility-routing.js +5 -0
  3. package/dist/server-factory.js +6 -1
  4. package/dist/tools/accessibility.js +588 -67
  5. package/dist/tools/accessiblity-utils/app-report-fetcher.d.ts +341 -0
  6. package/dist/tools/accessiblity-utils/app-report-fetcher.js +731 -0
  7. package/dist/tools/accessiblity-utils/paginate.d.ts +21 -0
  8. package/dist/tools/accessiblity-utils/paginate.js +44 -0
  9. package/dist/tools/accessiblity-utils/report-fetcher.d.ts +116 -7
  10. package/dist/tools/accessiblity-utils/report-fetcher.js +273 -30
  11. package/dist/tools/accessiblity-utils/report-parser.d.ts +41 -1
  12. package/dist/tools/accessiblity-utils/report-parser.js +142 -43
  13. package/dist/tools/appautomate-utils/appium-sdk/config-generator.d.ts +2 -0
  14. package/dist/tools/appautomate-utils/appium-sdk/config-generator.js +15 -5
  15. package/dist/tools/appautomate-utils/appium-sdk/constants.d.ts +2 -1
  16. package/dist/tools/appautomate-utils/appium-sdk/constants.js +6 -1
  17. package/dist/tools/appautomate-utils/appium-sdk/handler.js +11 -1
  18. package/dist/tools/appautomate-utils/appium-sdk/instructions.d.ts +3 -1
  19. package/dist/tools/appautomate-utils/appium-sdk/instructions.js +2 -2
  20. package/dist/tools/appautomate-utils/appium-sdk/languages/accessibility.d.ts +2 -0
  21. package/dist/tools/appautomate-utils/appium-sdk/languages/accessibility.js +32 -0
  22. package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.d.ts +3 -1
  23. package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.js +19 -6
  24. package/dist/tools/appautomate-utils/native-execution/appautomate.d.ts +7 -2
  25. package/dist/tools/appautomate-utils/native-execution/appautomate.js +15 -12
  26. package/dist/tools/appautomate-utils/native-execution/constants.d.ts +2 -1
  27. package/dist/tools/appautomate-utils/native-execution/constants.js +6 -1
  28. package/dist/tools/appautomate.js +29 -16
  29. package/dist/tools/failurelogs-utils/app-automate.js +1 -1
  30. package/dist/tools/testmanagement-utils/create-testrun.d.ts +1 -1
  31. package/dist/tools/testmanagement-utils/update-testrun.d.ts +1 -1
  32. package/dist/tools/tool-handoff.d.ts +5 -4
  33. package/dist/tools/tool-handoff.js +5 -10
  34. package/package.json +1 -1
  35. package/dist/tools/accessiblity-utils/accessibility-rag.d.ts +0 -12
  36. package/dist/tools/accessiblity-utils/accessibility-rag.js +0 -59
@@ -0,0 +1,341 @@
1
+ /**
2
+ * App Accessibility: the issues of a mobile app build run through App Automate with
3
+ * accessibility on. Unlike the web products there is no CSV export behind an access key,
4
+ * so the issues come inline, one API page per batch of scanned screens.
5
+ */
6
+ export declare const APP_API_BASE = "https://api-app-accessibility.browserstack.com/automate/api/v1";
7
+ export declare const APP_DASHBOARD = "https://app-accessibility.browserstack.com";
8
+ /** Manual (Workflow Analyzer) reports recorded on the dashboard: a separate, older route. */
9
+ export declare const MANUAL_API_BASE = "https://api-app-accessibility.browserstack.com/api/v1";
10
+ export declare const MAX_SNAPSHOT_PAGES = 20;
11
+ /** A dashboard link names a build by number; a build someone just opened is among the newest. */
12
+ export declare const MAX_APP_BUILD_LIST_PAGES = 3;
13
+ export declare const MAX_APP_AUTOMATE_BUILD_PAGES = 3;
14
+ export interface AppBuildMeta {
15
+ /** The build's number within its project, which the dashboard link uses. */
16
+ build_id: number;
17
+ created_at?: string;
18
+ th_build_id: string;
19
+ name: string;
20
+ normalised_name: string;
21
+ project_name: string;
22
+ /** running | rule_processing | passed | failed | timeout | update_os_version */
23
+ status: string;
24
+ issue_summary?: {
25
+ total?: number;
26
+ scan_count?: number;
27
+ };
28
+ fup?: {
29
+ capped?: boolean;
30
+ tests_partial?: boolean;
31
+ tests_dropped?: boolean;
32
+ };
33
+ /** What ran the tests: an SDK framework (pytest, …) or a native one (Espresso-Junit4, …). */
34
+ session_data?: {
35
+ framework?: {
36
+ name?: string;
37
+ };
38
+ };
39
+ }
40
+ interface AppRuleIssue {
41
+ uid: string;
42
+ status?: string;
43
+ duplication_count?: number;
44
+ issue_class_android?: string;
45
+ issue_class_ios?: string;
46
+ issue_id_android?: string;
47
+ issue_id_ios?: string;
48
+ how_to_fix_desc?: string;
49
+ issue_details?: {
50
+ label?: string;
51
+ value?: unknown;
52
+ }[];
53
+ }
54
+ interface AppRule {
55
+ rule_id: string;
56
+ label: string;
57
+ description?: string;
58
+ severity?: string;
59
+ guidelines?: {
60
+ message?: string;
61
+ }[];
62
+ rule_issues?: AppRuleIssue[];
63
+ }
64
+ export interface AppSnapshot {
65
+ meta?: {
66
+ screenshot_url?: string;
67
+ testcase_name?: string;
68
+ /** A manual report's snapshot keeps its rules here. */
69
+ aggregated_results?: AppRule[];
70
+ };
71
+ aggregated_results?: AppRule[];
72
+ }
73
+ export type AppAccessibilityIssue = {
74
+ issue_type: string;
75
+ rule_id: string;
76
+ severity: string;
77
+ /** Which scanned screen of which test the element was on. */
78
+ screen: string;
79
+ /** The element's id when it has one, else its class. */
80
+ component: string;
81
+ /** The element's identifying details, as captured on the device. */
82
+ element: Record<string, unknown>;
83
+ issue_description: string;
84
+ how_to_fix: string;
85
+ /** The WCAG success criteria the rule maps to. */
86
+ wcag: string;
87
+ screenshot?: string;
88
+ /** How many more occurrences of this issue the report folded into it. */
89
+ duplicate_count?: number;
90
+ };
91
+ /** A report's issues counted by severity, by rule and by screen, largest first. */
92
+ export interface AppIssueSummary {
93
+ by_severity: Record<string, number>;
94
+ by_rule: {
95
+ rule_id: string;
96
+ issue_type: string;
97
+ count: number;
98
+ }[];
99
+ by_screen: {
100
+ screen: string;
101
+ count: number;
102
+ }[];
103
+ }
104
+ export interface AppBuildReport {
105
+ records: AppAccessibilityIssue[];
106
+ page_length: number;
107
+ total_issues: number;
108
+ next_page: number | null;
109
+ /** How many issues the pages after this one hold. */
110
+ remaining: number;
111
+ summary: AppIssueSummary;
112
+ /** Issues hidden in the dashboard, which the API leaves out of the screens. */
113
+ hidden_issues: number;
114
+ scan_count: number;
115
+ status: string;
116
+ build_name: string;
117
+ dashboard_link?: string;
118
+ /** Whether the fair-usage cap dropped tests or scans from this build. */
119
+ fup_capped: boolean;
120
+ /** The test framework the build ran under, when the build's details name it. */
121
+ framework?: string;
122
+ }
123
+ /** A manual (Workflow Analyzer) report's issues, read inline from its scanned screens. */
124
+ export interface AppManualReport {
125
+ records: AppAccessibilityIssue[];
126
+ page_length: number;
127
+ /** Every occurrence the API lists; the dashboard folds duplicates it does not mark. */
128
+ total_issues: number;
129
+ next_page: number | null;
130
+ /** How many issues the pages after this one hold. */
131
+ remaining: number;
132
+ summary: AppIssueSummary;
133
+ dashboard_count: number;
134
+ duplicate_occurrences: number;
135
+ hidden_issues: number;
136
+ scan_count: number;
137
+ /** complete | in_progress */
138
+ status: string;
139
+ report_name: string;
140
+ device?: string;
141
+ dashboard_link: string;
142
+ }
143
+ /** Every issue of one app build, with what a comparison needs to know of the build. */
144
+ export interface AppBuildIssues {
145
+ buildId: string;
146
+ build_name: string;
147
+ build_number: number;
148
+ created_at?: string;
149
+ status: string;
150
+ scan_count: number;
151
+ /** The tests whose screens were scanned, in the order first seen. */
152
+ tests: string[];
153
+ issues: AppAccessibilityIssue[];
154
+ }
155
+ /** An earlier build of a project, as the build list names it. */
156
+ export interface AppBuildRef {
157
+ buildId: string;
158
+ name?: string;
159
+ build_number?: number;
160
+ created_at?: string;
161
+ /** Whether it has the later build's name; a native run's builds are each named apart. */
162
+ same_name: boolean;
163
+ /**
164
+ * Whether the project's whole build list was read. When it was not, a build of the same
165
+ * name may still be further back than the newest builds read.
166
+ */
167
+ searched_all: boolean;
168
+ }
169
+ export interface AppProjectRow {
170
+ id: number;
171
+ name: string;
172
+ created_at?: string;
173
+ }
174
+ /** A build as the listing tool shows it: what it is, how it went, and how to read it. */
175
+ export interface AppBuildRow {
176
+ buildId: string;
177
+ build_number?: number;
178
+ name: string;
179
+ status?: string;
180
+ report_status?: string;
181
+ created_at?: string;
182
+ scan_count: number;
183
+ issues: {
184
+ total: number;
185
+ critical: number;
186
+ serious: number;
187
+ moderate: number;
188
+ minor: number;
189
+ };
190
+ app?: string;
191
+ framework?: string;
192
+ dashboard_link: string;
193
+ }
194
+ export interface AppManualReportRow {
195
+ reportId: string;
196
+ name: string;
197
+ status?: string;
198
+ created_at?: string;
199
+ app?: string;
200
+ scan_count: number;
201
+ issues: {
202
+ total: number;
203
+ critical: number;
204
+ serious: number;
205
+ moderate: number;
206
+ minor: number;
207
+ duplicates: number;
208
+ hidden: number;
209
+ };
210
+ dashboard_link: string;
211
+ }
212
+ /** One row per element with an issue, most severe first. Screens are numbered in order. */
213
+ export declare function flattenAppSnapshots(details: AppSnapshot[]): AppAccessibilityIssue[];
214
+ /** The issues counted by severity, by rule and by screen, largest first. */
215
+ export declare function summarizeAppIssues(rows: AppAccessibilityIssue[]): AppIssueSummary;
216
+ /**
217
+ * Which issues of two builds are the same issue. Issues that look alike (one rule on
218
+ * elements known by neither id nor label) are paired one for one, those on the same screen
219
+ * and spot first, then on the same screen, then any; what is left over in either build is
220
+ * new or resolved. So new and still open add up to the later build's issues, and resolved
221
+ * and still open to the earlier one's.
222
+ */
223
+ export declare function compareAppIssues(before: AppAccessibilityIssue[], after: AppAccessibilityIssue[]): {
224
+ added: AppAccessibilityIssue[];
225
+ resolved: AppAccessibilityIssue[];
226
+ retained: number;
227
+ };
228
+ /** The id a manual report's dashboard link names (`/report/{uuid}`), if it is one. */
229
+ export declare function manualReportIdFromDashboardLink(url: URL): string | undefined;
230
+ /** A manual report has no status of its own; it is complete once it has ended. */
231
+ export declare function manualReportStatus(detail: {
232
+ meta_data?: {
233
+ ended_at?: string | null;
234
+ };
235
+ }): string;
236
+ export declare class AppAccessibilityApi {
237
+ private readonly headers;
238
+ constructor(headers: () => Record<string, string> | undefined);
239
+ /** The build's details, or undefined when the API does not know the id. */
240
+ buildMeta(buildId: string): Promise<AppBuildMeta | undefined>;
241
+ /**
242
+ * The id of the build an App Accessibility dashboard link points at, if it is one: the
243
+ * project's newest builds, by number. (The list's name filter would not do: the link
244
+ * carries TestHub's name for the build, which the filter does not match.)
245
+ */
246
+ buildIdFromDashboardLink(url: URL): Promise<string | undefined>;
247
+ /**
248
+ * The accessibility build of an App Automate build or session link. An SDK (Appium)
249
+ * session's test code carries the TestHub build id its results went to, which is the
250
+ * App Accessibility build when accessibility was on; a build link goes through any one
251
+ * of its sessions. A native (Espresso, XCUITest) build has no SDK session, and is found
252
+ * by name instead.
253
+ */
254
+ buildIdFromAppAutomateLink(url: URL): Promise<string | undefined>;
255
+ private buildOfSdkSession;
256
+ /** The first SDK session of an App Automate build; a native build lists none. */
257
+ private anySdkSession;
258
+ /**
259
+ * A native build's details name its project and when it started; App Accessibility lists
260
+ * the run under the same project, created as it started, and named as the App Automate
261
+ * build list names it ("Build #N: app vX"). The start finds it among the project's newest
262
+ * builds; the name, read from the account's build list, tells runs that started together
263
+ * apart, and finds a run older than those.
264
+ */
265
+ private buildOfNativeBuild;
266
+ /** A native build's project and start, from whichever framework API knows the build. */
267
+ private nativeBuild;
268
+ /** The project's builds created within moments of a run's start, newest first. */
269
+ private buildsStartedNear;
270
+ /** The build's name in the account's App Automate build list, walked newest first. */
271
+ private appAutomateBuildName;
272
+ /** The App Accessibility project of that exact name, if any. */
273
+ private projectId;
274
+ /** The projects whose name contains `name`, as the API searches it. */
275
+ private projectsNamed;
276
+ /**
277
+ * A listing's page. The API answers an empty list with 404 ("No builds found") for
278
+ * access-key callers, which is not an error here; any other failure is, a 404 from a
279
+ * wrong route or a missing permission included.
280
+ */
281
+ private listing;
282
+ /** The newest projects, as many as asked for. */
283
+ listAppProjects(limit: number): Promise<{
284
+ projects: AppProjectRow[];
285
+ total: number;
286
+ }>;
287
+ /**
288
+ * A project's newest builds, by exact project name, optionally filtered by build name.
289
+ * A project name that matches none exactly names the near matches, so the agent can
290
+ * pick rather than guess.
291
+ */
292
+ listAppBuilds(projectName: string, buildName: string | undefined, limit: number): Promise<{
293
+ project: {
294
+ id: number;
295
+ name: string;
296
+ };
297
+ total: number;
298
+ builds: AppBuildRow[];
299
+ }>;
300
+ /** The newest manual reports, optionally filtered by name. */
301
+ listAppManualReports(name: string | undefined, limit: number): Promise<{
302
+ total: number;
303
+ reports: AppManualReportRow[];
304
+ }>;
305
+ /** A manual report's details, or undefined when the API does not know the id. */
306
+ manualReport(reportId: string): Promise<any | undefined>;
307
+ /**
308
+ * A manual report's issues, every occurrence the API lists, most severe first. The
309
+ * dashboard's own count comes from the report's summary: it folds duplicates that the
310
+ * issue rows do not mark, so the two numbers are both given.
311
+ */
312
+ appReportIssues(reportId: string, cursor?: number, maxCharacterLength?: number): Promise<AppManualReport>;
313
+ /**
314
+ * The id of the project's build that `pick` accepts, newest first, within the first
315
+ * pages; `buildName` narrows the list to builds named like it, when the name is known
316
+ * to be the build's own.
317
+ */
318
+ private findBuild;
319
+ /**
320
+ * The project's builds a page at a time, newest first, within the first pages; `more`
321
+ * says whether the list goes on past the page.
322
+ */
323
+ private projectBuilds;
324
+ /**
325
+ * The build before this one in its project: the newest earlier build of the same name,
326
+ * as an SDK suite keeps its name from run to run, or else the build just before it, as
327
+ * each native (Espresso, XCUITest) run is named apart. None for a project's first build.
328
+ */
329
+ previousBuild(buildId: string): Promise<AppBuildRef | undefined>;
330
+ /** The build's page on the App Accessibility dashboard, when its project can be found. */
331
+ private dashboardLink;
332
+ /** Every scanned screen of the build, and how many issues the dashboard hides. */
333
+ private snapshots;
334
+ private requireBuildMeta;
335
+ /** The build's details and scanned screens; a build with no scans has none to read. */
336
+ private readBuild;
337
+ /** Every issue of the build at once, to compare it with another. */
338
+ buildIssues(buildId: string): Promise<AppBuildIssues>;
339
+ report(buildId: string, cursor?: number, maxCharacterLength?: number): Promise<AppBuildReport>;
340
+ }
341
+ export {};