Skip to content

Commit

Permalink
.NET test maintenance to unignore tests now passing and adjust ignore…
Browse files Browse the repository at this point in the history
… messages
  • Loading branch information
jimevans committed Sep 17, 2018
1 parent 6313d22 commit 1334179
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 57 deletions.
1 change: 0 additions & 1 deletion dotnet/test/common/ElementFindingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ public void ShouldBeAbleToFindMultipleElementsByCompoundCssSelector()
}

[Test]
[IgnoreBrowser(Browser.IE, "IE supports only short version option[selected]")]
public void ShouldBeAbleToFindAnElementByBooleanAttributeUsingCssSelector()
{
driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("locators_tests/boolean_attribute_selected.html"));
Expand Down
39 changes: 7 additions & 32 deletions dotnet/test/common/Interactions/DragAndDropTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public void ElementInDiv()
}

[Test]
[IgnoreBrowser(Browser.IE, "Dragging too far in IE causes the element not to move, instead of moving to 0,0.")]
public void DragTooFar()
{
driver.Url = dragAndDropPage;
Expand All @@ -130,44 +129,20 @@ public void DragTooFar()
// its original location after the drag.
Point originalLocation = new Point(0, 0);
Actions actionProvider = new Actions(driver);
actionProvider.DragAndDropToOffset(img, int.MinValue, int.MinValue).Perform();
Point newLocation = img.Location;
Assert.That(newLocation.X, Is.LessThanOrEqualTo(0));
Assert.That(newLocation.Y, Is.LessThanOrEqualTo(0));

// TODO(jimevans): re-enable this test once moveto does not exceed the
// coordinates accepted by the browsers (Firefox in particular). At the
// moment, even though the maximal coordinates are limited, mouseUp
// fails because it cannot get the element at the given coordinates.
//actionProvider.DragAndDropToOffset(img, int.MaxValue, int.MaxValue).Perform();
//We don't know where the img is dragged to , but we know it's not too
//far, otherwise this function will not return for a long long time
Assert.That(() => actionProvider.DragAndDropToOffset(img, 2147480000, 2147400000).Perform(), Throws.InstanceOf<WebDriverException>());
new Actions(driver).Release().Perform();
}

[Test]
[IgnoreBrowser(Browser.Firefox, "Problem with drag off viewport. See issue #1771")]
[IgnoreBrowser(Browser.Firefox, "Moving outside of view port throws exception in spec-compliant driver")]
[IgnoreBrowser(Browser.IE, "Moving outside of view port throws exception in spec-compliant driver")]
public void ShouldAllowUsersToDragAndDropToElementsOffTheCurrentViewPort()
{
Size originalSize = driver.Manage().Window.Size;
Size testSize = new Size(300, 300);
driver.Url = dragAndDropPage;

IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
int height = Convert.ToInt32(js.ExecuteScript("return window.outerHeight;"));
int width = Convert.ToInt32(js.ExecuteScript("return window.outerWidth;"));
bool mustUseOffsetHeight = width == 0 && height == 0;
if (mustUseOffsetHeight)
{
width = Convert.ToInt32(js.ExecuteScript("return document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;"));
height = Convert.ToInt32(js.ExecuteScript("return document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;"));
}

js.ExecuteScript("window.resizeTo(300, 300);");
if (mustUseOffsetHeight)
{
width = width + 300 - Convert.ToInt32(js.ExecuteScript("return document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;"));
height = height + 300 - Convert.ToInt32(js.ExecuteScript("return document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;"));
}

driver.Manage().Window.Size = testSize;
try
{
driver.Url = dragAndDropPage;
Expand All @@ -177,7 +152,7 @@ public void ShouldAllowUsersToDragAndDropToElementsOffTheCurrentViewPort()
}
finally
{
js.ExecuteScript("window.resizeTo(arguments[0], arguments[1]);", width, height);
driver.Manage().Window.Size = originalSize;
}
}

Expand Down
48 changes: 24 additions & 24 deletions dotnet/test/common/WindowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void ShouldBeAbleToSetTheSizeOfTheCurrentWindow()

