Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vendor specific protocol commands for Sauce Labs (#3299)
**Is your feature request related to a problem? Please describe.** Sauce Labs supports vendor specific WebDriver extension commands (https://wiki.saucelabs.com/display/DOCS/Custom+Sauce+Labs+WebDriver+Extensions+for+Network+and+Log+Commands). **Describe the solution you'd like** It would be create if we could have a protocol that gets applied when running on SauceLabs.
- Loading branch information
1 parent
bbf7df6
commit 3a7beb9
Showing
8 changed files
with
371 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
{ | ||
"/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 Application Metrics Logs", | ||
"console.log(browser.getPageLogs('sauce:metrics'));", | ||
"/**", | ||
" * outputs:", | ||
" * {", | ||
" * \"firstMeaningfulPaint\": 35036.03356,", | ||
" * \"domContentLoaded\": 35036.122972,", | ||
" * \"navigationStart\": 35035.833805,", | ||
" * ...", | ||
" * }", | ||
" */" | ||
], | ||
[ | ||
"// Get Network Timing Logs", | ||
"console.log(browser.getPageLogs('sauce:timing'));", | ||
"/**", | ||
" * outputs:", | ||
" * {", | ||
" * \"loadEventStart\": 622,", | ||
" * \"loadEventEnd\": 622,", | ||
" * \"domInteractive\": 359,", | ||
" * ...", | ||
" * }", | ||
" */" | ||
], | ||
[ | ||
"// 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 (coming soon)", | ||
"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:timing', 'sauce:metrics', 'sauce:network', 'sauce:performance')", | ||
"required": true | ||
}], | ||
"returns": { | ||
"type": "Object", | ||
"name": "log", | ||
"description": "log output of desired type (see example)" | ||
} | ||
} | ||
}, | ||
"/session/:sessionId/sauce/ondemand/throttle": { | ||
"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/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 | ||
}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.