99import com .appium .manager .AppiumServerManager ;
1010import com .appium .manager .DeviceAllocationManager ;
1111import com .appium .utils .CommandPrompt ;
12+ import com .appium .utils .OverriddenVariable ;
1213import com .context .SessionContext ;
1314import com .context .TestExecutionContext ;
1415import com .epam .reportportal .service .ReportPortal ;
2122import io .cucumber .plugin .event .TestRunFinished ;
2223import io .cucumber .plugin .event .TestRunStarted ;
2324import org .apache .log4j .Logger ;
25+ import org .jetbrains .annotations .NotNull ;
2426import org .json .JSONObject ;
2527
2628import java .io .File ;
@@ -261,7 +263,7 @@ private static String getReportLinkFromBrowserStack(String sessionId) {
261263 String reportLink = "" ;
262264 String cloudUser = getOverriddenStringValue ("CLOUD_USER" );
263265 String cloudPassword = getOverriddenStringValue ("CLOUD_KEY" );
264- String curlCommand = "curl --insecure -u \" " + cloudUser + ":" + cloudPassword + "\" -X GET \" https://api-cloud.browserstack.com/app-automate/sessions/" + sessionId + ".json\" " ;
266+ String curlCommand = "curl --insecure " + getCurlProxyCommand () + " -u \" " + cloudUser + ":" + cloudPassword + "\" -X GET \" https://api-cloud.browserstack.com/app-automate/sessions/" + sessionId + ".json\" " ;
265267 LOGGER .debug (String .format ("Curl command: '%s'" , curlCommand ));
266268 CommandPrompt cmd = new CommandPrompt ();
267269 String resultStdOut = null ;
@@ -279,6 +281,15 @@ private static String getReportLinkFromBrowserStack(String sessionId) {
279281 return reportLink ;
280282 }
281283
284+ @ NotNull
285+ static String getCurlProxyCommand () {
286+ String curlProxyCommand = "" ;
287+ if (null != OverriddenVariable .getOverriddenStringValue ("PROXY_URL" )) {
288+ curlProxyCommand = " --proxy " + System .getProperty ("PROXY_URL" );
289+ }
290+ return curlProxyCommand ;
291+ }
292+
282293 private void runFinishedHandler (TestRunFinished event ) {
283294 LOGGER .info ("runFinishedHandler: " + event .getResult ().toString ());
284295 LOGGER .info (String .format ("ThreadID: %d: afterSuite: %n" , Thread .currentThread ().getId ()));
0 commit comments