Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
[CirclePage] fix MoreOption launching time issue (#178)
Browse files Browse the repository at this point in the history
* [CirclePage] fix moreoption launching time issue

* change nuget version and fix wrong IP

* [UITest] change appium server URI
  • Loading branch information
jkpu authored Mar 29, 2019
1 parent 32aadf3 commit 014c0e9
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,16 @@ void OnRealized()

if (Element.ToolbarItems.Count > 0)
{
SetVisibleMoreOption(true);
foreach (var item in Element.ToolbarItems)
Device.BeginInvokeOnMainThread(() =>
{
AddToolbarItem(item);
}
SetVisibleMoreOption(true);

foreach (var item in Element.ToolbarItems)
{
AddToolbarItem(item);
}
});

}

SetNativeView(_box);
Expand Down
5 changes: 3 additions & 2 deletions test/Appium.CircularUI.Tests/Appium.CircularUI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.11.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
Expand All @@ -83,6 +83,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="TC\Radio.cs" />
<Compile Include="TC\Check.cs" />
<Compile Include="TC\Toast.cs" />
Expand Down
27 changes: 27 additions & 0 deletions test/Appium.CircularUI.Tests/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Appium
{
public static class Config
{
#region fields
public const string PLATFORM = "Tizen";
public const string APPIUM_SERVER_URI = "http://192.168.0.49:4723/wd/hub"; //Please insert your appium server address

public const string APP_PACKAGE_NAME = "org.tizen.example.WearableUIGallery.Tizen.Wearable";
public const string APP_NAME = "org.tizen.example.WearableUIGallery.Tizen.Wearable-1.0.0.tpk";
public const string DEVICE_NAME = "emulator-26111";

public const int SPEEDX_EMUL_40 = -45;
public const int SPEEDY_EMUL_40 = -35;
public const int SPEEDX_EMUL_50 = -100;
public const int SPEEDY_EMUL_50 = -100;
public const int SPEEDX_GALAXY_WATCH = -80;
public const int SPEEDY_GALAXY_WATCH = -60;
#endregion
}
}
19 changes: 5 additions & 14 deletions test/Appium.CircularUI.Tests/TestTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,9 @@ namespace Appium.UITests
public class TestTemplate
{
public UITestDriver Driver;
#if EMUL_40
public static int SpeedX = -45;
public static int SpeedY = -35;
#elif EMUL_55
public static int SpeedX = -100;
public static int SpeedY = -120;
#elif WATCH_DEVICE
//Galaxy Watch device
public static int SpeedX = -80;
public static int SpeedY = -60;
#else
public static int SpeedX = -40;
public static int SpeedY = -40;
#endif

public int SpeedX;
public int SpeedY;

[OneTimeSetUp]
public void Init()
Expand All @@ -30,6 +19,8 @@ public void Init()
public void TestSetUp()
{
Driver.FindTC(this.GetType().Name);
SpeedX = Driver.FlickSpeedX;
SpeedY = Driver.FlickSpeedY;
}

[TearDown]
Expand Down
32 changes: 20 additions & 12 deletions test/Appium.CircularUI.Tests/UITestDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ namespace Appium.UITests
public sealed class UITestDriver // to communicate appium
{
const int DelayTime = 1000;
const string Platform = "Tizen";

static UITestDriver _instance;
AppiumDriver<AppiumWebElement> _driver;
RemoteTouchScreen _touchScreen;
static bool createFolder;

public int FlickSpeedX{ get; private set; }
public int FlickSpeedY { get; private set; }

public static UITestDriver Instance
{
get
{
if (_instance == null)
{
_instance = new UITestDriver(Platform, "");
_instance = new UITestDriver(Config.PLATFORM, "");
}
return _instance;
}
Expand Down Expand Up @@ -63,13 +65,23 @@ void InitTizen(string platform, string profile)
{
AppiumOptions option = new AppiumOptions();

option.AddAdditionalCapability("platformName", platform);
option.AddAdditionalCapability("deviceName", "emulator-26111");
option.AddAdditionalCapability("appPackage", "org.tizen.example.WearableUIGallery.Tizen.Wearable");
option.AddAdditionalCapability("app", "org.tizen.example.WearableUIGallery.Tizen.Wearable-1.0.0.tpk");
_driver = new TizenDriver<AppiumWebElement>(new Uri("http://127.0.0.0:4723/wd/hub"), option); //please insert the IP of your Appium server.
option.AddAdditionalCapability("platformName", Config.PLATFORM);
option.AddAdditionalCapability("deviceName", Config.DEVICE_NAME);
option.AddAdditionalCapability("appPackage", Config.APP_PACKAGE_NAME);
option.AddAdditionalCapability("app", Config.APP_NAME);
_driver = new TizenDriver<AppiumWebElement>(new Uri(Config.APPIUM_SERVER_URI), option);
_touchScreen = new RemoteTouchScreen(_driver);
createFolder = false;
#if EMUL_40
FlickSpeedX = Config.SPEEDX_EMUL_40;
FlickSpeedY = Config.SPEEDY_EMUL_40;
#elif EMUL_50
FlickSpeedX = Config.SPEEDX_EMUL_50;
FlickSpeedY = Config.SPEEDY_EMUL_50;
#else
FlickSpeedX = Config.SPEEDX_GALAXY_WATCH;
FlickSpeedY = Config.SPEEDY_GALAXY_WATCH;
#endif
}

public void Quit()
Expand Down Expand Up @@ -106,11 +118,7 @@ public void FindTC(string testName)
ReadOnlyCollection<AppiumWebElement> resultByAccessibilityId = _driver.FindElementsByAccessibilityId(testName);
if (resultByAccessibilityId.Count == 0)
{
#if EMUL
Flick(0, isForward ? -35 : 35);
#else
Flick(0, isForward ? -40 : 40);
#endif
Flick(0, isForward ? FlickSpeedY : -FlickSpeedY);
flickCount++;

if (isForward == false && flickCount >= 20)
Expand Down
2 changes: 1 addition & 1 deletion test/Appium.CircularUI.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package id="Appium.WebDriver" version="4.0.0.2-beta" targetFramework="net452" />
<package id="Castle.Core" version="4.3.1" targetFramework="net452" />
<package id="DotNetSeleniumExtras.PageObjects" version="3.11.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net452" />
<package id="NUnit" version="3.11.0" targetFramework="net452" />
<package id="Selenium.Support" version="3.14.0" targetFramework="net452" />
<package id="Selenium.WebDriver" version="3.14.0" targetFramework="net452" />
Expand Down

0 comments on commit 014c0e9

Please sign in to comment.