use of com.testsigma.automator.drivers.TestsigmaDriver in project testsigma by testsigmahq.
the class DriverSessionsService method createSession.
public String createSession(DriverSessionRequest driverSessionRequest) throws Exception {
com.testsigma.agent.dto.WebDriverSettingsDTO webDriverSettingsDTO;
if (ExecutionLabType.Hybrid.equals(driverSessionRequest.getExecutionLabType()) && WorkspaceType.isMobileApp(driverSessionRequest.getWorkspaceType())) {
disconnectDeviceSession(driverSessionRequest.getUniqueId());
driverSessionRequest.setWebDriverServerUrl(new URL(mobileAutomationServer.getServerURL()));
}
webDriverSettingsDTO = fetchWebDriverSettings(driverSessionRequest);
log.info("Creating a remote web driver session with settings - " + webDriverSettingsDTO);
TestsigmaDriver testsigmaDriver = getDriverInstance(driverSessionRequest);
List<WebDriverCapability> caps = webDriverSettingsDTO.getWebDriverCapabilities();
addMissingTimeOutCapability(caps);
handleLocalDevice(caps, driverSessionRequest);
setRemoteServerURL(testsigmaDriver, driverSessionRequest, webDriverSettingsDTO);
testsigmaDriver.setCapabilities(caps);
RemoteWebDriver remoteWebDriver = testsigmaDriver.createSession();
String sessionId = populateSessionIdMaps(remoteWebDriver, driverSessionRequest);
sendMobileSessionStartedRequest(sessionId, driverSessionRequest);
return sessionId;
}
use of com.testsigma.automator.drivers.TestsigmaDriver in project testsigma by testsigmahq.
the class DriverSessionsService method deleteSession.
public void deleteSession(String sessionId) throws Exception {
log.debug("Removing session from appium server");
RemoteWebDriver remoteWebDriver = sessionContainer.getSessionMap().get(sessionId);
new TestsigmaDriver().deleteSession(remoteWebDriver);
if (sessionContainer.getSessionMap().containsKey(sessionId)) {
sessionContainer.getSessionMap().remove(sessionId);
String deviceId = sessionContainer.getSessionToDeviceIdMap().get(sessionId);
sessionContainer.getSessionToDeviceIdMap().remove(sessionId);
sessionContainer.getDeviceToSessionMap().remove(deviceId);
if (deviceContainer != null && deviceContainer.getDeviceMap().containsKey(deviceId)) {
MobileDevice device = deviceContainer.getDevice(deviceId);
if ((device != null) && (device.getOsName() == MobileOs.IOS)) {
iosDeviceService.cleanupWda(device);
} else {
log.info("Device os is not iOS. Skipping WDA cleanup");
}
}
} else {
log.info("Session ID - " + sessionId + " doesn't exist.");
}
}
Aggregations