Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Created July 17, 2017 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelovstanton/d293bd522db5e0aaaa090e4690adce41 to your computer and use it in GitHub Desktop.
Save angelovstanton/d293bd522db5e0aaaa090e4690adce41 to your computer and use it in GitHub Desktop.
private string _username = "autoCloudTester";
private string _authkey = "70dccdcf-a9fd-4f55-aa07-12b051f6c83e";
private IWebDriver _driver;
[SetUp]
public void SetupTest()
{
var caps = new DesiredCapabilities();
caps.SetCapability("browserstack.debug", "true");
caps.SetCapability("build", "1.0");
caps.SetCapability("browserName", "Chrome");
caps.SetCapability("platform", "Windows 8.1");
caps.SetCapability("version", "49.0");
caps.SetCapability("screenResolution", "1280x800");
caps.SetCapability("username", _username);
caps.SetCapability("accessKey", _authkey);
caps.SetCapability("name", TestContext.CurrentContext.Test.Name);
_driver = new RemoteWebDriver(new Uri("http://ondemand.saucelabs.com:80/wd/hub"), caps, TimeSpan.FromSeconds(180));
_driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30);
}
[TearDown]
public void TeardownTest()
{
var passed = TestContext.CurrentContext.Result.Outcome == ResultState.Success;
try
{
// Logs the result to Sauce Labs
((IJavaScriptExecutor)_driver).ExecuteScript("sauce:job-result=" + (passed ? "passed" : "failed"));
}
finally
{
_driver.Quit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment