File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " testcafe-browser-provider-browserstack" ,
3
- "version" : " 0.0.1 " ,
3
+ "version" : " 0.0.2 " ,
4
4
"description" : " browserstack TestCafe browser provider plugin." ,
5
5
"repository" : " https://github.com/DevExpress/testcafe-browser-provider-browserstack" ,
6
6
"homepage" : " https://github.com/DevExpress/testcafe-browser-provider-browserstack" ,
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ const MINIMAL_WORKER_TIME = 30000;
14
14
const TESTCAFE_CLOSING_TIMEOUT = 10000 ;
15
15
const TOO_SMALL_TIME_FOR_WAITING = MINIMAL_WORKER_TIME - TESTCAFE_CLOSING_TIMEOUT ;
16
16
17
+ const AUTH_FAILED_ERROR = 'Authentication failed. Please assign the correct username and access key ' +
18
+ 'to the BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables.' ;
19
+
17
20
const BROWSERSTACK_API_PATHS = {
18
21
browserList : {
19
22
url : 'https://api.browserstack.com/4/browsers?flat=true'
@@ -74,6 +77,9 @@ function destroyBrowserStackConnector (connector) {
74
77
}
75
78
76
79
function doRequest ( apiPath , params ) {
80
+ if ( ! process . env [ 'BROWSERSTACK_USERNAME' ] || ! process . env [ 'BROWSERSTACK_ACCESS_KEY' ] )
81
+ throw new Error ( AUTH_FAILED_ERROR ) ;
82
+
77
83
var url = apiPath . url ;
78
84
79
85
if ( params )
@@ -92,7 +98,13 @@ function doRequest (apiPath, params) {
92
98
if ( apiPath . binaryStream )
93
99
opts . encoding = null ;
94
100
95
- return request ( url , opts ) ;
101
+ return request ( url , opts )
102
+ . catch ( error => {
103
+ if ( error . statusCode === 401 )
104
+ throw new Error ( AUTH_FAILED_ERROR ) ;
105
+
106
+ throw error ;
107
+ } ) ;
96
108
}
97
109
98
110
export default {
You can’t perform that action at this time.
0 commit comments