@browserstack/mcp-server 2.2.5-beta.3 → 2.2.6-beta.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.
Files changed (36) hide show
  1. package/README.md +32 -194
  2. package/dist/server-factory.js +1 -6
  3. package/dist/tools/accessibility.js +62 -576
  4. package/dist/tools/accessiblity-utils/accessibility-rag.d.ts +12 -0
  5. package/dist/tools/accessiblity-utils/accessibility-rag.js +59 -0
  6. package/dist/tools/accessiblity-utils/report-fetcher.d.ts +7 -116
  7. package/dist/tools/accessiblity-utils/report-fetcher.js +29 -268
  8. package/dist/tools/accessiblity-utils/report-parser.d.ts +1 -41
  9. package/dist/tools/accessiblity-utils/report-parser.js +43 -142
  10. package/dist/tools/appautomate-utils/appium-sdk/config-generator.d.ts +0 -2
  11. package/dist/tools/appautomate-utils/appium-sdk/config-generator.js +5 -15
  12. package/dist/tools/appautomate-utils/appium-sdk/constants.d.ts +1 -2
  13. package/dist/tools/appautomate-utils/appium-sdk/constants.js +1 -6
  14. package/dist/tools/appautomate-utils/appium-sdk/handler.js +1 -11
  15. package/dist/tools/appautomate-utils/appium-sdk/instructions.d.ts +1 -3
  16. package/dist/tools/appautomate-utils/appium-sdk/instructions.js +2 -2
  17. package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.d.ts +1 -3
  18. package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.js +6 -19
  19. package/dist/tools/appautomate-utils/native-execution/appautomate.d.ts +2 -7
  20. package/dist/tools/appautomate-utils/native-execution/appautomate.js +12 -15
  21. package/dist/tools/appautomate-utils/native-execution/constants.d.ts +1 -2
  22. package/dist/tools/appautomate-utils/native-execution/constants.js +1 -6
  23. package/dist/tools/appautomate.js +16 -29
  24. package/dist/tools/testmanagement-utils/create-testrun.d.ts +1 -1
  25. package/dist/tools/testmanagement-utils/update-testrun.d.ts +1 -1
  26. package/dist/tools/tool-handoff.d.ts +2 -3
  27. package/dist/tools/tool-handoff.js +2 -3
  28. package/package.json +1 -1
  29. package/dist/lib/accessibility-routing.d.ts +0 -5
  30. package/dist/lib/accessibility-routing.js +0 -5
  31. package/dist/tools/accessiblity-utils/app-report-fetcher.d.ts +0 -341
  32. package/dist/tools/accessiblity-utils/app-report-fetcher.js +0 -731
  33. package/dist/tools/accessiblity-utils/paginate.d.ts +0 -21
  34. package/dist/tools/accessiblity-utils/paginate.js +0 -44
  35. package/dist/tools/appautomate-utils/appium-sdk/languages/accessibility.d.ts +0 -2
  36. package/dist/tools/appautomate-utils/appium-sdk/languages/accessibility.js +0 -32
