Skip to content

Commit

Permalink
Adding more custom driver configs to .NET tests for Bazel migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Jun 3, 2019
1 parent fa0bbc9 commit 451b063
Show file tree
Hide file tree
Showing 33 changed files with 191 additions and 120 deletions.
22 changes: 11 additions & 11 deletions dotnet/test/common/AlertsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public void ShouldAllowUsersToAcceptAnAlertWithNoTextManually()

[Test]
[IgnoreBrowser(Browser.Chrome, "This is the correct behavior, for the SwitchTo call to throw if it happens before the setTimeout call occurs in the browser and the alert is displayed.")]
[IgnoreBrowser(Browser.ChromiumEdge, "This is the correct behavior, for the SwitchTo call to throw if it happens before the setTimeout call occurs in the browser and the alert is displayed.")]
[IgnoreBrowser(Browser.Edge, "This is the correct behavior, for the SwitchTo call to throw if it happens before the setTimeout call occurs in the browser and the alert is displayed.")]
[IgnoreBrowser(Browser.EdgeLegacy, "This is the correct behavior, for the SwitchTo call to throw if it happens before the setTimeout call occurs in the browser and the alert is displayed.")]
[IgnoreBrowser(Browser.IE, "This is the correct behavior, for the SwitchTo call to throw if it happens before the setTimeout call occurs in the browser and the alert is displayed.")]
[IgnoreBrowser(Browser.Firefox, "This is the correct behavior, for the SwitchTo call to throw if it happens before the setTimeout call occurs in the browser and the alert is displayed.")]
[IgnoreBrowser(Browser.Safari, "This is the correct behavior, for the SwitchTo call to throw if it happens before the setTimeout call occurs in the browser and the alert is displayed.")]
Expand Down Expand Up @@ -402,7 +402,7 @@ public void ShouldHandleAlertOnPageLoadUsingGet()

