Skip to content

Commit

Permalink
feat: Add types for WDA caps and settings (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Apr 7, 2024
1 parent 00513be commit 4b3c220
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 25 deletions.
22 changes: 0 additions & 22 deletions index.js

This file was deleted.

7 changes: 7 additions & 0 deletions index.ts
@@ -0,0 +1,7 @@
export { checkForDependencies, bundleWDASim } from './lib/check-dependencies';
export { NoSessionProxy } from './lib/no-session-proxy';
export { WebDriverAgent } from './lib/webdriveragent';
export { WDA_BASE_URL, WDA_RUNNER_BUNDLE_ID, PROJECT_FILE } from './lib/constants';
export { resetTestProcesses, BOOTSTRAP_PATH } from './lib/utils';

export * from './lib/types';
50 changes: 50 additions & 0 deletions lib/types.ts
@@ -0,0 +1,50 @@
// WebDriverAgentLib/Utilities/FBSettings.h
export interface WDASettings {
elementResponseAttribute?: string;
shouldUseCompactResponses?: boolean;
mjpegServerScreenshotQuality?: number;
mjpegServerFramerate?: number;
screenshotQuality?: number;
elementResponseAttributes?: string;
mjpegScalingFactor?: number;
mjpegFixOrientation?: boolean;
keyboardAutocorrection?: boolean;
keyboardPrediction?: boolean;
customSnapshotTimeout?: number;
snapshotMaxDepth?: number;
useFirstMatch?: boolean;
boundElementsByIndex?: boolean;
reduceMotion?: boolean;
defaultActiveApplication?: string;
activeAppDetectionPoint?: string;
includeNonModalElements?: boolean;
defaultAlertAction?: 'accept' | 'dismiss';
acceptAlertButtonSelector?: string;
dismissAlertButtonSelector?: string;
screenshotOrientation?: 'auto' | 'portrait' | 'portraitUpsideDown' | 'landscapeRight' | 'landscapeLeft'
waitForIdleTimeout?: number;
animationCoolOffTimeout?: number;
}

// WebDriverAgentLib/Utilities/FBCapabilities.h
export interface WDACapabilities {
bundleId?: string;
initialUrl?: string;
arguments?: string[];
environment?: Record<string, string>;
eventloopIdleDelaySec?: number;
shouldWaitForQuiescence?: boolean;
shouldUseTestManagerForVisibilityDetection?: boolean;
maxTypingFrequency?: number;
shouldUseSingletonTestManager?: boolean;
waitForIdleTimeout?: number;
shouldUseCompactResponses?: number;
elementResponseFields?: unknown;
disableAutomaticScreenshots?: boolean;
shouldTerminateApp?: boolean;
forceAppLaunch?: boolean;
useNativeCachingStrategy?: boolean;
forceSimulatorSoftwareKeyboardPresence?: boolean;
defaultAlertAction?: 'accept' | 'dismiss';
appLaunchStateTimeoutSec?: number;
}
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -3,6 +3,7 @@
"version": "8.4.0",
"description": "Package bundling WebDriverAgent",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"build": "tsc -b",
"dev": "npm run build -- --watch",
Expand Down Expand Up @@ -100,9 +101,9 @@
"teen_process": "^2.0.0"
},
"files": [
"index.js",
"index.ts",
"lib",
"build/index.js",
"build/index.*",
"build/lib",
"Scripts/build.sh",
"Scripts/fetch-prebuilt-wda.js",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -8,7 +8,7 @@
"checkJs": true
},
"include": [
"index.js",
"index.ts",
"lib"
]
}

0 comments on commit 4b3c220

Please sign in to comment.