Skip to content

Commit 3ea2345

Browse files
committed
Updating tests for .NET
1 parent b86b104 commit 3ea2345

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

dotnet/test/common/ElementFindingTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,6 @@ public void RemovingAnElementDynamicallyFromTheDomShouldCauseAStaleRefException(
10191019
Assert.IsTrue(toBeDeleted.Displayed);
10201020

10211021
driver.FindElement(By.Id("delete")).Click();
1022-
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(500));
10231022
bool displayedAfterDelete = toBeDeleted.Displayed;
10241023
}
10251024

dotnet/test/common/FrameSwitchingTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public void ShouldNotAutomaticallySwitchFocusToAnIFrameWhenAPageContainingThemIs
2727
driver.Url = iframePage;
2828
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1));
2929
IWebElement element = driver.FindElement(By.Id("iframe_page_heading"));
30+
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0));
3031
Assert.IsNotNull(element);
3132
}
3233

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

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

@@ -397,7 +397,6 @@ public void GetCurrentUrl()
397397
public void ShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUs()
398398
{
399399
driver.Url = deletingFrame;
400-
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(1000));
401400
driver.SwitchTo().Frame("iframe1");
402401

403402
IWebElement killIframe = driver.FindElement(By.Id("killIframe"));

dotnet/test/common/ImplicitWaitTest.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ namespace OpenQA.Selenium
99
[TestFixture]
1010
public class ImplicitWaitTest : DriverTestFixture
1111
{
12+
[TearDown]
13+
public void ResetImplicitWaitTimeout()
14+
{
15+
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(0));
16+
}
17+
1218
[Test]
1319
[Category("JavaScript")]
14-
[NeedsFreshDriver]
1520
public void ShouldImplicitlyWaitForASingleElement()
1621
{
1722
driver.Url = dynamicPage;
@@ -25,7 +30,6 @@ public void ShouldImplicitlyWaitForASingleElement()
2530

2631
[Test]
2732
[Category("JavaScript")]
28-
[NeedsFreshDriver]
2933
[ExpectedException(typeof(NoSuchElementException))]
3034
public void ShouldStillFailToFindAnElementWhenImplicitWaitsAreEnabled()
3135
{

dotnet/test/common/Interactions/DragAndDropTest.cs

+22-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,28 @@ public void ElementInDiv()
5757
{
5858
driver.Url = dragAndDropPage;
5959
IWebElement img = driver.FindElement(By.Id("test3"));
60-
Point expectedLocation = drag(img, img.Location, 100, 100);
61-
Assert.AreEqual(expectedLocation, img.Location);
60+
Point startLocation = img.Location;
61+
Point expectedLocation = drag(img, startLocation, 100, 100);
62+
Point endLocation = img.Location;
63+
Assert.AreEqual(expectedLocation, endLocation);
64+
}
65+
66+
[Test]
67+
public void MemoryTest()
68+
{
69+
driver.Url = dragAndDropPage;
70+
IWebElement img1 = driver.FindElement(By.Id("test1"));
71+
IWebElement img2 = driver.FindElement(By.Id("test2"));
72+
System.Threading.Thread.Sleep(1000);
73+
for (int i = 0; i < 500; i++)
74+
{
75+
string foo = img1.GetAttribute("id");
76+
//img1 = driver.FindElement(By.Id("test1"));
77+
//Actions a = new Actions(driver);
78+
//a.MoveToElement(img1).Perform();
79+
}
80+
81+
driver.Url = simpleTestPage;
6282
}
6383

6484
[Test]

dotnet/test/common/PageLoadingTest.cs

-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public void ShouldReturnWhenGettingAUrlThatDoesNotConnect()
7171
public void ShouldBeAbleToLoadAPageWithFramesetsAndWaitUntilAllFramesAreLoaded()
7272
{
7373
driver.Url = framesetPage;
74-
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(500));
7574

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

174173
driver.Navigate().Refresh();
175-
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(3000));
176174

177175
Assert.AreEqual(driver.Title, "XHTML Test Page");
178176
}

dotnet/test/common/StaleElementReferenceTest.cs

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public void OldPage()
1616
driver.Url = simpleTestPage;
1717
IWebElement elem = driver.FindElement(By.Id("links"));
1818
driver.Url = xhtmlTestPage;
19-
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(500));
2019
elem.Click();
2120
}
2221

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

0 commit comments

Comments
 (0)