Skip to content

Commit

Permalink
Updating ignored .NET tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed May 26, 2018
1 parent c01f9ce commit 0f516a8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion dotnet/test/common/CookieImplementationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ public void ShouldNotShowCookieAddedToDifferentDomain()
driver.Url = macbethPage;
IOptions options = driver.Manage();
Cookie cookie = new Cookie("Bart", "Simpson", EnvironmentManager.Instance.UrlBuilder.HostName + ".com", EnvironmentManager.Instance.UrlBuilder.Path, null);
Assert.That(() => options.Cookies.AddCookie(cookie), Throws.InstanceOf<WebDriverException>());
Assert.That(() => options.Cookies.AddCookie(cookie), Throws.InstanceOf<WebDriverException>().Or.InstanceOf<InvalidOperationException>());
ReadOnlyCollection<Cookie> cookies = options.Cookies.AllCookies;
Assert.IsFalse(cookies.Contains(cookie), "Invalid cookie was returned");
}
Expand Down
11 changes: 2 additions & 9 deletions dotnet/test/common/FrameSwitchingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ public void FrameSearchesShouldBeRelativeToTheCurrentlySelectedFrame()
{
driver.Url = framesetPage;

driver.SwitchTo().Frame("second");
IWebElement frameElement = WaitFor(() => driver.FindElement(By.Name("second")), "did not find frame");
driver.SwitchTo().Frame(frameElement);
Assert.AreEqual("2", driver.FindElement(By.Id("pageNumber")).Text);

try
Expand Down Expand Up @@ -532,14 +533,6 @@ public void GetShouldSwitchToDefaultContext()
//
// ----------------------------------------------------------------------------------------------

[Test]
[NeedsFreshDriver(IsCreatedAfterTest = true)]
public void ClosingTheFinalBrowserWindowShouldNotCauseAnExceptionToBeThrown()
{
driver.Url = simpleTestPage;
driver.Close();
}

[Test]
public void ShouldBeAbleToFlipToAFrameIdentifiedByItsId()
{
Expand Down
26 changes: 13 additions & 13 deletions dotnet/test/common/TypingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ public void ShouldFireFocusKeyEventsInTheRightOrder()

[Test]
[Category("Javascript")]
[IgnoreBrowser(Browser.IE, "Firefox-specific test. IE does not report key press event.")]
public void ShouldReportKeyCodeOfArrowKeys()
{
driver.Url = javascriptPage;
Expand All @@ -243,16 +242,16 @@ public void ShouldReportKeyCodeOfArrowKeys()
IWebElement element = driver.FindElement(By.Id("keyReporter"));

element.SendKeys(Keys.ArrowDown);
Assert.AreEqual("down: 40 press: 40 up: 40", result.Text.Trim());
CheckRecordedKeySequence(result, 40);

element.SendKeys(Keys.ArrowUp);
Assert.AreEqual("down: 38 press: 38 up: 38", result.Text.Trim());
CheckRecordedKeySequence(result, 38);

element.SendKeys(Keys.ArrowLeft);
Assert.AreEqual("down: 37 press: 37 up: 37", result.Text.Trim());
CheckRecordedKeySequence(result, 37);

element.SendKeys(Keys.ArrowRight);
Assert.AreEqual("down: 39 press: 39 up: 39", result.Text.Trim());
CheckRecordedKeySequence(result, 39);

// And leave no rubbish/printable keys in the "keyReporter"
Assert.AreEqual(string.Empty, element.GetAttribute("value"));
Expand Down Expand Up @@ -601,7 +600,6 @@ public void ShouldTypeIntoInputElementsThatHaveNoTypeAttribute()

[Test]
[Category("Javascript")]
[IgnoreBrowser(Browser.Chrome, "ChromeDriver2 allows typing into elements that prevent keydown")]
public void ShouldNotTypeIntoElementsThatPreventKeyDownEvents()
{
driver.Url = javascriptPage;
Expand Down Expand Up @@ -675,7 +673,6 @@ public void CanSafelyTypeOnElementThatIsRemovedFromTheDomOnKeyPress()
}

[Test]
[IgnoreBrowser(Browser.Chrome, "Not implemented")]
public void CanClearNumberInputAfterTypingInvalidInput()
{
driver.Url = formsPage;
Expand All @@ -692,7 +689,6 @@ public void CanClearNumberInputAfterTypingInvalidInput()
[Test]
[Category("Javascript")]
[IgnoreBrowser(Browser.Opera, "Does not support contentEditable")]
[IgnoreBrowser(Browser.Chrome, "ChromeDriver2 does not support contentEditable yet")]
public void TypingIntoAnIFrameWithContentEditableOrDesignModeSet()
{
if (TestUtilities.IsMarionette(driver))
Expand All @@ -717,7 +713,7 @@ public void TypingIntoAnIFrameWithContentEditableOrDesignModeSet()
[Test]
[Category("Javascript")]
[IgnoreBrowser(Browser.Opera, "Does not support contentEditable")]
[IgnoreBrowser(Browser.Chrome, "ChromeDriver 2 does not support contentEditable")]
[IgnoreBrowser(Browser.Chrome, "ChromeDriver prepends text in contentEditable")]
public void NonPrintableCharactersShouldWorkWithContentEditableOrDesignModeSet()
{
if (TestUtilities.IsMarionette(driver))
Expand Down Expand Up @@ -746,7 +742,6 @@ public void NonPrintableCharactersShouldWorkWithContentEditableOrDesignModeSet()

[Test]
[IgnoreBrowser(Browser.Opera, "Does not support contentEditable")]
[IgnoreBrowser(Browser.Chrome, "ChromeDriver2 does not support contentEditable yet")]
public void ShouldBeAbleToTypeIntoEmptyContentEditableElement()
{
if (TestUtilities.IsMarionette(driver))
Expand All @@ -764,8 +759,7 @@ public void ShouldBeAbleToTypeIntoEmptyContentEditableElement()
}

[Test]
[IgnoreBrowser(Browser.Chrome, "ChromeDriver2 does not support contentEditable yet")]
[IgnoreBrowser(Browser.IE, "IE places cursor at beginning of content")]
[IgnoreBrowser(Browser.Chrome, "ChromeDriver prepends text")]
public void ShouldBeAbleToTypeIntoContentEditableElementWithExistingValue()
{
if (TestUtilities.IsMarionette(driver))
Expand All @@ -783,7 +777,6 @@ public void ShouldBeAbleToTypeIntoContentEditableElementWithExistingValue()
}

[Test]
[IgnoreBrowser(Browser.IE, "Untested browser")]
[NeedsFreshDriver(IsCreatedAfterTest = true)]
public void ShouldBeAbleToTypeIntoTinyMCE()
{
Expand All @@ -803,5 +796,12 @@ private string GetValueText(IWebElement el)
// Standardize on \n and strip any trailing whitespace.
return el.GetAttribute("value").Replace("\r\n", "\n").Trim();
}

private void CheckRecordedKeySequence(IWebElement element, int expectedKeyCode)
{
string withKeyPress = string.Format("down: {0} press: {0} up: {0}", expectedKeyCode);
string withoutKeyPress = string.Format("down: {0} up: {0}", expectedKeyCode);
Assert.That(element.Text.Trim(), Is.AnyOf(withKeyPress, withoutKeyPress));
}
}
}

0 comments on commit 0f516a8

Please sign in to comment.