How to use isStandardCap method in Appium Base Driver

Best JavaScript code snippet using appium-base-driver

Run Appium Base Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

protocol-helpers.js

Source: protocol-helpers.js Github

copy
1import _ from 'lodash';
2import { isStandardCap } from '@appium/base-driver';
3
4const W3C_PREFIX = 'goog:';
5
6function toW3cCapName (capName) {
7  return (_.isString(capName) && !capName.includes(':') && !isStandardCap(capName))
8    ? `${W3C_PREFIX}${capName}`
9    : capName;
10}
11
12function getCapValue (allCaps = {}, rawCapName, defaultValue) {
13  for (const [capName, capValue] of _.toPairs(allCaps)) {
14    if (toW3cCapName(capName) === toW3cCapName(rawCapName)) {
15      return capValue;
16    }
17  }
18  return defaultValue;
19}
20
21function toW3cCapNames (originalCaps = {}) {
22  return _.reduce(originalCaps, (acc, value, key) => {
23    acc[toW3cCapName(key)] = value;
24    return acc;
25  }, {});
26}
27
28export { toW3cCapNames, getCapValue };
29
Full Screen

index.js

Source: index.js Github

copy
1// transpile:main
2
3// BaseDriver exports
4import * as driver from './lib/basedriver/driver';
5import * as image from './lib/basedriver/image-element';
6import * as deviceSettings from './lib/basedriver/device-settings';
7
8const { BaseDriver } = driver;
9const { ImageElement } = image;
10const { DeviceSettings, BASEDRIVER_HANDLED_SETTINGS } = deviceSettings;
11
12export { BaseDriver, DeviceSettings, ImageElement, BASEDRIVER_HANDLED_SETTINGS };
13export default BaseDriver;
14
15
16// MJSONWP exports
17import * as protocol from './lib/protocol';
18import {
19  DEFAULT_BASE_PATH, PROTOCOLS
20} from './lib/constants';
21
22const {
23  Protocol, routeConfiguringFunction, errors, isErrorType,
24  errorFromMJSONWPStatusCode, errorFromW3CJsonCode, ALL_COMMANDS, METHOD_MAP,
25  routeToCommandName, NO_SESSION_ID_COMMANDS, isSessionCommand,
26  normalizeBasePath, determineProtocol
27} = protocol;
28
29export {
30  Protocol, routeConfiguringFunction, errors, isErrorType, PROTOCOLS,
31  errorFromMJSONWPStatusCode, errorFromW3CJsonCode, determineProtocol,
32  errorFromMJSONWPStatusCode as errorFromCode, ALL_COMMANDS, METHOD_MAP,
33  routeToCommandName, NO_SESSION_ID_COMMANDS, isSessionCommand,
34  DEFAULT_BASE_PATH, normalizeBasePath
35};
36
37// Express exports
38import * as staticIndex from './lib/express/static';
39const { STATIC_DIR } = staticIndex;
40export { STATIC_DIR };
41
42import * as serverIndex from './lib/express/server';
43const { server } = serverIndex;
44export { server };
45
46// jsonwp-proxy exports
47import * as proxyIndex from './lib/jsonwp-proxy/proxy';
48const { JWProxy } = proxyIndex;
49export { JWProxy };
50
51// jsonwp-status exports
52import * as statusIndex from './lib/jsonwp-status/status';
53const { codes: statusCodes, getSummaryByCode } = statusIndex;
54export { statusCodes, getSummaryByCode };
55
56// W3C capabilities parser
57import * as caps from './lib/basedriver/capabilities';
58const { processCapabilities, isStandardCap, validateCaps } = caps;
59export { processCapabilities, isStandardCap, validateCaps };
60
61// Web socket helpers
62import * as ws from './lib/express/websocket';
63const { DEFAULT_WS_PATHNAME_PREFIX } = ws;
64export { DEFAULT_WS_PATHNAME_PREFIX };
65
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Appium Base Driver on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)