// resize relative to the initial size, since we don't know what it is
Size targetSize = new Size(size.Width - 20, size.Height - 20);
window.Size = targetSize;
ChangeSizeBy(-20, -20);

Size newSize = window.Size;
Assert.AreEqual(targetSize.Width, newSize.Width);
Expand Down Expand Up @@ -108,11 +108,28 @@ public void ShouldBeAbleToGetThePositionOfTheCurrentWindow()
Assert.That(position.Y, Is.GreaterThan(0));
}

[Test]
[IgnoreBrowser(Browser.Opera, "Not implemented in driver")]
public void ShouldBeAbleToSetThePositionOfTheCurrentWindow()
{
IWindow window = driver.Manage().Window;
window.Size = new Size(200, 200);
Point position = window.Position;

Point targetPosition = new Point(position.X + 10, position.Y + 10);
window.Position = targetPosition;

Point newLocation = window.Position;

Assert.AreEqual(targetPosition.X, newLocation.X);
Assert.AreEqual(targetPosition.Y, newLocation.Y);
}

[Test]
[IgnoreBrowser(Browser.Opera, "Not implemented in driver")]
public void ShouldBeAbleToMaximizeTheCurrentWindow()
{
Size targetSize = new Size(450, 275);
Size targetSize = new Size(640, 275);

ChangeSizeTo(targetSize);

Expand All @@ -128,7 +145,7 @@ public void ShouldBeAbleToMaximizeTheCurrentWindow()
public void ShouldBeAbleToMaximizeTheWindowFromFrame()
{
driver.Url = framesetPage;
ChangeSizeTo(new Size(450, 275));
ChangeSizeTo(new Size(640, 275));

driver.SwitchTo().Frame("fourth");
try
Expand All @@ -146,7 +163,7 @@ public void ShouldBeAbleToMaximizeTheWindowFromFrame()
public void ShouldBeAbleToMaximizeTheWindowFromIframe()
{
driver.Url = iframePage;
ChangeSizeTo(new Size(450, 275));
ChangeSizeTo(new Size(640, 275));

driver.SwitchTo().Frame("iframe1-name");
try
Expand All @@ -162,29 +179,13 @@ public void ShouldBeAbleToMaximizeTheWindowFromIframe()
//------------------------------------------------------------------
// Tests below here are not included in the Java test suite
//------------------------------------------------------------------
[Test]
[IgnoreBrowser(Browser.Opera, "Not implemented in driver")]
public void ShouldBeAbleToSetThePositionOfTheCurrentWindow()
{
IWindow window = driver.Manage().Window;
Point position = window.Position;

Point targetPosition = new Point(position.X + 10, position.Y + 10);
window.Position = targetPosition;

Point newLocation = window.Position;

Assert.AreEqual(targetPosition.X, newLocation.X);
Assert.AreEqual(targetPosition.Y, newLocation.Y);
}


[Test]
[IgnoreBrowser(Browser.Edge, "Not implemented in driver")]
[IgnoreBrowser(Browser.Edge, "Edge driver does not implement the full screen command")]
[IgnoreBrowser(Browser.Opera, "Not implemented in driver")]
public void ShouldBeAbleToFullScreenTheCurrentWindow()
{
Size targetSize = new Size(450, 275);
Size targetSize = new Size(640, 275);

ChangeSizeTo(targetSize);

Expand All @@ -198,12 +199,11 @@ public void ShouldBeAbleToFullScreenTheCurrentWindow()
}

[Test]
[IgnoreBrowser(Browser.Edge, "Not implemented in driver")]
[IgnoreBrowser(Browser.Chrome, "Chrome window size does not report zero when minimized.")]
[IgnoreBrowser(Browser.Opera, "Not implemented in driver")]
public void ShouldBeAbleToMinimizeTheCurrentWindow()
{
Size targetSize = new Size(450, 275);
Size targetSize = new Size(640, 275);

ChangeSizeTo(targetSize);

Expand Down

0 comments on commit 1334179

Please sign in to comment.