[Test]
[IgnoreBrowser(Browser.Chrome, "Test with onLoad alert hangs Chrome.")]
[IgnoreBrowser(Browser.ChromiumEdge, "Test with onLoad alert hangs Edge.")]
[IgnoreBrowser(Browser.Edge, "Test with onLoad alert hangs Edge.")]
[IgnoreBrowser(Browser.Safari, "Safari driver does not allow commands in any window when an alert is active")]
public void ShouldNotHandleAlertInAnotherWindow()
{
Expand Down Expand Up @@ -449,8 +449,8 @@ public void ShouldNotHandleAlertInAnotherWindow()
[Test]
[IgnoreBrowser(Browser.Firefox, "After version 27, Firefox does not trigger alerts on unload.")]
[IgnoreBrowser(Browser.Chrome, "Chrome does not trigger alerts on unload.")]
[IgnoreBrowser(Browser.ChromiumEdge, "Edge does not trigger alerts on unload.")]
[IgnoreBrowser(Browser.Edge, "Edge does not trigger alerts on unload.")]
[IgnoreBrowser(Browser.EdgeLegacy, "Edge does not trigger alerts on unload.")]
public void ShouldHandleAlertOnPageUnload()
{
string pageWithOnBeforeUnload = EnvironmentManager.Instance.UrlBuilder.CreateInlinePage(new InlinePage()
Expand All @@ -474,9 +474,9 @@ public void ShouldHandleAlertOnPageUnload()

[Test]
[IgnoreBrowser(Browser.Chrome, "Chrome does not implicitly handle onBeforeUnload alert")]
[IgnoreBrowser(Browser.ChromiumEdge, "Edge does not implicitly handle onBeforeUnload alert")]
[IgnoreBrowser(Browser.Edge, "Edge does not implicitly handle onBeforeUnload alert")]
[IgnoreBrowser(Browser.Safari, "Safari driver does not implicitly (or otherwise) handle onBeforeUnload alerts")]
[IgnoreBrowser(Browser.Edge, "Edge driver does not implicitly (or otherwise) handle onBeforeUnload alerts")]
[IgnoreBrowser(Browser.EdgeLegacy, "Edge driver does not implicitly (or otherwise) handle onBeforeUnload alerts")]
public void ShouldImplicitlyHandleAlertOnPageBeforeUnload()
{
string blank = EnvironmentManager.Instance.UrlBuilder.CreateInlinePage(new InlinePage().WithTitle("Success"));
Expand All @@ -494,9 +494,9 @@ public void ShouldImplicitlyHandleAlertOnPageBeforeUnload()
[Test]
[IgnoreBrowser(Browser.IE, "Test as written does not trigger alert; also onbeforeunload alert on close will hang browser")]
[IgnoreBrowser(Browser.Chrome, "Test as written does not trigger alert")]
[IgnoreBrowser(Browser.ChromiumEdge, "Test as written does not trigger alert")]
[IgnoreBrowser(Browser.Edge, "Test as written does not trigger alert")]
[IgnoreBrowser(Browser.Firefox, "After version 27, Firefox does not trigger alerts on unload.")]
[IgnoreBrowser(Browser.Edge, "Edge does not trigger alerts on unload.")]
[IgnoreBrowser(Browser.EdgeLegacy, "Edge does not trigger alerts on unload.")]
public void ShouldHandleAlertOnWindowClose()
{
string pageWithOnBeforeUnload = EnvironmentManager.Instance.UrlBuilder.CreateInlinePage(new InlinePage()
Expand Down Expand Up @@ -530,8 +530,8 @@ public void ShouldHandleAlertOnWindowClose()

[Test]
[IgnoreBrowser(Browser.Chrome, "Driver chooses not to return text from unhandled alert")]
[IgnoreBrowser(Browser.ChromiumEdge, "Driver chooses not to return text from unhandled alert")]
[IgnoreBrowser(Browser.Edge, "Driver chooses not to return text from unhandled alert")]
[IgnoreBrowser(Browser.EdgeLegacy, "Driver chooses not to return text from unhandled alert")]
[IgnoreBrowser(Browser.Firefox, "Driver chooses not to return text from unhandled alert")]
[IgnoreBrowser(Browser.Opera)]
[IgnoreBrowser(Browser.Safari, "Safari driver does not do unhandled alerts")]
Expand Down Expand Up @@ -623,8 +623,8 @@ public void ShouldHandleAlertOnPageBeforeUnloadAlertAtQuit()
// Disabling test for all browsers. Authentication API is not supported by any driver yet.
// [Test]
[IgnoreBrowser(Browser.Chrome)]
[IgnoreBrowser(Browser.ChromiumEdge)]
[IgnoreBrowser(Browser.Edge)]
[IgnoreBrowser(Browser.EdgeLegacy)]
[IgnoreBrowser(Browser.Firefox)]
[IgnoreBrowser(Browser.IE)]
[IgnoreBrowser(Browser.Opera)]
Expand All @@ -642,8 +642,8 @@ public void ShouldBeAbleToHandleAuthenticationDialog()
// Disabling test for all browsers. Authentication API is not supported by any driver yet.
// [Test]
[IgnoreBrowser(Browser.Chrome)]
[IgnoreBrowser(Browser.ChromiumEdge)]
[IgnoreBrowser(Browser.Edge)]
[IgnoreBrowser(Browser.EdgeLegacy)]
[IgnoreBrowser(Browser.Firefox)]
[IgnoreBrowser(Browser.IE)]
[IgnoreBrowser(Browser.Opera)]
Expand All @@ -659,8 +659,8 @@ public void ShouldBeAbleToDismissAuthenticationDialog()
// Disabling test for all browsers. Authentication API is not supported by any driver yet.
// [Test]
[IgnoreBrowser(Browser.Chrome)]
[IgnoreBrowser(Browser.ChromiumEdge)]
[IgnoreBrowser(Browser.Edge)]
[IgnoreBrowser(Browser.EdgeLegacy)]
[IgnoreBrowser(Browser.Firefox)]
[IgnoreBrowser(Browser.Opera)]
[IgnoreBrowser(Browser.Remote)]
Expand Down
4 changes: 2 additions & 2 deletions dotnet/test/common/AvailableLogsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace OpenQA.Selenium
{
[TestFixture]
[IgnoreBrowser(Browser.Edge, "Edge driver does not support logs API")]
[IgnoreBrowser(Browser.EdgeLegacy, "Edge driver does not support logs API")]
[IgnoreBrowser(Browser.Firefox, "Firefox driver (when using Marionette/Geckodriver) does not support logs API")]
[IgnoreBrowser(Browser.IE, "IE driver does not support logs API")]
[IgnoreBrowser(Browser.Safari, "Edge driver does not support logs API")]
Expand Down Expand Up @@ -69,7 +69,7 @@ public void ProfilerLogShouldBeDisabledByDefault()

//[Test]
[IgnoreBrowser(Browser.Chrome, "Chrome does not support profiler logs")]
[IgnoreBrowser(Browser.ChromiumEdge, "Edge does not support profiler logs")]
[IgnoreBrowser(Browser.Edge, "Edge does not support profiler logs")]
public void ShouldBeAbleToEnableProfilerLog()
{
CreateWebDriverWithProfiling();
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/common/Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ public enum Browser
{
All,
IE,
ChromiumEdge,
Edge,
EdgeLegacy,
Firefox,
Safari,
Chrome,
Expand Down
6 changes: 3 additions & 3 deletions dotnet/test/common/ClearTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ public void ShouldBeAbleToClearUrlInput()
}

[Test]
[IgnoreBrowser(Browser.Edge, "Driver sees range input as not editable")]
[IgnoreBrowser(Browser.EdgeLegacy, "Driver sees range input as not editable")]
public void ShouldBeAbleToClearRangeInput()
{
ShouldBeAbleToClearInput(By.Name("range_input"), "42", "50");
}

[Test]
[IgnoreBrowser(Browser.Chrome, "Driver sees checkbox as not editable")]
[IgnoreBrowser(Browser.ChromiumEdge, "Driver sees checkbox as not editable")]
[IgnoreBrowser(Browser.Edge, "Driver sees checkbox as not editable")]
[IgnoreBrowser(Browser.EdgeLegacy, "Driver sees checkbox as not editable")]
[IgnoreBrowser(Browser.Firefox, "Driver sees checkbox as not editable")]
[IgnoreBrowser(Browser.IE, "Driver sees checkbox as not editable")]
[IgnoreBrowser(Browser.Safari, "Driver sees checkbox as not editable")]
Expand All @@ -136,7 +136,7 @@ public void ShouldBeAbleToClearCheckboxInput()
}

[Test]
[IgnoreBrowser(Browser.Edge, "Driver sees color input as not editable")]
[IgnoreBrowser(Browser.EdgeLegacy, "Driver sees color input as not editable")]
[IgnoreBrowser(Browser.IE, "Driver does not support clearing color elements")]
public void ShouldBeAbleToClearColorInput()
{
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/common/ClickScrollingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void ShouldNotScrollOverflowElementsWhichAreVisible()

[Test]
[IgnoreBrowser(Browser.Chrome, "Webkit-based browsers apparently scroll anyway.")]
[IgnoreBrowser(Browser.ChromiumEdge, "Webkit-based browsers apparently scroll anyway.")]
[IgnoreBrowser(Browser.Edge, "Webkit-based browsers apparently scroll anyway.")]
public void ShouldNotScrollIfAlreadyScrolledAndElementIsInView()
{
driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("scroll3.html");
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/common/ClickTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ public void ShouldBeAbleToClickOnASpanThatWrapsToTheNextLine()
[Test]
[IgnoreBrowser(Browser.IE, "Element is properly seen as obscured.")]
[IgnoreBrowser(Browser.Chrome, "Element is properly seen as obscured.")]
[IgnoreBrowser(Browser.ChromiumEdge, "Element is properly seen as obscured.")]
[IgnoreBrowser(Browser.Edge, "Element is properly seen as obscured.")]
[IgnoreBrowser(Browser.EdgeLegacy, "Element is properly seen as obscured.")]
[IgnoreBrowser(Browser.Firefox, "Element is properly seen as obscured.")]
[IgnoreBrowser(Browser.Safari, "Element is properly seen as obscured.")]
public void ShouldBeAbleToClickOnAPartiallyOverlappedLinkThatWrapsToTheNextLine()
Expand Down
6 changes: 3 additions & 3 deletions dotnet/test/common/ContentEditableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void ShouldBeAbleToTypeIntoEmptyContentEditableElement()

[Test]
[IgnoreBrowser(Browser.Chrome, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.ChromiumEdge, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.Edge, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.Firefox, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.Safari, "Driver prepends text to contentEditable areas")]
public void ShouldBeAbleToTypeIntoContentEditableElementWithExistingValue()
Expand Down Expand Up @@ -94,7 +94,7 @@ public void ShouldBeAbleToTypeIntoTinyMCE()

[Test]
[IgnoreBrowser(Browser.Chrome, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.ChromiumEdge, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.Edge, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.Firefox, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.IE, "Prepends text")]
[IgnoreBrowser(Browser.Safari, "Driver prepends text to contentEditable areas")]
Expand All @@ -113,7 +113,7 @@ public void ShouldAppendToTinyMCE()

[Test]
[IgnoreBrowser(Browser.Chrome, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.ChromiumEdge, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.Edge, "Driver prepends text in contentEditable areas")]
[IgnoreBrowser(Browser.Firefox, "Browser does not automatically focus body element in frame")]
[IgnoreBrowser(Browser.Safari, "Driver prepends text to contentEditable areas")]
public void AppendsTextToEndOfContentEditableWithMultipleTextNodes()
Expand Down
6 changes: 3 additions & 3 deletions dotnet/test/common/CookieImplementationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void AddCookiesWithDifferentPathsThatAreRelatedToOurs()

[Test]
[IgnoreBrowser(Browser.Chrome, "Chrome does not retrieve cookies when in frame.")]
[IgnoreBrowser(Browser.ChromiumEdge, "Edge does not retrieve cookies when in frame.")]
[IgnoreBrowser(Browser.Edge, "Edge does not retrieve cookies when in frame.")]
public void GetCookiesInAFrame()
{
driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("animals");
Expand Down Expand Up @@ -469,7 +469,7 @@ public void ShouldRetainCookieExpiry()

[Test]
[IgnoreBrowser(Browser.IE, "Browser does not handle untrusted SSL certificates.")]
[IgnoreBrowser(Browser.Edge, "Browser does not handle untrusted SSL certificates.")]
[IgnoreBrowser(Browser.EdgeLegacy, "Browser does not handle untrusted SSL certificates.")]
public void CanHandleSecureCookie()
{
driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIsSecure("animals");
Expand All @@ -485,7 +485,7 @@ public void CanHandleSecureCookie()

[Test]
[IgnoreBrowser(Browser.IE, "Browser does not handle untrusted SSL certificates.")]
[IgnoreBrowser(Browser.Edge, "Browser does not handle untrusted SSL certificates.")]
[IgnoreBrowser(Browser.EdgeLegacy, "Browser does not handle untrusted SSL certificates.")]
public void ShouldRetainCookieSecure()
{
driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIsSecure("animals");
Expand Down
8 changes: 4 additions & 4 deletions dotnet/test/common/CorrectEventFiringTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void ShouldFireFocusEventWhenClicking()

[Test]
[NeedsFreshDriver(IsCreatedBeforeTest = true, IsCreatedAfterTest = true)]
[IgnoreBrowser(Browser.Edge, "Edge driver does not support multiple instances")]
[IgnoreBrowser(Browser.EdgeLegacy, "Edge driver does not support multiple instances")]
[IgnoreBrowser(Browser.Safari, "Safari driver does not support multiple instances")]
public void ShouldFireFocusEventInNonTopmostWindow()
{
Expand Down Expand Up @@ -265,7 +265,7 @@ public void SendingKeysToAnotherElementShouldCauseTheBlurEventToFire()
}

[Test]
[IgnoreBrowser(Browser.Edge, "Edge driver does not support multiple instances")]
[IgnoreBrowser(Browser.EdgeLegacy, "Edge driver does not support multiple instances")]
[IgnoreBrowser(Browser.Safari, "Safari driver does not support multiple instances")]
public void SendingKeysToAnotherElementShouldCauseTheBlurEventToFireInNonTopmostWindow()
{
Expand Down Expand Up @@ -462,8 +462,8 @@ public void ClickOverlappingElements()

[Test]
[IgnoreBrowser(Browser.Chrome, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.ChromiumEdge, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.Edge, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.EdgeLegacy, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.Firefox, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.IE, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.Safari, "Driver checks for overlapping elements")]
Expand Down Expand Up @@ -495,8 +495,8 @@ public void ClickPartiallyOverlappingElements()

[Test]
[IgnoreBrowser(Browser.Chrome, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.ChromiumEdge, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.Edge, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.EdgeLegacy, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.Firefox, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.IE, "Driver checks for overlapping elements")]
[IgnoreBrowser(Browser.Safari, "Driver checks for overlapping elements")]
Expand Down
35 changes: 35 additions & 0 deletions dotnet/test/common/CustomDriverConfigs/ChromiumEdgeDriver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenQA.Selenium.Edge
{
public class ChromiumEdgeDriver : EdgeDriver
{
public ChromiumEdgeDriver()
: this(DefaultService, DefaultOptions)
{
}

public ChromiumEdgeDriver(EdgeDriverService service, EdgeOptions options)
: base(service, options)
{
}

public static EdgeOptions DefaultOptions
{
get { return new EdgeOptions(false) { UseSpecCompliantProtocol = true }; }
}

public static EdgeDriverService DefaultService
{
get
{
EdgeDriverService service = EdgeDriverService.CreateDefaultService(false);
return service;
}
}
}
}
31 changes: 31 additions & 0 deletions dotnet/test/common/CustomDriverConfigs/DefaultEdgeDriver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenQA.Selenium.Edge
{
public class DefaultEdgeDriver : EdgeDriver
{
public DefaultEdgeDriver()
: this(DefaultService, new EdgeOptions())
{
}

public DefaultEdgeDriver(EdgeDriverService service, EdgeOptions options)
: base(service, options)
{
}

public static EdgeDriverService DefaultService
{
get
{
EdgeDriverService service = EdgeDriverService.CreateDefaultService();
service.UseSpecCompliantProtocol = true;
return service;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace OpenQA.Selenium.Chrome
{
public class SpecCompliantChromeDriver : ChromeDriver
{
public SpecCompliantChromeDriver(ChromeDriverService service)
: this(service, DefaultOptions)
{
}

public SpecCompliantChromeDriver(ChromeDriverService service, ChromeOptions options)
: base(service, options)
{
}

public static ChromeOptions DefaultOptions
{
get { return new ChromeOptions() { UseSpecCompliantProtocol = true }; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private bool IsRemoteInstanceOfBrowser(Browser desiredBrowser)
isRemoteInstance = true;
}
break;
case Browser.ChromiumEdge:
case Browser.Edge:
if (EnvironmentManager.Instance.RemoteCapabilities == "MicrosoftEdge")
{
isRemoteInstance = true;
Expand Down

0 comments on commit 451b063

Please sign in to comment.