/
saucelabs.json
157 lines (157 loc) · 5.45 KB
/
saucelabs.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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
}]
}
}
}