@@ -1,21 +0,0 @@
1
- /**
2
- * How a report's issues are handed out: most severe first, in pages measured by the length
3
- * of their JSON, so that a page fits a client's context whatever the rows contain. The
4
- * cursor an agent passes back is the character offset the next page starts at.
5
- */
6
- /** Most severe first; an unknown severity sorts last. */
7
- export declare function sortBySeverity<T extends {
8
- severity: string;
9
- }>(rows: T[]): T[];
10
- export interface Page<T> {
11
- records: T[];
12
- page_length: number;
13
- /** Character offset of the next page, or null when this was the last. */
14
- next_page: number | null;
15
- /** How many rows the pages after this one hold. */
16
- remaining: number;
17
- }
18
- export declare function pageOf<T>(all: T[], { maxCharacterLength, nextPage }?: {
19
- maxCharacterLength?: number | undefined;
20
- nextPage?: number | undefined;
21
- }): Page<T>;
@@ -1,44 +0,0 @@
1
- /**
2
- * How a report's issues are handed out: most severe first, in pages measured by the length
3
- * of their JSON, so that a page fits a client's context whatever the rows contain. The
4
- * cursor an agent passes back is the character offset the next page starts at.
5
- */
6
- const SEVERITY_ORDER = {
7
- critical: 0,
8
- serious: 1,
9
- moderate: 2,
10
- minor: 3,
11
- };
12
- /** Most severe first; an unknown severity sorts last. */
13
- export function sortBySeverity(rows) {
14
- return rows.sort((a, b) => (SEVERITY_ORDER[a.severity] ?? 99) - (SEVERITY_ORDER[b.severity] ?? 99));
15
- }
16
- export function pageOf(all, { maxCharacterLength = 5000, nextPage = 0 } = {}) {
17
- // Walk to the starting offset
18
- let charCursor = 0;
19
- let idx = 0;
20
- for (; idx < all.length; idx++) {
21
- const len = JSON.stringify(all[idx]).length;
22
- if (charCursor + len > nextPage)
23
- break;
24
- charCursor += len;
25
- }
26
- // Collect up to maxCharacterLength; a row larger than that still makes a page of its
27
- // own, or the cursor would never move past it
28
- const page = [];
29
- for (let i = idx; i < all.length; i++) {
30
- const recStr = JSON.stringify(all[i]);
31
- const fits = charCursor - nextPage + recStr.length <= maxCharacterLength;
32
- if (!fits && page.length > 0)
33
- break;
34
- page.push(all[i]);
35
- charCursor += recStr.length;
36
- }
37
- const remaining = all.length - idx - page.length;
38
- return {
39
- records: page,
40
- page_length: page.length,
41
- next_page: remaining > 0 ? charCursor : null,
42
- remaining,
43
- };
44
- }
@@ -1,2 +0,0 @@
1
- import { AppSDKSupportedLanguage, AppSDKSupportedTestingFramework } from "../index.js";
2
- export declare function getAppAccessibilityChecksInstructions(language: AppSDKSupportedLanguage, testingFramework: AppSDKSupportedTestingFramework): string;
@@ -1,32 +0,0 @@
1
- // What an App Automate run needs for App Accessibility checks to happen, and how the
2
- // issues are read afterwards. Each point here cost a run that finished green with no
3
- // scans and no warning; the SDK says nothing when it decides not to scan.
4
- import { AppSDKSupportedTestingFrameworkEnum, createStep, } from "../index.js";
5
- const PYTEST_FIXTURE = `For pytest, create the driver in a fixture (\`conftest.py\`):
6
- \`\`\`python
7
- import pytest
8
- from appium import webdriver
9
- from appium.options.android import UiAutomator2Options # XCUITestOptions for iOS
10
-
11
-
12
- @pytest.fixture
13
- def driver():
14
- options = UiAutomator2Options()
15
- drv = webdriver.Remote("https://hub.browserstack.com/wd/hub", options=options)
16
- yield drv
17
- drv.quit()
18
- \`\`\``;
19
- function driverAdvice(language, testingFramework) {
20
- if (language === "python" &&
21
- testingFramework === AppSDKSupportedTestingFrameworkEnum.pytest) {
22
- return PYTEST_FIXTURE;
23
- }
24
- return "Create the driver in your framework's setup hook (a fixture, `@BeforeMethod`, `@BeforeEach`, `SetUp`, `before`), not inside the test body.";
25
- }
26
- export function getAppAccessibilityChecksInstructions(language, testingFramework) {
27
- return createStep("App Accessibility checks: what makes a scan happen, and how to read the issues", `- The SDK decides per test, at the test's start, whether to scan, from the drivers that exist at that moment. A driver created inside the test body is never scanned. ${driverAdvice(language, testingFramework)}
28
- - Scans run on interaction commands: click/tap, send keys, actions and navigation (such as back). Reads like \`find_elements\` or \`page_source\` do not scan. Interact with every screen state you want scanned.
29
- - Android 11 or newer, or iOS 14 or newer, is required; older devices are skipped without an error.
30
- - Under \`platforms\` write the OS version as \`osVersion\`, unquoted (\`osVersion: 14.0\`; not \`platformVersion\`, not \`"14.0"\`): with any other spelling the SDK still runs the tests but App Accessibility records no scans, without a message.
31
- - When the run ends, the SDK prints the build id as \`testhub id: <id>\` (also the id in its automation.browserstack.com/builds/<id> link). Read the issues with \`fetchAccessibilityIssues\`, \`buildId: <id>\`; it waits while the report is still processing and links the report on the App Accessibility dashboard (https://app-accessibility.browserstack.com/automated-tests). If it reports no scans, it lists the likely causes.`);
32
- }