public static void Close() { bool passed = ScenarioContext.Current.TestError == null; var sessionIdProperty = typeof(RemoteWebDriver).GetProperty("SessionId"); SessionId sessionId = sessionIdProperty.GetValue(DriverInstance) as SessionId; if (sessionId == null) { Trace.TraceWarning("Could not obtain SessionId."); } else { Trace.TraceInformation("SessionId is " + sessionId.ToString()); } try { if (!isLocalRun) { // Logs the result to Sauce Labs ((IJavaScriptExecutor)DriverInstance).ExecuteScript("sauce:job-result=" + (passed ? "passed" : "failed")); } } finally { System.Console.WriteLine(String.Format("SauceOnDemandSessionID={0} job-name={1}", sessionId, ScenarioContext.Current.ScenarioInfo.Title)); // Terminates the remote webdriver session DriverInstance.Quit(); } }
public void DataStoringBetweenLaunchesTest() { var locationName = "New York"; var itemsPage = new ItemsPage(DriverInstance); Assert.IsTrue(itemsPage.IsOppened()); var selectedItemName = itemsPage.ClickAddLocationButton() .SetValueToSearch(locationName).ClickSearchButton() .SelectFirstLocationNameItem(); Assert.IsTrue(itemsPage.IsOppened()); var resultList = itemsPage.WaitForValueAddedInList(selectedItemName, 5).GetLocationsList(); Assert.IsTrue(resultList.Contains(selectedItemName)); DriverInstance.CloseApp(); DriverInstance.Quit(); SetupSession(); var reloadedItemsPage = new ItemsPage(DriverInstance); Assert.IsTrue(reloadedItemsPage.IsOppened()); resultList = reloadedItemsPage.WaitForValueAddedInList(selectedItemName, 5).GetLocationsList(); Assert.IsTrue(resultList.Contains(selectedItemName)); reloadedItemsPage.SelectLocationInList(selectedItemName).ClickDeleteLocationButton(); }