added all files to project

This commit is contained in:
2022-03-10 10:36:59 +01:00
parent 09dd957b33
commit 46a936d7de
25351 changed files with 3883356 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
WebdriverIO Protocol Helper
===========================
This package stores the definition for various automation protocols such as [WebDriver](https://w3c.github.io/webdriver/) or vendor specific protocol extensions like for [SauceLabs](https://saucelabs.com/). Unless you are interested in generating a WebDriver client there should be no reason why you should need this package. This package holds the definition of the following protocols:
- [WebDriver](https://w3c.github.io/webdriver/)
- [JSON Wire Protocol](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol)
- [Appium](http://appium.io/)
- [Mobile JSON Wire Protocol](https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md)
- [Sauce Labs](https://saucelabs.com/)
- Chrome (WebDriver extension when running Chromedriver)
- Selenium (when running Selenium Standalone Server)
## Install
To install the package, run:
```sh
$ npm install @wdio/protocols
```
## Usage
You can get data by importing the package as follows:
```js
import { WebDriverProtocol, MJsonWProtocol, JsonWProtocol, AppiumProtocol, ChromiumProtocol, SauceLabsProtocol, SeleniumProtocol } from '@wdio/protocols'
/**
* get description of session command
*/
console.log(WebDriverProtocol['/session'].POST.description)
```
----
For more information on WebdriverIO see the [homepage](https://webdriver.io).
+92
View File
@@ -0,0 +1,92 @@
declare namespace WDIOProtocols {
type CommandPath = 'string'
type CommandMethod = 'POST' | 'GET' | 'DELETE'
type Protocol = Record<CommandPath, Record<CommandMethod, CommandEndpoint>>
/**
* describes a command endpoint
*/
interface CommandEndpoint {
/**
* command name
*/
command: string
/**
* command description
*/
description: string
/**
* link to specification reference
*/
ref: string
/**
* supported command parameters
*/
parameters: CommandParameters[]
/**
* variables within the command path (e.g. /:sessionId/element)
*/
variables?: CommandPathVariables[]
/**
* supported environments
*/
support?: SupportedEnvironments
/**
* set to true if command is only supported in Selenium Hub Node
*/
isHubCommand?: boolean,
/**
* information on return data
*/
returns?: CommandReturnObject
}
interface CommandReturnObject {
type: string
name: string
description: string
}
interface CommandPathVariables {
name: string
description: string
/**
* the following are given for path variables, we should still define
* it as values are populated automatically
*/
required?: boolean
type?: string
}
interface CommandParameters {
name: string,
type: string,
description: string,
required: boolean
}
type Platform = 'ios' | 'android'
type Environments = 'XCUITest' | 'UIAutomation' | 'UiAutomator'
/**
* supported mobile environments, e.g.
* ```
* "ios": {
* "UIAutomation": "8.0 to 9.3"
* }
* ```
*/
type SupportedEnvironments = Record<Platform, Record<Environments, string>>
}
declare module "@wdio/protocols" {
export default WDIOProtocols
export const WebDriverProtocol: WDIOProtocols.Protocol
export const MJsonWProtocol: WDIOProtocols.Protocol
export const JsonWProtocol: WDIOProtocols.Protocol
export const AppiumProtocol: WDIOProtocols.Protocol
export const ChromiumProtocol: WDIOProtocols.Protocol
export const SauceLabsProtocol: WDIOProtocols.Protocol
export const SeleniumProtocol: WDIOProtocols.Protocol
}
+7
View File
@@ -0,0 +1,7 @@
exports.WebDriverProtocol = require('./protocols/webdriver.json')
exports.MJsonWProtocol = require('./protocols/mjsonwp.json')
exports.JsonWProtocol = require('./protocols/jsonwp.json')
exports.AppiumProtocol = require('./protocols/appium.json')
exports.ChromiumProtocol = require('./protocols/chromium.json')
exports.SauceLabsProtocol = require('./protocols/saucelabs.json')
exports.SeleniumProtocol = require('./protocols/selenium.json')
+62
View File
@@ -0,0 +1,62 @@
{
"_args": [
[
"@wdio/protocols@6.12.0",
"/home/pi/Desktop/smartMirrorTestEnvironment/MagicMirror"
]
],
"_development": true,
"_from": "@wdio/protocols@6.12.0",
"_id": "@wdio/protocols@6.12.0",
"_inBundle": false,
"_integrity": "sha512-UhTBZxClCsM3VjaiDp4DoSCnsa7D1QNmI2kqEBfIpyNkT3GcZhJb7L+nL0fTkzCwi7+/uLastb3/aOwH99gt0A==",
"_location": "/@wdio/protocols",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@wdio/protocols@6.12.0",
"name": "@wdio/protocols",
"escapedName": "@wdio%2fprotocols",
"scope": "@wdio",
"rawSpec": "6.12.0",
"saveSpec": null,
"fetchSpec": "6.12.0"
},
"_requiredBy": [
"/devtools",
"/webdriver"
],
"_resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-6.12.0.tgz",
"_spec": "6.12.0",
"_where": "/home/pi/Desktop/smartMirrorTestEnvironment/MagicMirror",
"author": {
"name": "Christian Bromann",
"email": "christian@saucelabs.com"
},
"bugs": {
"url": "https://github.com/webdriverio/webdriverio/issues"
},
"description": "Utility package providing information about automation protocols",
"engines": {
"node": ">=10.0.0"
},
"gitHead": "e8bae1e8becee38ee362989dc91bdd0c831512e9",
"homepage": "https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-protocols",
"keywords": [
"webdriver",
"wdio"
],
"license": "MIT",
"main": "./index",
"name": "@wdio/protocols",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/webdriverio/webdriverio.git"
},
"types": "./index.d.ts",
"version": "6.12.0"
}
File diff suppressed because it is too large Load Diff
+432
View File
@@ -0,0 +1,432 @@
{
"/session/:sessionId/alert": {
"GET": {
"command": "isAlertOpen",
"description": "Whether a simple dialog is currently open.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/alert_commands.cc#L42-L49",
"examples": [
[
"console.log(browser.isAlertOpen()); // outputs: false",
"browser.execute('window.alert()');",
"console.log(browser.isAlertOpen()); // outputs: true"
]
],
"parameters": [],
"returns": {
"type": "Boolean",
"name": "isAlertOpen",
"description": "`true` or `false` based on whether simple dialog is present or not."
}
}
},
"/session/:sessionId/autoreport": {
"GET": {
"command": "isAutoReporting",
"description": "Whether it should automatically raises errors on browser logs.",
"ref": "https://codereview.chromium.org/101203012",
"parameters": [],
"returns": {
"type": "Boolean",
"name": "isAutoReporting",
"description": "`true` or `false` based on whether auto reporting is enabled."
}
},
"POST": {
"command": "setAutoReporting",
"description": "Toggle whether to return response with unknown error with first browser error (e.g. failed to load resource due to 403/404 response) for all subsequent commands (once enabled).",
"ref": "https://codereview.chromium.org/101203012",
"examples": [
[
"// Enable auto reporting first thing after session was initiated with empty browser logs",
"console.log(browser.setAutoReporting(true)); // outputs: null",
"// Upon requesting an non-existing resource it will abort execution due to thrown unknown error",
"browser.url('https://webdriver.io/img/404-does-not-exist.png');"
],
[
"// During the session do some operations which populate the browser logs",
"browser.url('https://webdriver.io/img/404-does-not-exist.png');",
"browser.url('https://webdriver.io/403/no-access');",
"// Enable auto reporting which throws an unknown error for first browser log (404 response)",
"browser.setAutoReporting(true);"
]
],
"parameters": [{
"name": "enabled",
"type": "boolean",
"description": "`true` if auto reporting should be enabled, use `false` to disable previously enabled auto reporting.",
"required": true
}],
"returns": {
"type": "Object|Null",
"name": "firstBrowserError",
"description": "In case first browser error already occured prior to executing this command it will throw unknown error as response, which is an object with 'message' key describing first browser error. Otherwise it returns `null` on success."
}
}
},
"/session/:sessionId/is_loading": {
"GET": {
"command": "isLoading",
"description": "Determines load status for active window handle.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L783-L802",
"examples": [
[
"console.log(browser.isLoading()); // outputs: false",
"browser.newWindow('https://webdriver.io');",
"console.log(browser.isLoading()); // outputs: true"
]
],
"parameters": [],
"returns": {
"type": "Boolean",
"name": "isLoading",
"description": "`true` or `false` based on whether active window handle is loading or not."
}
}
},
"/session/:sessionId/chromium/heap_snapshot": {
"GET": {
"command": "takeHeapSnapshot",
"description": "Takes a heap snapshot of the current execution context.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/chrome/web_view.h#L198-L202",
"parameters": [],
"returns": {
"type": "Object",
"name": "heapSnapshot",
"description": "A JSON representation of the heap snapshot. Which can be inspected by loading as file into Chrome DevTools."
}
}
},
"/session/:sessionId/network_connection": {
"GET": {
"command": "getNetworkConnection",
"description": "Get the connection type for network emulation. This command is only applicable when remote end replies with `networkConnectionEnabled` capability set to `true`.",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-modes",
"examples": [
[
"const browser = remote({",
" capabilities: {",
" browserName: 'chrome',",
" 'goog:chromeOptions': {",
" // Network emulation requires device mode, which is only enabled when mobile emulation is on",
" mobileEmulation: { deviceName: 'iPad' },",
" },",
" // Allow control over the state of network connectivity for testing",
" networkConnectionEnabled: true",
" }",
"});",
"console.log(browser.getNetworkConnection()); // outputs: 6 (Both Wi-Fi and data)"
]
],
"parameters": [],
"returns": {
"type": "Number",
"name": "connectionType",
"description": "A bitmask to represent the network connection type. Airplane Mode (`1`), Wi-Fi only (`2`), Wi-Fi and data (`6`), 4G (`8`), 3G (`10`), 2G (`20`). By default [Wi-Fi and data are enabled](https://github.com/bayandin/chromedriver/blob/v2.45/chrome/chrome_desktop_impl.cc#L36-L37)."
}
},
"POST": {
"command": "setNetworkConnection",
"description": "Change connection type for network connection. This command is only applicable when remote end replies with `networkConnectionEnabled` capability set to `true`.",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-modes",
"examples": [
[
"const browser = remote({",
" capabilities: {",
" browserName: 'chrome',",
" 'goog:chromeOptions': {",
" // Network emulation requires device mode, which is only enabled when mobile emulation is on",
" mobileEmulation: { deviceName: 'iPad' },",
" },",
" // Allow control over the state of network connectivity for testing",
" networkConnectionEnabled: true",
" }",
"});",
"console.log(browser.setNetworkConnection({ type: 1 })); // outputs: 1 (Airplane Mode)"
]
],
"parameters": [{
"name": "parameters",
"type": "object",
"description": "Object containing ConnectionType, set bitmask as value for `type` key in object. Airplane Mode (`1`), Wi-Fi only (`2`), Wi-Fi and data (`6`), 4G (`8`), 3G (`10`), 2G (`20`).",
"required": true
}],
"returns": {
"type": "Number",
"name": "connectionType",
"description": "A bitmask to represent the network connection type. Value should match specified `type` in object, however device might not be capable of the network connection type requested."
}
}
},
"/session/:sessionId/chromium/network_conditions": {
"GET": {
"command": "getNetworkConditions",
"description": "Get current network conditions used for emulation.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L839-L859",
"parameters": [],
"returns": {
"type": "Object",
"name": "networkConditions",
"description": "Object containing network conditions for `offline`, `latency`, `download_throughput` and `upload_throughput`. Network conditions must be set before it can be retrieved."
}
},
"POST": {
"command": "setNetworkConditions",
"description": "Set network conditions used for emulation by throttling connection.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1663-L1722",
"examples": [
[
"// Use different download (25kb/s) and upload (50kb/s) throughput values for throttling with a latency of 1000ms",
"browser.setNetworkConditions({ latency: 1000, download_throughput: 25600, upload_throughput: 51200 });"
],
[
"// Force disconnected from network by setting 'offline' to true",
"browser.setNetworkConditions({ latency: 0, throughput: 0, offline: true });"
],
[
"// When preset name (e.g. 'DSL') is specified it does not respect values in object (e.g. 'offline')",
"browser.setNetworkConditions({ latency: 0, throughput: 0, offline: true }, 'DSL');"
],
[
"// Best practice for specifying network throttling preset is to use an empty object",
"browser.setNetworkConditions({}, 'Good 3G');"
]
],
"parameters": [{
"name": "network_conditions",
"type": "object",
"description": "Object containing network conditions which are `latency`, `throughput` (or `download_throughput`/`upload_throughput`) and `offline` (optional).",
"required": true
}, {
"name": "network_name",
"type": "string",
"description": "Name of [network throttling preset](https://github.com/bayandin/chromedriver/blob/v2.45/chrome/network_list.cc#L12-L25). `GPRS`, `Regular 2G`, `Good 2G`, `Regular 3G`, `Good 3G`, `Regular 4G`, `DSL`, `WiFi` or `No throttling` to disable. When preset is specified values passed in first argument are not respected.",
"required": false
}]
},
"DELETE": {
"command": "deleteNetworkConditions",
"description": "Disable any network throttling which might have been set. Equivalent of setting the `No throttling` preset.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1724-L1745",
"parameters": []
}
},
"/session/:sessionId/chromium/send_command": {
"POST": {
"command": "sendCommand",
"description": "Send a command to the DevTools debugger.<br>For a list of available commands and their parameters refer to the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1290-L1304",
"parameters": [{
"name": "cmd",
"type": "string",
"description": "Name of the command (e.g. [`Browser.close`](https://chromedevtools.github.io/devtools-protocol/1-3/Browser#method-close)).",
"required": true
}, {
"name": "params",
"type": "object",
"description": "Parameters to the command. In case no parameters for command, specify an empty object.",
"required": true
}]
}
},
"/session/:sessionId/chromium/send_command_and_get_result": {
"POST": {
"command": "sendCommandAndGetResult",
"description": "Send a command to the DevTools debugger and wait for the result.<br>For a list of available commands and their parameters refer to the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1306-L1320",
"parameters": [{
"name": "cmd",
"type": "string",
"description": "Name of the command which returns a result (e.g. [`Network.getAllCookies`](https://chromedevtools.github.io/devtools-protocol/1-3/Network#method-getAllCookies)).",
"required": true
}, {
"name": "params",
"type": "object",
"description": "Parameters to the command. In case no parameters for command, specify an empty object.",
"required": true
}],
"returns": {
"type": "*",
"name": "result",
"description": "Either the return value of your command, or the error which was the reason for your command's failure."
}
}
},
"/session/:sessionId/file": {
"POST": {
"command": "file",
"description": "Upload a file to remote machine on which the browser is running.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L1037-L1065",
"parameters": [{
"name": "file",
"type": "string",
"description": "Base64-encoded zip archive containing __single__ file which to upload. In case base64-encoded data does not represent a zip archive or archive contains more than one file it will throw an unknown error.",
"required": true
}],
"returns": {
"type": "String",
"name": "path",
"description": "Absolute path of uploaded file on remote machine."
}
}
},
"/session/:sessionId/chromium/launch_app": {
"POST": {
"command": "launchChromeApp",
"description": "Launches a Chrome app by specified id.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L521-L539",
"examples": [
[
"const browser = remote({",
" capabilities: {",
" browserName: 'chrome',",
" 'goog:chromeOptions': {",
" // Install upon starting browser in order to launch it",
" extensions: [",
" // Entry should be a base64-encoded packed Chrome app (.crx)",
" require('fs').readFileSync('/absolute/path/app.crx').toString('base64')",
" ]",
" }",
" }",
"});",
"browser.launchChromeApp('aohghmighlieiainnegkcijnfilokake')); // Google Docs (https://chrome.google.com/webstore/detail/docs/aohghmighlieiainnegkcijnfilokake)"
]
],
"parameters": [{
"name": "id",
"type": "string",
"description": "Extension id of app to be launched, as defined in chrome://extensions.",
"required": true
}]
}
},
"/session/:sessionId/element/:elementId/value": {
"GET": {
"command": "getElementValue",
"description": "Retrieves the value of a given form control element.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/element_commands.cc#L431-L443",
"variables": [{
"name": "elementId",
"description": "id of element to get value from"
}],
"parameters": [],
"returns": {
"type": "String|Null",
"name": "value",
"description": "Current value of the element. In case specified element is not a form control element, it will return `null`."
}
}
},
"/session/:sessionId/element/:elementId/hover": {
"POST": {
"command": "elementHover",
"description": "Enable hover state for an element, which is reset upon next interaction.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/element_commands.cc#L126-L146",
"variables": [{
"name": "elementId",
"description": "id of element to hover over to"
}],
"parameters": []
}
},
"/session/:sessionId/touch/pinch": {
"POST": {
"command": "touchPinch",
"description": "Trigger a pinch zoom effect.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L813-L827",
"parameters": [{
"name": "x",
"type": "number",
"description": "x position to pinch on",
"required": true
}, {
"name": "y",
"type": "number",
"description": "y position to pinch on",
"required": true
}, {
"name": "scale",
"type": "number",
"description": "pinch zoom scale",
"required": true
}]
}
},
"/session/:sessionId/goog/page/freeze": {
"POST": {
"command": "freeze",
"description": "Freeze the current page. Extension for [Page Lifecycle API](https://developers.google.com/web/updates/2018/07/page-lifecycle-api).",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L625-L633",
"parameters": []
}
},
"/session/:sessionId/goog/page/resume": {
"POST": {
"command": "resume",
"description": "Resume the current page. Extension for [Page Lifecycle API](https://developers.google.com/web/updates/2018/07/page-lifecycle-api).",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L635-L645",
"parameters": []
}
},
"/shutdown": {
"POST": {
"command": "shutdown",
"description": "Shutdown ChromeDriver process and consequently terminating all active sessions.",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/session_commands.cc#L489-L498",
"parameters": []
}
},
"/session/:sessionId/element/:elementId/screenshot": {
"GET": {
"command": "takeElementScreenshot",
"description": "The Take Element Screenshot command takes a screenshot of the visible region encompassed by the bounding rectangle of an element.",
"ref": "https://w3c.github.io/webdriver/#dfn-take-element-screenshot",
"variables": [{
"name": "elementId",
"description": "the id of an element returned in a previous call to Find Element(s)"
}],
"parameters": [{
"name": "scroll",
"type": "boolean",
"description": "scroll into view the element. Default: true",
"required": false
}],
"returns": {
"type": "String",
"name": "screenshot",
"description": "The base64-encoded PNG image data comprising the screenshot of the visible region of an element’s bounding rectangle after it has been scrolled into view."
}
}
},
"/session/:sessionId/se/log/types": {
"GET": {
"command": "getLogTypes",
"description": "Get available log types.",
"ref": "https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidlogtypes",
"parameters": [],
"returns": {
"type": "String[]",
"name": "logTypes",
"description": "The list of available log types, example: browser, driver."
}
}
},
"/session/:sessionId/se/log": {
"POST": {
"command": "getLogs",
"description": "Get the log for a given log type. Log buffer is reset after each request.",
"ref": "https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidlog",
"parameters": [{
"name": "type",
"type": "string",
"description": "the log type",
"required": true
}],
"returns": {
"type": "Object[]",
"name": "logs",
"description": "The list of log entries."
}
}
}
}
File diff suppressed because it is too large Load Diff
+114
View File
@@ -0,0 +1,114 @@
{
"/session/:sessionId/context": {
"GET": {
"command": "getContext",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#webviews-and-other-contexts",
"parameters": [],
"returns": {
"type": "string|null",
"name": "context",
"description": "a string representing the current context or null representing 'no context'"
}
},
"POST": {
"command": "switchContext",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#webviews-and-other-contexts",
"parameters": [{
"name": "name",
"type": "string",
"description": "a string representing an available context",
"required": true
}]
}
},
"/session/:sessionId/contexts": {
"GET": {
"command": "getContexts",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#webviews-and-other-contexts",
"parameters": [],
"returns": {
"type": "string[]",
"name": "contexts",
"description": "an array of strings representing available contexts, e.g. 'WEBVIEW', or 'NATIVE'"
}
}
},
"/session/:sessionId/element/:elementId/pageIndex": {
"GET": {
"command": "getPageIndex",
"ref": "https://github.com/appium/appium-base-driver/blob/master/docs/mjsonwp/protocol-methods.md#mobile-json-wire-protocol-endpoints",
"parameters": [],
"returns": {
"type": "string",
"name": "pageIndex"
}
}
},
"/session/:sessionId/network_connection": {
"GET": {
"command": "getNetworkConnection",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-modes",
"parameters": [],
"returns": {
"type": "number",
"name": "connectionType",
"description": "see http://appium.io/docs/en/writing-running-appium/other/network-connection/"
}
},
"POST": {
"command": "setNetworkConnection",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-modes",
"parameters": [{
"name": "type",
"type": "number",
"description": "a bit mask that should be translated to an integer value when serialized",
"required": true
}]
}
},
"/session/:sessionId/touch/perform": {
"GET": {
"command": "touchPerform",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#touch-gestures",
"parameters": [{
"name": "actions",
"type": "object[]",
"description": "a list of objects, each of which represents an input source and its associated actions",
"required": true
}]
}
},
"/session/:sessionId/touch/multi/perform": {
"GET": {
"command": "multiTouchPerform",
"ref": "https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#touch-gestures",
"parameters": [{
"name": "actions",
"type": "object[]",
"description": "a list of objects, each of which represents an input source and its associated actions",
"required": true
}, {
"name": "elementId",
"type": "object[]",
"description": "the id of an element returned in a previous call to Find Element(s)"
}]
}
},
"/session/:sessionId/receive_async_response": {
"POST": {
"command": "receiveAsyncResponse",
"ref": "https://github.com/appium/appium-base-driver/blob/master/docs/mjsonwp/protocol-methods.md#mobile-json-wire-protocol-endpoints",
"parameters": [{
"name": "status",
"type": "string",
"description": "the expected status of the response",
"required": true
}, {
"name": "value",
"type": "string",
"description": "the expected value of the response",
"required": true
}]
}
}
}
+275
View File
@@ -0,0 +1,275 @@
{
"/session/:sessionId/sauce/ondemand/log": {
"POST": {
"command": "getPageLogs",
"description": "Get webpage specific log information based on the last page load.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands#CustomSauceLabsWebDriverExtensionsforNetworkandLogCommands-ExtendedDebuggingTools",
"examples": [
[
"// Get Network Logs",
"console.log(browser.getPageLogs('sauce:network'));",
"/**",
" * outputs:",
" * [{",
" * \"url\": \"https://app.saucelabs.com/dashboard\",",
" * \"statusCode\": 200,",
" * \"method\": \"GET\",",
" * \"requestHeaders\": {",
" * ...",
" * },",
" * \"responseHeaders\": {",
" * ...",
" * },",
" * \"timing\": {",
" * ...",
" * }",
" * }, {,",
" * ...",
" * }]",
" */"
],
[
"// Get Performance Logs (needs capturePerformance capability see: https://wiki.saucelabs.com/display/DOCS/Measure+Page+Load+Performance+Using+Test+Automation#MeasurePageLoadPerformanceUsingTestAutomation-EnableYourScript)",
"console.log(browser.getPageLogs('sauce:performance'));",
"/**",
" * outputs:",
" * {",
" * \"speedIndex\": 1472.023,",
" * \"timeToFirstInteractive\": 1243.214,",
" * \"firstMeaningfulPaint\": 892.643,",
" * ...",
" * }",
" */"
]
],
"parameters": [{
"name": "type",
"type": "string",
"description": "log type (e.g. sauce:network', 'sauce:performance')",
"required": true
}],
"returns": {
"type": "object",
"name": "log",
"description": "log output of desired type (see example)"
}
}
},
"/session/:sessionId/sauce/ondemand/throttle/network": {
"POST": {
"command": "throttleNetwork",
"description": "With network conditioning you can test your site on a variety of network connections, including Edge, 3G, and even offline. You can throttle the data throughput, including the maximum download and upload throughput, and use latency manipulation to enforce a minimum delay in connection round-trip time (RTT).",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands#CustomSauceLabsWebDriverExtensionsforNetworkandLogCommands-ThrottleNetworkCapabilities",
"examples": [
[
"// predefined network condition",
"browser.throttleNetwork('offline')"
],
[
"// custom network condition",
"browser.throttleNetwork({",
" download: 1000,",
" upload: 500,",
" latency: 40'",
"})"
]
],
"parameters": [{
"name": "condition",
"type": "(string|object)",
"description": "network condition to set (e.g. 'online', 'offline', 'GPRS', 'Regular 2G', 'Good 2G', 'Regular 3G', 'Good 3G', 'Regular 4G', 'DSL', 'Wifi')",
"required": true
}]
}
},
"/session/:sessionId/sauce/ondemand/throttle/cpu": {
"POST": {
"command": "throttleCPU",
"description": "You can throttle the CPU in DevTools to understand how your page performs under that constraint.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands#CustomSauceLabsWebDriverExtensionsforNetworkandLogCommands-ThrottleCPUCapabilities",
"examples": [
[
"// throttle CPU and make it run 4x slower",
"browser.throttleCPU(4)"
],
[
"// reset CPU throttling",
"browser.throttleCPU(0)"
]
],
"parameters": [{
"name": "rate",
"type": "number",
"description": "Rate on how much the CPU should get throttled.",
"required": true
}]
}
},
"/session/:sessionId/sauce/ondemand/intercept": {
"POST": {
"command": "interceptRequest",
"description": "Allows modifying any request made by the browser. You can blacklist, modify, or redirect these as required for your tests.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands#CustomSauceLabsWebDriverExtensionsforNetworkandLogCommands-InterceptNetworkRequests",
"examples": [
[
"// redirect a request",
"browser.interceptRequest({",
" url: 'https://saucelabs.com',",
" redirect: 'https://google.com'",
"})"
],
[
"// Blacklist requests to 3rd party vendors",
"browser.interceptRequest({",
" url: 'https://api.segment.io/v1/p',",
" error: 'Failed'",
"})"
],
[
"// Modify requests to REST API (Mock REST API response)",
"browser.interceptRequest({",
" url: 'http://sampleapp.appspot.com/api/todos',",
" response: {",
" headers: {",
" 'x-custom-headers': 'foobar'",
" },",
" body: [{",
" title: 'My custom todo',",
" order: 1,",
" completed: false,",
" url: 'http://todo-backend-express.herokuapp.com/15727'",
" }]",
" }",
"})"
]
],
"parameters": [{
"name": "rule",
"type": "object",
"description": "A rule describing the request interception.",
"required": true
}]
}
},
"/session/:sessionId/sauce/ondemand/performance": {
"POST": {
"command": "assertPerformance",
"description": "Assert against the performance baseline of your app.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands",
"examples": [
[
"// test performance for a page",
"browser.url('https://webdriver.io')",
"const hasRegression = browser.assertPerformance({",
" name: 'my performance test', // make sure that the name is also set in the sauce options in your capabilities",
" metrics: ['score', 'firstPaint']",
"})"
]
],
"parameters": [{
"name": "name",
"type": "string",
"description": "Name of the job you created your baseline with.",
"required": true
}, {
"name": "metrics",
"type": "string[]",
"description": "Name of metrics you want to assert agains the baseline.",
"required": false
}],
"returns": {
"type": "object",
"name": "hasRegression",
"description": "An object containing the result as well as metrics about the result."
}
}
},
"/session/:sessionId/sauce/ondemand/performance/scroll": {
"POST": {
"command": "jankinessCheck",
"description": "Perform a scroll test that evaluates the jankiness of the application.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands",
"examples": [
[
"// test performance for a page",
"browser.url('https://webdriver.io')",
"browser.jankinessCheck()"
]
],
"parameters": [],
"returns": {
"type": "object",
"name": "testResults",
"description": "An object containing the score as well as metrics around how smooth the UX of the page was during the test."
}
}
},
"/session/:sessionId/sauce/ondemand/mock": {
"POST": {
"command": "mockRequest",
"description": "Mocks a network resource.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands",
"parameters": [{
"name": "url",
"type": "string",
"description": "URL glob to match url to mock.",
"required": true
}, {
"name": "filterOptions",
"description": "Additional filter options for url to mock (e.g. headers, method).",
"type": "object",
"required": false
}],
"returns": {
"type": "object",
"name": "mockId",
"description": "An object containing the id of a mock resource."
}
}
},
"/session/:sessionId/sauce/ondemand/mock/:mockId": {
"GET": {
"command": "getMockCalls",
"description": "Receive request information about requests that match the mocked resource.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands",
"variables": [{
"name": "mockId",
"description": "the id of a mock"
}],
"parameters": [],
"returns": {
"type": "object",
"name": "requests",
"description": "A list of request information."
}
},
"DELETE": {
"command": "clearMockCalls",
"description": "Clear list of mock calls.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands",
"variables": [{
"name": "mockId",
"description": "the id of a mock"
}],
"parameters": [{
"type": "boolean",
"name": "restore",
"description": "Set to true if mock should be restored as well."
}]
},
"POST": {
"command": "respondMock",
"description": "Respond if mock matches a specific resource.",
"ref": "https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands",
"variables": [{
"name": "mockId",
"description": "the id of a mock"
}],
"parameters": [{
"type": "object",
"name": "payload",
"description": "Information on mock response."
}]
}
}
}
+84
View File
@@ -0,0 +1,84 @@
{
"/session/:sessionId/file": {
"POST": {
"command": "file",
"description": "Upload a file to remote machine on which the browser is running.",
"ref": "https://www.seleniumhq.org/",
"parameters": [{
"name": "file",
"type": "string",
"description": "Base64-encoded zip archive containing __single__ file which to upload. In case base64-encoded data does not represent a zip archive or archive contains more than one file it will throw an unknown error.",
"required": true
}],
"returns": {
"type": "String",
"name": "path",
"description": "Absolute path of uploaded file on remote machine."
}
}
},
"/grid/api/hub/": {
"GET": {
"isHubCommand": true,
"command": "getHubConfig",
"description": "Receive hub config remotely.",
"ref": "https://github.com/nicegraham/selenium-grid2-api#gridapihub",
"parameters": [],
"returns": {
"type": "Object",
"name": "config",
"description": "Returns the hub config with slotCount, timeouts and other information."
}
}
},
"/grid/api/testsession?session=:session": {
"GET": {
"isHubCommand": true,
"command": "gridTestSession",
"description": "Get the details of the Selenium Grid node running a session.",
"ref": "https://github.com/nicegraham/selenium-grid2-api#gridapitestsession",
"parameters": [],
"variables": [{
"name": "session",
"description": "The id of the session to receive hub details for."
}],
"returns": {
"type": "Object",
"name": "details",
"description": "Object containing information about session details."
}
}
},
"/grid/api/proxy": {
"GET": {
"isHubCommand": true,
"command": "gridProxyDetails",
"description": "Get proxy details.",
"ref": "https://github.com/nicegraham/selenium-grid2-api#gridapiproxy",
"parameters": [{
"name": "id",
"type": "string",
"description": "the id of the proxy (can be received using gridTestSession command).",
"required": true
}],
"returns": {
"type": "Object",
"name": "details",
"description": "Object containing information about proxy."
}
}
},
"/lifecycle-manager?action=:action": {
"GET": {
"isHubCommand": true,
"command": "manageSeleniumHubLifecycle",
"description": "Manage lifecycle of hub node.",
"ref": "https://github.com/nicegraham/selenium-grid2-api#lifecycle-manager",
"parameters": [],
"variables": [{
"name": "action",
"description": "Command to call on Selenium Hub. The only implemented action is to 'shutdown' the hub."
}]
}
}
}
File diff suppressed because it is too large Load Diff