All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.hsac.fitnesse.fixture.util.selenium.SauceLabsHelper Maven / Gradle / Ivy

There is a newer version: 5.3.17
Show newest version
package nl.hsac.fitnesse.fixture.util.selenium;

import java.net.URL;

/**
 * Helper to deal with SauceLabs, a cloud provider for Selenium.
 */
public class SauceLabsHelper {
    /**
     * @param url remote Selenium driver URL.
     * @return true if url indicates connection to SauceLabs.
     */
    public static boolean isRelevant(URL url) {
        boolean result = false;
        if (url != null) {
            result = url.getHost().endsWith("saucelabs.com");
        }
        return result;
    }

    public static String getJobLink(URL remoteUrl, String jobId) {
        return String.format("https://saucelabs.com/jobs/%s?auth=%s",
                jobId, getAuthToken(remoteUrl, jobId));
    }

    public static String getTagToEmbedJobOverview(URL remoteUrl, String jobId) {
        return String.format("",
                jobId, getAuthToken(remoteUrl, jobId));
    }

    public static String getLinkToLiveViewOfRun(URL remoteUrl, String jobId) {
        return String.format("https://saucelabs.com/manual/live_from_job/%s?auth=%s",
                jobId, getAuthToken(remoteUrl, jobId));
    }

    public static String getTagToEmbedVideoOfRun(URL remoteUrl, String jobId) {
        return String.format("
", jobId, getAuthToken(remoteUrl, jobId)); } public static String getAuthToken(URL remoteUrl, String jobId) { String key = remoteUrl.getUserInfo(); return SecurityUtil.hmacEncode("HmacMD5", jobId, key); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy