@browserstack/mcp-server 2.2.6-beta.2 → 2.2.6
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/server-factory.js +1 -6
- package/dist/tools/accessibility.js +69 -680
- package/dist/tools/accessiblity-utils/accessibility-rag.d.ts +12 -0
- package/dist/tools/accessiblity-utils/accessibility-rag.js +59 -0
- package/dist/tools/accessiblity-utils/report-fetcher.d.ts +7 -116
- package/dist/tools/accessiblity-utils/report-fetcher.js +29 -268
- package/dist/tools/accessiblity-utils/report-parser.d.ts +1 -41
- package/dist/tools/accessiblity-utils/report-parser.js +43 -142
- package/dist/tools/accessiblity-utils/scanner.d.ts +1 -15
- package/dist/tools/accessiblity-utils/scanner.js +4 -3
- package/dist/tools/appautomate-utils/appium-sdk/config-generator.d.ts +0 -2
- package/dist/tools/appautomate-utils/appium-sdk/config-generator.js +5 -15
- package/dist/tools/appautomate-utils/appium-sdk/constants.d.ts +1 -2
- package/dist/tools/appautomate-utils/appium-sdk/constants.js +1 -6
- package/dist/tools/appautomate-utils/appium-sdk/handler.js +1 -12
- package/dist/tools/appautomate-utils/appium-sdk/instructions.d.ts +1 -3
- package/dist/tools/appautomate-utils/appium-sdk/instructions.js +2 -2
- package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.d.ts +1 -3
- package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.js +6 -19
- package/dist/tools/appautomate-utils/native-execution/appautomate.d.ts +2 -7
- package/dist/tools/appautomate-utils/native-execution/appautomate.js +12 -15
- package/dist/tools/appautomate-utils/native-execution/constants.d.ts +1 -2
- package/dist/tools/appautomate-utils/native-execution/constants.js +1 -6
- package/dist/tools/appautomate.js +16 -29
- package/dist/tools/testmanagement-utils/create-testrun.d.ts +1 -1
- package/dist/tools/testmanagement-utils/update-testrun.d.ts +1 -1
- package/dist/tools/tool-handoff.d.ts +2 -3
- package/dist/tools/tool-handoff.js +2 -3
- package/package.json +1 -1
- package/dist/lib/accessibility-routing.d.ts +0 -6
- package/dist/lib/accessibility-routing.js +0 -6
- package/dist/tools/accessiblity-utils/app-report-fetcher.d.ts +0 -412
- package/dist/tools/accessiblity-utils/app-report-fetcher.js +0 -926
- package/dist/tools/accessiblity-utils/paginate.d.ts +0 -27
- package/dist/tools/accessiblity-utils/paginate.js +0 -50
- package/dist/tools/appautomate-utils/appium-sdk/languages/accessibility.d.ts +0 -4
- package/dist/tools/appautomate-utils/appium-sdk/languages/accessibility.js +0 -47
|
@@ -1,27 +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
|
-
/**
|
|
11
|
-
* How many characters of issue JSON one call hands out by default: about 2,500 tokens, so
|
|
12
|
-
* a page stays small next to a client's own limit on tool output while a large report
|
|
13
|
-
* still takes few calls.
|
|
14
|
-
*/
|
|
15
|
-
export declare const PAGE_CHARACTERS = 10000;
|
|
16
|
-
export interface Page<T> {
|
|
17
|
-
records: T[];
|
|
18
|
-
page_length: number;
|
|
19
|
-
/** Character offset of the next page, or null when this was the last. */
|
|
20
|
-
next_page: number | null;
|
|
21
|
-
/** How many rows the pages after this one hold. */
|
|
22
|
-
remaining: number;
|
|
23
|
-
}
|
|
24
|
-
export declare function pageOf<T>(all: T[], { maxCharacterLength, nextPage }?: {
|
|
25
|
-
maxCharacterLength?: number | undefined;
|
|
26
|
-
nextPage?: number | undefined;
|
|
27
|
-
}): Page<T>;
|
|
@@ -1,50 +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
|
-
/**
|
|
17
|
-
* How many characters of issue JSON one call hands out by default: about 2,500 tokens, so
|
|
18
|
-
* a page stays small next to a client's own limit on tool output while a large report
|
|
19
|
-
* still takes few calls.
|
|
20
|
-
*/
|
|
21
|
-
export const PAGE_CHARACTERS = 10_000;
|
|
22
|
-
export function pageOf(all, { maxCharacterLength = PAGE_CHARACTERS, nextPage = 0 } = {}) {
|
|
23
|
-
// Walk to the starting offset
|
|
24
|
-
let charCursor = 0;
|
|
25
|
-
let idx = 0;
|
|
26
|
-
for (; idx < all.length; idx++) {
|
|
27
|
-
const len = JSON.stringify(all[idx]).length;
|
|
28
|
-
if (charCursor + len > nextPage)
|
|
29
|
-
break;
|
|
30
|
-
charCursor += len;
|
|
31
|
-
}
|
|
32
|
-
// Collect up to maxCharacterLength; a row larger than that still makes a page of its
|
|
33
|
-
// own, or the cursor would never move past it
|
|
34
|
-
const page = [];
|
|
35
|
-
for (let i = idx; i < all.length; i++) {
|
|
36
|
-
const recStr = JSON.stringify(all[i]);
|
|
37
|
-
const fits = charCursor - nextPage + recStr.length <= maxCharacterLength;
|
|
38
|
-
if (!fits && page.length > 0)
|
|
39
|
-
break;
|
|
40
|
-
page.push(all[i]);
|
|
41
|
-
charCursor += recStr.length;
|
|
42
|
-
}
|
|
43
|
-
const remaining = all.length - idx - page.length;
|
|
44
|
-
return {
|
|
45
|
-
records: page,
|
|
46
|
-
page_length: page.length,
|
|
47
|
-
next_page: remaining > 0 ? charCursor : null,
|
|
48
|
-
remaining,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AppSDKSupportedLanguage, AppSDKSupportedTestingFramework } from "../index.js";
|
|
2
|
-
/** Says the checks were asked for but not set up, for a framework this setup leaves them off. */
|
|
3
|
-
export declare function getAppAccessibilityNotSetUpInstructions(testingFramework: AppSDKSupportedTestingFramework): string | undefined;
|
|
4
|
-
export declare function getAppAccessibilityChecksInstructions(language: AppSDKSupportedLanguage, testingFramework: AppSDKSupportedTestingFramework): string;
|
|
@@ -1,47 +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
|
-
/**
|
|
20
|
-
* The frameworks set up without a browserstack.yml whose setup here does not turn App
|
|
21
|
-
* Accessibility on; guidance for a config that was never written would only mislead.
|
|
22
|
-
*/
|
|
23
|
-
const NOT_SET_UP = {
|
|
24
|
-
[AppSDKSupportedTestingFrameworkEnum.nightwatch]: "Nightwatch",
|
|
25
|
-
[AppSDKSupportedTestingFrameworkEnum.cucumberRuby]: "Cucumber (Ruby)",
|
|
26
|
-
};
|
|
27
|
-
/** Says the checks were asked for but not set up, for a framework this setup leaves them off. */
|
|
28
|
-
export function getAppAccessibilityNotSetUpInstructions(testingFramework) {
|
|
29
|
-
const label = NOT_SET_UP[testingFramework];
|
|
30
|
-
if (!label)
|
|
31
|
-
return undefined;
|
|
32
|
-
return createStep("App Accessibility checks", `App Accessibility checks are not set up for ${label}: this setup does not turn them on for it, so these tests run without them. To check the app, set the tests up in another framework this tool supports, such as WebdriverIO, pytest, TestNG or JUnit, with accessibility: true.`);
|
|
33
|
-
}
|
|
34
|
-
function driverAdvice(language, testingFramework) {
|
|
35
|
-
if (language === "python" &&
|
|
36
|
-
testingFramework === AppSDKSupportedTestingFrameworkEnum.pytest) {
|
|
37
|
-
return PYTEST_FIXTURE;
|
|
38
|
-
}
|
|
39
|
-
return "Create the driver in your framework's setup hook (a fixture, `@BeforeMethod`, `@BeforeEach`, `SetUp`, `before`), not inside the test body.";
|
|
40
|
-
}
|
|
41
|
-
export function getAppAccessibilityChecksInstructions(language, testingFramework) {
|
|
42
|
-
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)}
|
|
43
|
-
- 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.
|
|
44
|
-
- Android 11 or newer, or iOS 14 or newer, is required; older devices are skipped without an error.
|
|
45
|
-
- 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.
|
|
46
|
-
- 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.`);
|
|
47
|
-
}
|