Created
July 17, 2017 13:24
-
-
Save angelovstanton/d293bd522db5e0aaaa090e4690adce41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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