use of de.zalando.ep.zalenium.dashboard.TestInformation in project zalenium by zalando.
the class SauceLabsRemoteProxy method getTestInformation.
@Override
public TestInformation getTestInformation(String seleniumSessionId) {
// https://saucelabs.com/rest/v1/SL_USER/jobs/SELENIUM_SESSION_ID
String sauceLabsTestUrl = "https://saucelabs.com/rest/v1/%s/jobs/%s";
sauceLabsTestUrl = String.format(sauceLabsTestUrl, SAUCE_LABS_USER_NAME, seleniumSessionId);
String sauceLabsVideoUrl = sauceLabsTestUrl + "/assets/video.flv";
String sauceLabsBrowserLogUrl = sauceLabsTestUrl + "/assets/log.json";
String sauceLabsSeleniumLogUrl = sauceLabsTestUrl + "/assets/selenium-server.log";
JsonObject testData = getCommonProxyUtilities().readJSONFromUrl(sauceLabsTestUrl, SAUCE_LABS_USER_NAME, SAUCE_LABS_ACCESS_KEY).getAsJsonObject();
String testName = testData.get("name").isJsonNull() ? null : testData.get("name").getAsString();
String browser = testData.get("browser").isJsonNull() ? "N/A" : testData.get("browser").getAsString();
String browserVersion = testData.get("browser_short_version").isJsonNull() ? "N/A" : testData.get("browser_short_version").getAsString();
String platform = testData.get("os").getAsString();
List<String> logUrls = new ArrayList<>();
logUrls.add(sauceLabsBrowserLogUrl);
logUrls.add(sauceLabsSeleniumLogUrl);
return new TestInformation.TestInformationBuilder().withSeleniumSessionId(seleniumSessionId).withTestName(testName).withProxyName(getProxyName()).withBrowser(browser).withBrowserVersion(browserVersion).withPlatform(platform).withTestStatus(TestInformation.TestStatus.COMPLETED).withFileExtension(getVideoFileExtension()).withVideoUrl(sauceLabsVideoUrl).withLogUrls(logUrls).build();
}
Aggregations