Search in sources :

Example 1 with TestDeviceSettings

use of com.testsigma.automator.entity.TestDeviceSettings in project testsigma by testsigmahq.

the class WebDriverManager method setWebSession.

private void setWebSession(RemoteWebDriver driver) {
    TestDeviceSettings testDeviceSettings = EnvironmentRunner.getRunnerEnvironmentEntity().getEnvSettings();
    String executionUuid = EnvironmentRunner.getRunnerExecutionId();
    Capabilities cap = driver.getCapabilities();
    String browserVersion = cap.getVersion();
    if (browserVersion.contains(".")) {
        browserVersion = browserVersion.substring(0, browserVersion.indexOf(".") + 2);
    }
    testDeviceSettings.setBrowserVersionFound(browserVersion);
    WebDriverSession webSession = new WebDriverSession();
    JSONObject sessionSettings = ObjectUtils.defaultIfNull(webSession.getSettings(), new JSONObject());
    for (String key : JSONObject.getNames(new JSONObject(testDeviceSettings))) {
        sessionSettings.put(key, new JSONObject(testDeviceSettings).get(key));
    }
    webSession.setSettings(sessionSettings);
    sessionMap.put(executionUuid, webSession);
}
Also used : JSONObject(org.json.JSONObject) Capabilities(org.openqa.selenium.Capabilities) TestDeviceSettings(com.testsigma.automator.entity.TestDeviceSettings)

Example 2 with TestDeviceSettings

use of com.testsigma.automator.entity.TestDeviceSettings in project testsigma by testsigmahq.

the class ScreenCaptureUtil method createScreenshotsFolder.

public void createScreenshotsFolder() {
    TestDeviceSettings settings = EnvironmentRunner.getRunnerEnvironmentEntity().getEnvSettings();
    Long envRunId = EnvironmentRunner.getRunnerEnvironmentRunResult().getId();
    StringBuffer screenshots = new StringBuffer(PathUtil.getInstance().getScreenshotsPath());
    File f = new File(PathUtil.getInstance().getScreenshotsPath());
    f.mkdirs();
    String path = screenshots.append(File.separator).append(envRunId).toString();
    settings.setScreenshotLocalPath(path);
}
Also used : TestDeviceSettings(com.testsigma.automator.entity.TestDeviceSettings) File(java.io.File)

Example 3 with TestDeviceSettings

use of com.testsigma.automator.entity.TestDeviceSettings in project testsigma by testsigmahq.

the class TestPlanRunTask method setupLocalDevice.

protected void setupLocalDevice() throws AutomatorException {
    log.info("Setting up local mobile device");
    try {
        checkDeviceAvailability();
        TestDeviceSettings testDeviceSettings = environment.getEnvSettings();
        setAppiumUrl(testDeviceSettings);
        testDeviceSettings.setDeviceName(mobileDevice.getName());
        testDeviceSettings.setDeviceUniqueId(mobileDevice.getUniqueId());
        if (Platform.Android.equals(getEnvPlatform())) {
            testDeviceSettings.setChromedriverExecutableDir(PathUtil.getInstance().getDriversPath());
        } else if (Platform.iOS.equals(getEnvPlatform())) {
            iosDeviceService.setupWda(mobileDevice);
        }
        environment.setEnvSettings(testDeviceSettings);
        mobileAutomationServerService.installDrivers(this.mobileDevice.getOsName(), this.mobileDevice.getUniqueId());
    } catch (TestsigmaException | DeviceNotConnectedException | MobileLibraryInstallException e) {
        log.error(e.getMessage(), e);
        throw new AutomatorException(e.getMessage(), e);
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) MobileLibraryInstallException(com.testsigma.agent.exception.MobileLibraryInstallException) TestDeviceSettings(com.testsigma.automator.entity.TestDeviceSettings) TestsigmaException(com.testsigma.agent.exception.TestsigmaException) DeviceNotConnectedException(com.testsigma.agent.exception.DeviceNotConnectedException)

Aggregations

TestDeviceSettings (com.testsigma.automator.entity.TestDeviceSettings)3 DeviceNotConnectedException (com.testsigma.agent.exception.DeviceNotConnectedException)1 MobileLibraryInstallException (com.testsigma.agent.exception.MobileLibraryInstallException)1 TestsigmaException (com.testsigma.agent.exception.TestsigmaException)1 AutomatorException (com.testsigma.automator.exceptions.AutomatorException)1 File (java.io.File)1 JSONObject (org.json.JSONObject)1 Capabilities (org.openqa.selenium.Capabilities)1