Permalink
Browse files

Update to C# client 2.0.0.1

- Update to .NET framework v4.5
- update of dependencies
- code samples were updated
1 parent 2908a55 commit 87d6de9fc49a1ce982677820283e6b73d4e76d09 @TikhomirovSergey TikhomirovSergey committed Jul 26, 2016
Showing with 935 additions and 269 deletions.
  1. +2 −4 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidActivityTest.cs
  2. +58 −0 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidAppStringsTest.cs
  3. +28 −16 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidElementTest.cs
  4. +54 −0 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidEmulatorDeviceTime.cs
  5. +78 −0 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidKeyPressTest.cs
  6. +9 −25 ...code/examples/dotnet/AppiumDotNetSample/Android/{AndroidScrollTest.cs → AndroidLockDeviceTest.cs}
  7. +18 −1 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidSearchingTest.cs
  8. +61 −0 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidSessionTest.cs
  9. +0 −1 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidTouchActionTest.cs
  10. +2 −2 sample-code/examples/dotnet/AppiumDotNetSample/Android/AndroidWebviewTest.cs
  11. +98 −0 sample-code/examples/dotnet/AppiumDotNetSample/Android/FileInteractionTest.cs
  12. +56 −0 sample-code/examples/dotnet/AppiumDotNetSample/Android/IntentAndroidTest.cs
  13. +25 −14 sample-code/examples/dotnet/AppiumDotNetSample/AppiumDotNetSample.csproj
  14. +1 −1 sample-code/examples/dotnet/AppiumDotNetSample/PageObjectTests/IOS/IOSNativeAppAttributesTest.cs
  15. +1 −1 sample-code/examples/dotnet/AppiumDotNetSample/PageObjectTests/IOS/IOSTestThatChecksAttributeMix.cs
  16. +80 −45 sample-code/examples/dotnet/AppiumDotNetSample/Properties/Resources.Designer.cs
  17. +12 −10 sample-code/examples/dotnet/AppiumDotNetSample/Properties/Resources.resx
  18. BIN sample-code/examples/dotnet/AppiumDotNetSample/Resources/IntentExample.apk
  19. +134 −79 sample-code/examples/dotnet/AppiumDotNetSample/ServerTests/AppiumLocalServerLaunchingTest.cs
  20. +48 −20 sample-code/examples/dotnet/AppiumDotNetSample/ServerTests/StartingAppLocallyTest.cs
  21. +6 −3 sample-code/examples/dotnet/AppiumDotNetSample/helpers/AppiumServers.cs
  22. +4 −2 sample-code/examples/dotnet/AppiumDotNetSample/helpers/Apps.cs
  23. +12 −14 sample-code/examples/dotnet/AppiumDotNetSample/helpers/Caps.cs
  24. +1 −1 sample-code/examples/dotnet/AppiumDotNetSample/iOS/IOSLocationTest.cs
  25. +10 −4 sample-code/examples/dotnet/AppiumDotNetSample/iOS/{iOSScrollTest.cs → IOSScrollingSearchingTest.cs}
  26. +12 −12 sample-code/examples/dotnet/AppiumDotNetSample/iOS/IosGestureTest.cs
  27. +1 −1 sample-code/examples/dotnet/AppiumDotNetSample/iOS/IosOrientationTest.cs
  28. +3 −3 sample-code/examples/dotnet/AppiumDotNetSample/iOS/IosWebviewTest.cs
  29. +1 −1 sample-code/examples/dotnet/AppiumDotNetSample/iOS/iOSAlertTest.cs
  30. +60 −0 sample-code/examples/dotnet/AppiumDotNetSample/iOS/iOSAppStringsTest.cs
  31. +1 −1 sample-code/examples/dotnet/AppiumDotNetSample/iOS/iOSElementTest.cs
  32. +51 −0 sample-code/examples/dotnet/AppiumDotNetSample/iOS/iOSLockDeviceTest.cs
  33. +1 −1 sample-code/examples/dotnet/AppiumDotNetSample/iOS/iOSSearchingTest.cs
  34. +2 −2 sample-code/examples/dotnet/AppiumDotNetSample/iOS/iOSTouchActionTest.cs
  35. +5 −5 sample-code/examples/dotnet/AppiumDotNetSample/packages.config
