@@ -6,10 +6,6 @@ import JSTestingBackend from './backends/js-testing';
66import AutomateBackend from './backends/automate' ;
77import BrowserProxy from './browser-proxy' ;
88
9-
10- const BUILD_ID = process . env [ 'BROWSERSTACK_BUILD_ID' ] ;
11- const PROJECT_NAME = process . env [ 'BROWSERSTACK_PROJECT_NAME' ] ;
12-
139const ANDROID_PROXY_RESPONSE_DELAY = 500 ;
1410
1511function isAutomateEnabled ( ) {
@@ -30,6 +26,21 @@ export default {
3026 platformsInfo : [ ] ,
3127 browserNames : [ ] ,
3228
29+ _addEnvironmentPreferencesToCapabilities ( capabilities ) {
30+ const BUILD_ID = process . env [ 'BROWSERSTACK_BUILD_ID' ] ;
31+ const PROJECT_NAME = process . env [ 'BROWSERSTACK_PROJECT_NAME' ] ;
32+ const DISPLAY_RESOLUTION = process . env [ 'BROWSERSTACK_DISPLAY_RESOLUTION' ] ;
33+
34+ if ( PROJECT_NAME )
35+ capabilities . project = PROJECT_NAME ;
36+
37+ if ( BUILD_ID )
38+ capabilities . build = BUILD_ID ;
39+
40+ if ( DISPLAY_RESOLUTION )
41+ capabilities . resolution = DISPLAY_RESOLUTION ;
42+ } ,
43+
3344 _getConnector ( ) {
3445 this . connectorPromise = this . connectorPromise
3546 . then ( async connector => {
@@ -157,11 +168,7 @@ export default {
157168 pageUrl = 'http://' + browserProxy . targetHost + ':' + browserProxy . proxyPort + parsedPageUrl . path ;
158169 }
159170
160- if ( PROJECT_NAME )
161- capabilities . project = PROJECT_NAME ;
162-
163- if ( BUILD_ID )
164- capabilities . build = BUILD_ID ;
171+ this . _addEnvironmentPreferencesToCapabilities ( capabilities ) ;
165172
166173 capabilities . name = `TestCafe test run ${ id } ` ;
167174 capabilities . localIdentifier = connector . connectorInstance . localIdentifierFlag ;
0 commit comments