Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Appium.WebDriver instead of Selenium.WebDriver for tests. #28

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Use `dotnet build` to build.

## Testing

Use `dotnet test` to run tests. At the moment the tests are end-to-end UI tests that use [Selenium.WebDriver](https://www.nuget.org/packages/Selenium.WebDriver) to operate a test application, running FlaUI.WebDriver.exe in the background, so they should be run on Windows.
Use `dotnet test` to run tests. At the moment the tests are end-to-end UI tests that use [Appium.WebDriver](https://github.com/appium/dotnet-client) to operate a test application, running FlaUI.WebDriver.exe in the background, so they should be run on Windows.

Add UI tests for every feature added and every bug fixed, and feel free to improve existing test coverage.

Expand Down
6 changes: 3 additions & 3 deletions src/FlaUI.WebDriver.UITests/ActionsTest.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
using FlaUI.WebDriver.UITests.TestUtil;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Remote;

namespace FlaUI.WebDriver.UITests
{
[TestFixture]
public class ActionsTests
{
private RemoteWebDriver _driver;
private WindowsDriver _driver;

[SetUp]
public void Setup()
{
var driverOptions = FlaUIDriverOptions.TestApp();
_driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
_driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
}

[TearDown]
Expand Down
29 changes: 15 additions & 14 deletions src/FlaUI.WebDriver.UITests/ElementTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using FlaUI.WebDriver.UITests.TestUtil;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium.Remote;
using System;

Expand All @@ -13,7 +14,7 @@ public class ElementTests
public void GetText_Label_ReturnsRenderedText()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("Label"));

var text = element.Text;
Expand All @@ -25,7 +26,7 @@ public void GetText_Label_ReturnsRenderedText()
public void GetText_TextBox_ReturnsTextBoxText()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("TextBox"));

var text = element.Text;
Expand All @@ -37,7 +38,7 @@ public void GetText_TextBox_ReturnsTextBoxText()
public void GetText_Button_ReturnsButtonText()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("InvokableButton"));

var text = element.Text;
Expand All @@ -49,7 +50,7 @@ public void GetText_Button_ReturnsButtonText()
public void Selected_NotCheckedCheckbox_ReturnsFalse()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("SimpleCheckBox"));

var selected = element.Selected;
Expand All @@ -61,7 +62,7 @@ public void Selected_NotCheckedCheckbox_ReturnsFalse()
public void Selected_CheckedCheckbox_ReturnsTrue()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("SimpleCheckBox"));
element.Click();

Expand All @@ -74,7 +75,7 @@ public void Selected_CheckedCheckbox_ReturnsTrue()
public void Selected_NotCheckedRadioButton_ReturnsFalse()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("RadioButton1"));

var selected = element.Selected;
Expand All @@ -86,7 +87,7 @@ public void Selected_NotCheckedRadioButton_ReturnsFalse()
public void Selected_CheckedRadioButton_ReturnsTrue()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("RadioButton1"));
element.Click();

Expand All @@ -99,7 +100,7 @@ public void Selected_CheckedRadioButton_ReturnsTrue()
public void SendKeys_Default_IsSupported()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("TextBox"));

element.SendKeys("Hello World!");
Expand All @@ -111,7 +112,7 @@ public void SendKeys_Default_IsSupported()
public void Clear_Default_IsSupported()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("TextBox"));

element.Clear();
Expand All @@ -123,7 +124,7 @@ public void Clear_Default_IsSupported()
public void Click_Default_IsSupported()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("InvokableButton"));

element.Click();
Expand All @@ -135,7 +136,7 @@ public void Click_Default_IsSupported()
public void GetElementRect_Default_IsSupported()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("EditableCombo"));

var location = element.Location;
Expand Down Expand Up @@ -164,7 +165,7 @@ public void GetElementRect_Default_IsSupported()
public void GetElementEnabled_Enabled_ReturnsTrue(string elementAccessibilityId)
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId(elementAccessibilityId));

var enabled = element.Enabled;
Expand All @@ -188,7 +189,7 @@ public void GetElementEnabled_Enabled_ReturnsTrue(string elementAccessibilityId)
public void GetElementEnabled_Disabled_ReturnsFalse(string elementAccessibilityId)
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
driver.FindElement(ExtendedBy.NonCssName("_Edit")).Click();
driver.FindElement(ExtendedBy.NonCssName("Disable Form")).Click();
var element = driver.FindElement(ExtendedBy.AccessibilityId(elementAccessibilityId));
Expand All @@ -202,7 +203,7 @@ public void GetElementEnabled_Disabled_ReturnsFalse(string elementAccessibilityI
public void ActiveElement_Default_IsSupported()
{
var driverOptions = FlaUIDriverOptions.TestApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);
var element = driver.FindElement(ExtendedBy.AccessibilityId("InvokableButton"));
element.Click();

Expand Down
8 changes: 4 additions & 4 deletions src/FlaUI.WebDriver.UITests/ExecuteTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using FlaUI.WebDriver.UITests.TestUtil;
using System.Collections.Generic;
using FlaUI.WebDriver.UITests.TestUtil;
using NUnit.Framework;
using OpenQA.Selenium.Remote;
using System.Collections.Generic;
using OpenQA.Selenium.Appium.Windows;

namespace FlaUI.WebDriver.UITests
{
Expand All @@ -12,7 +12,7 @@ public class ExecuteTests
public void ExecuteScript_PowerShellCommand_ReturnsResult()
{
var driverOptions = FlaUIDriverOptions.RootApp();
using var driver = new RemoteWebDriver(WebDriverFixture.WebDriverUrl, driverOptions);
using var driver = new WindowsDriver(WebDriverFixture.WebDriverUrl, driverOptions);

var executeScriptResult = driver.ExecuteScript("powerShell", new Dictionary<string,string> { ["command"] = "1+1" });

Expand Down
Loading
Loading