How to use processTunnelIdentifierCapability method of com.paypal.selion.proxy.SeLionSauceProxy class

Best SeLion code snippet using com.paypal.selion.proxy.SeLionSauceProxy.processTunnelIdentifierCapability

Source:SeLionSauceProxy.java Github

copy

Full Screen

...132 processDeprecatedCapabilities(requestedCapabilities);133 // default the credentials, if required134 processCredentials(requestedCapabilities);135 // setup the tunnelIdentifier, if required136 processTunnelIdentifierCapability(requestedCapabilities);137 // setup the parent-tunnel, if required138 processParentTunnelCapability(requestedCapabilities);139 // override any idleTimeout capability that may have been specified. Sauce and this proxy need to have140 // a similar idle timeout value.141 requestedCapabilities.put(SauceLabsCapability.IDLE_TIMEOUT_CAPABILITY, getTimeOut() / 1000);142 final int numberOfTCRunning = sauceApi.getNumberOfTCRunning();143 // if call to geNumberOfTCRunning returns -1, sauce REST API calls are failing.144 if (numberOfTCRunning == -1) {145 // mark the proxy as down and let the polling thread determine when it is back up.146 down = true;147 // if we aren't polling sauce labs, kick the session back to the hub.148 if (poll == false) {149 LOGGER.exiting(null);150 return null;151 }152 }153 if (numberOfTCRunning <= getMaxNumberOfConcurrentTestSessions()) {154 session = super.getNewSession(requestedCapabilities);155 }156 LOGGER.exiting((session != null) ? session.toString() : null);157 return session;158 } finally {159 accessLock.unlock();160 }161 }162 private void processDeprecatedCapabilities(Map<String, Object> requestedCapabilities) {163 final String username = (String) requestedCapabilities.get(SauceLabsCapability.SAUCE_USER_NAME_CAPABILITY);164 if (StringUtils.isNotBlank(username)) {165 requestedCapabilities.remove(SauceLabsCapability.SAUCE_USER_NAME_CAPABILITY);166 requestedCapabilities.put(SauceLabsCapability.USERNAME_CAPABILITY, username);167 }168 final String accessKey = (String) requestedCapabilities.get(SauceLabsCapability.SAUCE_API_KEY_CAPABILITY);169 if (StringUtils.isNotBlank(accessKey)) {170 requestedCapabilities.remove(SauceLabsCapability.SAUCE_API_KEY_CAPABILITY);171 requestedCapabilities.put(SauceLabsCapability.ACCESS_KEY_CAPABILITY, accessKey);172 }173 }174 private void processParentTunnelCapability(Map<String, Object> requestedCapabilities) {175 final String tunnelId = (String) requestedCapabilities.get(SauceLabsCapability.PARENT_TUNNEL_CAPABILITY);176 if (StringUtils.isBlank(tunnelId) && StringUtils.isNotBlank(defaultParentTunnel)) {177 // apply the default parent-tunnel according to the configured policy178 final String actualUserName = (String) requestedCapabilities.get(SauceLabsCapability.USERNAME_CAPABILITY);179 requestedCapabilities.put(SauceLabsCapability.PARENT_TUNNEL_CAPABILITY, (defaultParentTunnel180 .equalsIgnoreCase(DEFAULT_PARENT_TUNNEL_TO_USERNAME_TOKEN)) ? actualUserName : defaultParentTunnel);181 }182 }183 private void processTunnelIdentifierCapability(Map<String, Object> requestedCapabilities) {184 final String tunnelId = (String) requestedCapabilities.get(SauceLabsCapability.TUNNEL_IDENTIFIER_CAPABILITY);185 if (StringUtils.isBlank(tunnelId) && StringUtils.isNotBlank(defaultTunnelIdentifier)) {186 requestedCapabilities.put(SauceLabsCapability.TUNNEL_IDENTIFIER_CAPABILITY, defaultTunnelIdentifier);187 }188 }189 private void processCredentials(Map<String, Object> requestedCapabilities) {190 if (sauceConfigReader.isRequireUserCredentials()) {191 return;192 }193 final String username = (String) requestedCapabilities.get(SauceLabsCapability.USERNAME_CAPABILITY);194 final String accessKey = (String) requestedCapabilities.get(SauceLabsCapability.ACCESS_KEY_CAPABILITY);195 if (StringUtils.isBlank(username)) {196 requestedCapabilities.put(SauceLabsCapability.USERNAME_CAPABILITY, sauceConfigReader.getUserName());197 }...

Full Screen

Full Screen

processTunnelIdentifierCapability

Using AI Code Generation

copy

Full Screen

1public class SauceProxyTest {2 public void testProxy() throws Exception {3 SeLionSauceProxy proxy = new SeLionSauceProxy();4 proxy.start();5 DesiredCapabilities capabilities = new DesiredCapabilities();6 capabilities.setBrowserName("firefox");7 capabilities.setPlatform(Platform.LINUX);8 capabilities.setCapability("tunnel-identifier", "myTunnel");9 capabilities.setCapability("name", "myTest");10 capabilities.setCapability("build", "myBuild");11 capabilities.setCapability("tags", Arrays.asList("tag1", "tag2"));12 capabilities.setCapability("customData", "{\"foo\":\"bar\"}");13 processTunnelIdentifierCapability(capabilities);14 RemoteWebDriver driver = new RemoteWebDriver(proxy.getWebDriverProxy(), capabilities);15DesiredCapabilities capabilities = new DesiredCapabilities();16capabilities.setCapability("tunnel-identifier", tunnelIdentifier);17driver.quit();18DesiredCapabilities capabilities = new DesiredCapabilities();19capabilities.setCapability("tunnel-identifier", SeLionSauceProxy.processTunnelIdentifierCapability());20driver.quit();21DesiredCapabilities capabilities = new DesiredCapabilities();22capabilities.setCapability("tunnel-identifier", SeLionSauceProxy.processTunnelIdentifierCapability());23driver.quit();24DesiredCapabilities capabilities = new DesiredCapabilities();25capabilities.setCapability("tunnel-identifier", SeLionSauceProxy.processTunnelIdentifierCapability());

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful