Skip to content

Commit

Permalink
Updating tests for .NET
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Oct 23, 2014
1 parent b86b104 commit 3ea2345
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
1 change: 0 additions & 1 deletion dotnet/test/common/ElementFindingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,6 @@ public void RemovingAnElementDynamicallyFromTheDomShouldCauseAStaleRefException(
Assert.IsTrue(toBeDeleted.Displayed);

driver.FindElement(By.Id("delete")).Click();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(500));
bool displayedAfterDelete = toBeDeleted.Displayed;
}

Expand Down
3 changes: 1 addition & 2 deletions dotnet/test/common/FrameSwitchingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void ShouldNotAutomaticallySwitchFocusToAnIFrameWhenAPageContainingThemIs
driver.Url = iframePage;
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1));
IWebElement element = driver.FindElement(By.Id("iframe_page_heading"));
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0));
Assert.IsNotNull(element);
}

Expand Down Expand Up @@ -335,7 +336,6 @@ public void ShouldBeAbleToClickInASubFrame()
// This should replaxe frame "iframe1" inside frame "sixth" ...
driver.FindElement(By.Id("submitButton")).Click();

driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(500));
// driver should still be focused on frame "iframe1" inside frame "sixth" ...
Assert.AreEqual("Success!", GetTextOfGreetingElement());

Expand Down Expand Up @@ -397,7 +397,6 @@ public void GetCurrentUrl()
public void ShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUs()
{
driver.Url = deletingFrame;
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(1000));
driver.SwitchTo().Frame("iframe1");

IWebElement killIframe = driver.FindElement(By.Id("killIframe"));
Expand Down
8 changes: 6 additions & 2 deletions dotnet/test/common/ImplicitWaitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ namespace OpenQA.Selenium
[TestFixture]
public class ImplicitWaitTest : DriverTestFixture
{
[TearDown]
public void ResetImplicitWaitTimeout()
{
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(0));
}

[Test]
[Category("JavaScript")]
[NeedsFreshDriver]
public void ShouldImplicitlyWaitForASingleElement()
{
driver.Url = dynamicPage;
Expand All @@ -25,7 +30,6 @@ public void ShouldImplicitlyWaitForASingleElement()

[Test]
[Category("JavaScript")]
[NeedsFreshDriver]
[ExpectedException(typeof(NoSuchElementException))]
public void ShouldStillFailToFindAnElementWhenImplicitWaitsAreEnabled()
{
Expand Down
24 changes: 22 additions & 2 deletions dotnet/test/common/Interactions/DragAndDropTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,28 @@ public void ElementInDiv()
{
driver.Url = dragAndDropPage;
IWebElement img = driver.FindElement(By.Id("test3"));
Point expectedLocation = drag(img, img.Location, 100, 100);
Assert.AreEqual(expectedLocation, img.Location);
Point startLocation = img.Location;
Point expectedLocation = drag(img, startLocation, 100, 100);
Point endLocation = img.Location;
Assert.AreEqual(expectedLocation, endLocation);
}

[Test]
public void MemoryTest()
{
driver.Url = dragAndDropPage;
IWebElement img1 = driver.FindElement(By.Id("test1"));
IWebElement img2 = driver.FindElement(By.Id("test2"));
System.Threading.Thread.Sleep(1000);
for (int i = 0; i < 500; i++)
{
string foo = img1.GetAttribute("id");
//img1 = driver.FindElement(By.Id("test1"));
//Actions a = new Actions(driver);
//a.MoveToElement(img1).Perform();
}

driver.Url = simpleTestPage;
}

[Test]
Expand Down
2 changes: 0 additions & 2 deletions dotnet/test/common/PageLoadingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public void ShouldReturnWhenGettingAUrlThatDoesNotConnect()
public void ShouldBeAbleToLoadAPageWithFramesetsAndWaitUntilAllFramesAreLoaded()
{
driver.Url = framesetPage;
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(500));

driver.SwitchTo().Frame(0);
IWebElement pageNumber = driver.FindElement(By.XPath("//span[@id='pageNumber']"));
Expand Down Expand Up @@ -172,7 +171,6 @@ public void ShouldBeAbleToRefreshAPage()
driver.Url = xhtmlTestPage;

driver.Navigate().Refresh();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(3000));

Assert.AreEqual(driver.Title, "XHTML Test Page");
}
Expand Down
2 changes: 0 additions & 2 deletions dotnet/test/common/StaleElementReferenceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public void OldPage()
driver.Url = simpleTestPage;
IWebElement elem = driver.FindElement(By.Id("links"));
driver.Url = xhtmlTestPage;
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(500));
elem.Click();
}

Expand All @@ -28,7 +27,6 @@ public void ShouldNotCrashWhenCallingGetSizeOnAnObsoleteElement()
driver.Url = simpleTestPage;
IWebElement elem = driver.FindElement(By.Id("links"));
driver.Url = xhtmlTestPage;
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(500));
Size elementSize = elem.Size;
}

Expand Down

0 comments on commit 3ea2345

Please sign in to comment.