@@ -4,8 +4,6 @@
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Remote;
using System;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
namespace Appium.Samples.Android
{
@@ -86,7 +84,7 @@ public void StartActivityInNewAppTestCase()
driver.StartActivity("com.android.contacts", ".ContactsListActivity");
Assert.AreEqual(driver.CurrentActivity, ".ContactsListActivity");
- driver.KeyEvent(AndroidKeyCode.Back);
+ driver.PressKeyCode(AndroidKeyCode.Back);
Assert.AreEqual(driver.CurrentActivity, ".ContactsListActivity");
}
@@ -100,7 +98,7 @@ public void StartActivityInNewAppTestCaseWithoutClosingApp()
driver.StartActivity("com.android.contacts", ".ContactsListActivity", "com.android.contacts", ".ContactsListActivity", false);
Assert.AreEqual(driver.CurrentActivity, ".ContactsListActivity");
- driver.KeyEvent(AndroidKeyCode.Back);
+ driver.PressKeyCode(AndroidKeyCode.Back);
Assert.AreEqual(driver.CurrentActivity, ".accessibility.AccessibilityNodeProviderActivity");
}
@@ -0,0 +1,58 @@
+using System;
+using OpenQA.Selenium.Appium;
+using OpenQA.Selenium;
+using NUnit.Framework;
+using OpenQA.Selenium.Remote;
+using OpenQA.Selenium.Appium.Android;
+using Appium.Samples.Helpers;
+
+namespace Appium.Samples.Android
+{
+ [TestFixture]
+ public class AndroidAppStringsTest
+ {
+ private AppiumDriver<IWebElement> driver;
+
+ [TestFixtureSetUp]
+ public void BeforeAll()
+ {
+ DesiredCapabilities capabilities = Env.isSauce() ?
+ Caps.getAndroid501Caps(Apps.get("androidApiDemos")) :
+ Caps.getAndroid19Caps(Apps.get("androidApiDemos"));
+ if (Env.isSauce())
+ {
+ capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
+ capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
+ capabilities.SetCapability("name", "android - complex");
+ capabilities.SetCapability("tags", new string[] { "sample" });
+ }
+ Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;
+ driver = new AndroidDriver<IWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
+ driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
+ }
+
+ [TestFixtureTearDown]
+ public void AfterAll()
+ {
+ if (driver != null)
+ {
+ driver.Quit();
+ }
+ if (!Env.isSauce())
+ {
+ AppiumServers.StopLocalService();
+ }
+ }
+
+ [Test]
+ public void GetAppStrings() {
+ Assert.AreNotSame(0, driver.GetAppStringDictionary ().Count);
+ }
+
+ [Test]
+ public void GetAppStringsUsingLang() {
+ Assert.AreNotSame(0, driver.GetAppStringDictionary ("en").Count);
+ }
+ }
+}
+
@@ -28,25 +28,12 @@ public void BeforeAll()
Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;
driver = new AndroidDriver<AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
- driver.CloseApp();
}
[SetUp]
public void SetUp()
{
- if (driver != null)
- {
- driver.LaunchApp();
- }
- }
-
- [TearDown]
- public void TearDowwn()
- {
- if (driver != null)
- {
- driver.CloseApp();
- }
+ driver.StartActivity("io.appium.android.apis", ".ApiDemos");
}
[Test()]
@@ -68,8 +55,8 @@ public void FindByAndroidUIAutomatorTest()
[Test]
public void ReplaceValueTest()
{
- String originalValue = "original value";
- String replacedValue = "replaced value";
+ string originalValue = "original value";
+ string replacedValue = "replaced value";
driver.StartActivity("io.appium.android.apis", ".view.Controls1");
@@ -84,6 +71,31 @@ public void ReplaceValueTest()
Assert.AreEqual(replacedValue, editElement.Text);
}
+ [Test]
+ public void SetImmediateValueTest()
+ {
+ string value = "new value";
+
+ driver.StartActivity("io.appium.android.apis", ".view.Controls1");
+
+ AndroidElement editElement = driver.FindElementByAndroidUIAutomator("resourceId(\"io.appium.android.apis:id/edit\")");
+
+ editElement.SetImmediateValue(value);
+
+ Assert.AreEqual(value, editElement.Text);
+ }
+
+ [Test]
+ public void ScrollingToSubElement()
+ {
+ driver.FindElementByAccessibilityId("Views").Click();
+ AndroidElement list = driver.FindElement(By.Id("android:id/list"));
+ var locator = new ByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView("
+ + "new UiSelector().text(\"Radio Group\"));");
+ AppiumWebElement radioGroup = list.FindElement(locator);
+ Assert.NotNull(radioGroup.Location);
+ }
+
[TestFixtureTearDown]
public void AfterAll()
{
@@ -0,0 +1,54 @@
+using Appium.Samples.Helpers;
+using NUnit.Framework;
+using OpenQA.Selenium.Appium;
+using OpenQA.Selenium.Appium.Android;
+using OpenQA.Selenium.Remote;
+using System;
+
+namespace Appium.Samples.Android
+{
+ class AndroidEmulatorDeviceTime
+ {
+ private AppiumDriver<AndroidElement> driver;
+
+ [SetUp]
+ public void BeforeAll()
+ {
+ DesiredCapabilities capabilities = Env.isSauce() ?
+ Caps.getAndroid501Caps(Apps.get("androidApiDemos")) :
+ Caps.getAndroid19Caps(Apps.get("androidApiDemos"));
+ if (Env.isSauce())
+ {
+ capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
+ capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
+ capabilities.SetCapability("name", "android - complex");
+ capabilities.SetCapability("tags", new string[] { "sample" });
+ }
+ Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;
+ driver = new AndroidDriver<AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
+ driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
+ }
+
+ [TearDown]
+ public void AfterEach()
+ {
+ if (driver != null)
+ {
+ driver.Quit();
+ }
+ if (!Env.isSauce())
+ {
+ AppiumServers.StopLocalService();
+ }
+ }
+
+ [Test()]
+ public void DeviceTimeTest()
+ {
+ string time = driver.DeviceTime;
+ Console.WriteLine(time);
+ Assert.AreEqual(true, time.Length == 28);
+ }
+
+ }
+}
@@ -0,0 +1,78 @@
+using Appium.Samples.Helpers;
+using NUnit.Framework;
+using OpenQA.Selenium.Appium.Android;
+using OpenQA.Selenium.Appium.Android.Enums;
+using OpenQA.Selenium.Remote;
+using System;
+
+namespace Appium.Samples.Android
+{
+ class AndroidKeyPressTest
+ {
+ private AndroidDriver<AndroidElement> driver;
+
+ [TestFixtureSetUp]
+ public void BeforeAll()
+ {
+ DesiredCapabilities capabilities = Env.isSauce() ?
+ Caps.getAndroid501Caps(Apps.get("androidApiDemos")) :
+ Caps.getAndroid19Caps(Apps.get("androidApiDemos"));
+ if (Env.isSauce())
+ {
+ capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
+ capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
+ capabilities.SetCapability("name", "android - simple");
+ capabilities.SetCapability("tags", new string[] { "sample" });
+ }
+ Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;
+ driver = new AndroidDriver<AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
+ driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
+ }
+
+ [SetUp]
+ public void SetUp()
+ {
+ if (driver != null)
+ {
+ driver.ResetApp();
+ }
+ }
+
+ [TestFixtureTearDown]
+ public void AfterAll()
+ {
+ if (driver != null)
+ {
+ driver.Quit();
+ }
+ if (!Env.isSauce())
+ {
+ AppiumServers.StopLocalService();
+ }
+ }
+
+ [Test]
+ public void PressKeyCodeTest()
+ {
+ driver.PressKeyCode(AndroidKeyCode.Home);
+ }
+
+ [Test]
+ public void PressKeyCodeWithMetastateTest()
+ {
+ driver.PressKeyCode(AndroidKeyCode.Space, AndroidKeyMetastate.Meta_Shift_On);
+ }
+
+ [Test]
+ public void LongPressKeyCodeTest()
+ {
+ driver.LongPressKeyCode(AndroidKeyCode.Home);
+ }
+
+ [Test]
+ public void LongPressKeyCodeWithMetastateTest()
+ {
+ driver.LongPressKeyCode(AndroidKeyCode.Space, AndroidKeyMetastate.Meta_Shift_On);
+ }
+ }
+}
@@ -1,17 +1,16 @@
using Appium.Samples.Helpers;
using NUnit.Framework;
-using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Remote;
using System;
namespace Appium.Samples.Android
{
- public class AndroidScrollTest
+ class AndroidLockDeviceTest
{
private AndroidDriver<AndroidElement> driver;
- [TestFixtureSetUp]
+ [SetUp]
public void BeforeAll()
{
DesiredCapabilities capabilities = Env.isSauce() ?
@@ -29,8 +28,8 @@ public void BeforeAll()
driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
}
- [TestFixtureTearDown]
- public void AfterAll()
+ [TearDown]
+ public void AfterEach()
{
if (driver != null)
{
@@ -43,27 +42,12 @@ public void AfterAll()
}
[Test()]
- public void ScrollToTestCase()
+ public void LockTest()
{
- Assert.NotNull(driver.ScrollTo("View"));
- }
-
- [Test()]
- public void ScrollToExactTestCase()
- {
- Assert.NotNull(driver.ScrollToExact("Views"));
- }
-
- [Test()]
- public void ScrollToUsingResourceIdTestCase()
- {
- Assert.NotNull(driver.ScrollTo("View", "android: id / list"));
- }
-
- [Test()]
- public void ScrollToExactUsingResourceIdTestCase()
- {
- Assert.NotNull(driver.ScrollToExact("Views", "android:id/list"));
+ driver.Lock();
+ Assert.AreEqual(true, driver.IsLocked());
+ driver.Unlock();
+ Assert.AreEqual(false, driver.IsLocked());
}
}
}
@@ -29,6 +29,12 @@ public class AndroidSearchingTest
driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
}
+ [SetUp]
+ public void SetUp()
+ {
+ driver.StartActivity("io.appium.android.apis", ".ApiDemos");
+ }
+
[TestFixtureTearDown]
public void AfterAll(){
if (driver != null)
@@ -64,6 +70,17 @@ public void FindByXPathTest()
Assert.IsNotNull(driver.FindElementByXPath(byXPath).Text);
Assert.AreEqual(driver.FindElementsByXPath(byXPath).Count, 1);
}
- }
+
+ [Test]
+ public void FindScrollable()
+ {
+ driver.FindElementByAccessibilityId("Views").Click();
+ AndroidElement radioGroup = driver
+ .FindElementByAndroidUIAutomator("new UiScrollable(new UiSelector()"
+ + ".resourceId(\"android:id/list\")).scrollIntoView("
+ + "new UiSelector().text(\"Radio Group\"));");
+ Assert.NotNull(radioGroup.Location);
+ }
+ }
}
Oops, something went wrong.

0 comments on commit 87d6de9

Please sign in to comment.