Skip to content

Commit

Permalink
Updating .NET drag and drop tests to sync with Java tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Oct 21, 2013
1 parent 769905d commit 5fd112b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions dotnet/test/common/DragAndDropTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,30 @@ public void DragAndDropOnJQueryItems()
Assert.IsTrue(reporterText.Contains("move"), "Reporter text:" + reporterText);
}

[Test]
[Category("Javascript")]
[IgnoreBrowser(Browser.HtmlUnit)]
[IgnoreBrowser(Browser.Opera, "Untested")]
[IgnoreBrowser(Browser.PhantomJS, "Untested")]
[IgnoreBrowser(Browser.Safari, "Advanced User Interactions not implmented on Safari")]
public void CanDragAnElementNotVisibleInTheCurrentViewportDueToAParentOverflow()
{
driver.Url = dragDropOverflowPage;

IWebElement toDrag = driver.FindElement(By.Id("time-marker"));
IWebElement dragTo = driver.FindElement(By.Id("11am"));

Point srcLocation = toDrag.Location;
Point targetLocation = dragTo.Location;

int yOffset = targetLocation.Y - srcLocation.Y;
Assert.AreNotEqual(0, yOffset);

new Actions(driver).DragAndDropToOffset(toDrag, 0, yOffset).Perform();

Assert.AreEqual(dragTo.Location, toDrag.Location);
}

private Point drag(IWebElement elem, Point initialLocation, int moveRightBy, int moveDownBy)
{
Point expectedLocation = new Point(initialLocation.X, initialLocation.Y);
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/common/DriverTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public abstract class DriverTestFixture
public string xhtmlFormPage = EnvironmentManager.Instance.UrlBuilder.WhereIs("xhtmlFormPage.xhtml");
public string svgTestPage = EnvironmentManager.Instance.UrlBuilder.WhereIs("svgTest.svg");
public string slowLoadingAlertPage = EnvironmentManager.Instance.UrlBuilder.WhereIs("slowLoadingAlert.html");
public string dragDropOverflowPage = EnvironmentManager.Instance.UrlBuilder.WhereIs("dragDropOverflow.html");

protected IWebDriver driver;

Expand Down

0 comments on commit 5fd112b

Please sign in to comment.