serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
718 stars 515 forks source link

Saucelabs configuration does not work, however if we set it up at below remote driver works, any suggestion? #2717

Open khalam1 opened 2 years ago

khalam1 commented 2 years ago

What works: @Override public WebDriver newDriver(){ try { ChromeOptions options = new ChromeOptions(); options.setPlatformName("Windows 11"); options.setBrowserVersion("latest"); options.addArguments("start-maximized");

        Map<String, Object> sauceOptions = new HashMap<>();
        sauceOptions.put("username", "");
        sauceOptions.put("accessKey", "");
        sauceOptions.put("screenResolution", "");
        sauceOptions.put("name", "");

        options.setCapability("sauce:options", sauceOptions);
        URL url = new URL("https://ondemand.us-west-1.saucelabs.com/wd/hub");

        return new RemoteWebDriver(url, options);
    }
    catch (IOException e) {
        throw new Error(e);
    }
}

What does not work: saucelabs.url saucelabs.target.platform

saucelabs.driver.version saucelabs.test.name saucelabs.access.key saucelabs.user.id

wakaleo commented 2 years ago

See this file for an example of how to configure Serenity with Saucelabs: https://github.com/serenity-bdd/serenity-core/blob/master/serenity-smoketests/src/test/resources/serenity.conf

Sreedeep-7821 commented 8 months ago

serenity conf file : webdriver { base.url = "https://xxxx.com/apphome" autodownload = true } environments { run_with_saucelabs { webdriver.driver = remote webdriver.remote.url = "https://:@ondemand.us-west-1.saucelabs.com:443/wd/hub"

Some W3C Capabilities

    screenResolution = "1280x1024"
    strictFileInteractability = true
    unhandledPromptBehavior = "ignore"
    tunnelIdentifier = "xxx"
    tunnelOwner = "xxx"
    timeouts {
      script = 20000
      pageLoad = 400000
      implicit = 1000
    }
    saucelabs {
          #
          # Mandatory SauceLabs fields
          #
          platformName = "MAC"
          browserName = "chrome"
          browserVersion = "latest"
          #
          # The saucelabs.datacenter property tells Serenity to use SauceLabs for these tests
          #
          datacenter = "us-west-1"

          #
          # Some optional saucelabs-specific fields
          #
          tags = ["end-to-end"]
          maxDuration = 900
        }
        } }

serenity { logging = "VERBOSE" }

driver is getting initialised through :
@Managed WebDriver driver;

Facing the issue : net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class org.openqa.selenium.remote.RemoteWebDriver

bliu13 commented 4 months ago

@wakaleo I ran into a similar issue where the remote web driver could not be instantiated. I followed the SauceLabs guide and have also tried the sample configuration in the same serenity.conf file and had no success.

Here's my serenity.conf

sauce {
  username = "some.user"
  key = "some.key"
  active = true
}

serenity{
  take.screenshots = BEFORE_AND_AFTER_EACH_STEP
}

webdriver {
  driver = "remote"
  remote.url = "https://ondemand.us-west-1.saucelabs.com/wd/hub"
  autodownload = true
  capabilities {
    browserName = "chrome"
    "goog:chromeOptions" {
      args = [
        "headless=new"
        "start-maximized",
        "no-sandbox",
        "ignore-certificate-errors",
        "disable-popup-blocking",
        "disable-default-apps",
        "disable-extensions-file-access-check",
        "disable-infobars",
        "disable-gpu",
        "incognito",
      ]
      excludeSwitches = [
        "enable-automation",
        "load-extension"
      ]
      prefs {
        default_content_settings.popups = 0,
        credentials_enable_service = false,
        password_manager_enabled = false
      }
    }

    version = "latest-1"
    platform = "Linux"
    "sauce:options" {
      tags = [
        "end-to-end"
      ]
      recordVideo = true
      recordLogs = true
    }
  }
}