Code Monkey home page Code Monkey logo

tizen.appium's Introduction

Tizen.Appium NuGet NuGet

Tizen.Appium is a service library that supports running Appium for Tizen .NET applications. It can simulate user interactions on Tizen .NET applications (ElmSharp,NUI) and also cross platform Xamarin.Forms application. As its name implies, it works based on the Appium that is an open source test automation framework.

Getting Started with Tizen.Appium

Tizen.Appium allows developers to write automated UI tests for Tizen .NET.

Prepare Your Test Environment

This link show how to setup the Appium.

Adding Tizen.Appium support to Tizen .NET apps

To automated your Tizen .NET applications, add Tizen.Appium as a pacakage referernce to your application project.

<PackageReference Include="Tizen.Appium" Version="1.0.0-preview2" />

ElmSharp and NUI applications require a Tizen.NET package version 6.0 or higher.

Xamarin.Forms application requires a Tizen.NET 4.0.0.

Initializing the Tizen.Appium

Add the following code to initialize Tizen.Appium.

ElmSharp Application

using Tizen.Appium;

class App : CoreUIApplication
{
    protected override void OnCreate()
    {
        base.OnCreate();
#if UITEST
        TizenAppium.StartService(AppType.ElmSharp);
#endif
        //...
     }
     //...
}

NUI Application

using Tizen.Appium;

class Program : NUIApplication
{
    protected override void OnCreate()
    {
        base.OnCreate();
#if UITEST
        TizenAppium.StartService(AppType.NUI);
#endif
        //...
    }
    //...
}

Xamarin.Forms Application

using Tizen.Appium;

class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
{
    protected override void OnCreate()
    {
        base.OnCreate();
#if UITEST
        TizenAppium.StartService();
#endif
        LoadApplication(new App());
        //...
    }
    //...
}

Set AutomationId in Test Application

Tizen.Appium automates the user interface by activating controls on the screen and performing input. To do this, you should assign a unique identifier to each controls.

Note that an exception will be thrown if an attempt is made to set the AutomationId property more than once.

ElmSharp Application

In ElmSharp, the recommended way to set this identifier is by using AutomationId property as shown below.

var button = new Button(window)
{
    Text = "button",
    AutomationId = "button"
};

NUI Application

The true is same on NUI application.

PushButton button = new PushButton
{
    LabelText = "Button",
    AutomationId = "button"
}

Xamarin.Forms Application

The true is same on Xamarin.Forms application.

Button button = new Button
{
    Text = "Button",
    AutomationId = "button"
}

Writing Your Test Script

Visual Studio has a template to help add a Tizen .NET UI Test projenct to an existing your application solution:

Upcoming Visual Studio Tools for Tizen will support this template. Until then, you can manually create and use the UI test project.

  1. Right click on the solution, and select File > New Project

  2. From the Tizen Templates, select the UI Test App template

How to manually create a UI Test project

  1. Create a test project in Visual Studio
    Select Visual C# -> Test -> Nunit Test Project

    If you know use to other test project, you can use it.

    image

  2. Add Appium.WebDriver as a package reference to your project (*.csporj)

Tizen driver is supported from Appium.WebDriver 4.0.0.2-beta. Therefore, we recommend that you use the version or later.

  1. Add the following code to initialize the TizenDriver and set the AppiumOptions
public class UITest
{
    TizenDriver<TizenElement> _driver;

    [SetUp]
    public void Setup()
    {
        AppiumOptions appiumOptions = new AppiumOptions();

        appiumOptions.AddAdditionalCapability("platformName", "Tizen");
        appiumOptions.AddAdditionalCapability("deviceName", "emulator-26101");

        //Xamarin.Forms
        appiumOptions.AddAdditionalCapability("appPackage", "org.tizen.example.FormsApp.Tizen.Mobile");

        //ElmSharp
        //appiumOptions.AddAdditionalCapability("appPackage", "org.tizen.example.ElmSharpApp");

        //NUI
        //appiumOptions.AddAdditionalCapability("appPackage", "org.tizen.example.NUIApp");

        _driver = new TizenDriver<TizenElement>(new Uri("http://127.0.0.1:4723/wd/hub"), appiumOptions);
    }

    [Test]
    public void Test1()
    {
        _driver.FindElementByAccessibilityId("Button").Click();
    }
}

Write scripts with reference to Supported Commands

Make sure you set the appium server ip(ex:127.0.0.1:4723) and port number. You should set same server port number. (appium default port number is '4723')

If you want to find a device name, use 'sdb devices' command. You can find device list and the name.

  1. Install Nunit3 Test Adapter
    Go to Tools -> Extesion and Updates -> Select Online -> Search 'Nunit 3 Test Adapter' image

  2. Open Test Explorer
    Go to Test -> Windows -> Test Explorer
    image

Running UI Automation Test

Right-click on your test, and select ‘Run Test’.
image

If the test is successful.
image

If the test is fails, you can determine the cause.
image

Current Support

Wearable

  • 4.0 or later version of Wearable devices and Emulator.

Mobile

  • 4.0 or later version of Emulator.

TV

  • Not Supported due to security policy at the moment.

tizen.appium's People

Contributors

flyofsky avatar jkpu avatar rookiejava avatar shyunmin avatar somang-park avatar sung-su avatar yourina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tizen.appium's Issues

There is no way to access toolbar items

  • Requirement
    User wants to tap ToolbarItem elements for testing.

  • Issue
    User can't access toolbar items. Because Tizen.Appium can't get any information of Elements which have no renderer.

  • Releted TC
    ToolbarItemTests

There is no way to access the element of the popup window

  • Requirement
    User wants to tap Element of the popup window for testing.

  • Issue
    User can't access Elements of a popup. Because Tizen.Appium can't get any information of Elements which have no renderer.

  • Releted TC
    ActionSheetUITests

Automation Feasibility to Samsung TV

Team,

Any update on how to Automate Samsung TV, which has Tizen OS ? If then can u please give us the direction to do that by means of any possible open source like Appium, Selenium.

Elements should removed when it hides

  • As-Is

    • Element is added when ViewInitialized event occurs.
    • Element is removed when it's renderer removed
  • What's the problem?

    • Suppose that there is a navigation page and it has 2 or more pages. All elements which are included in each page accumulated continuously once Navigation.PushAsync().

Issues with Tizen 6.5 profile

We are trying this package with the Tizen 6.5 profile.

  1. Create a NUI dotnet tizen-6.5 app.
  2. Added the Tizen.Appium nuget package
  3. Added the following code in OnCreate()
    TizenAppium.StartService(AppType.NUI);
  4. Run the app on 6.5 emulator.

Getting the following exception.

Exception has occurred: CLR/System.NotSupportedException
An unhandled exception of type 'System.NotSupportedException' occurred in Tizen.Appium.dll: 'Use StartService(IAppAdapter adapter) instead on tizen40 TFM.'
at Tizen.Appium.TizenAppium.StartService(AppType type)
at nuiapp65.Program.OnCreate() in /home/aswani/tes-appium/nuiapp65/nuiapp65/nuiapp65.cs:line 13
at Tizen.NUI.NUICoreBackend.OnInitialized(Object source, NUIApplicationInitEventArgs e)
at Tizen.NUI.Application.OnApplicationInit(IntPtr data)
at Tizen.NUI.Application.MainLoop()
at Tizen.NUI.NUICoreBackend.Run(String[] args)
at Tizen.Applications.CoreApplication.Run(String[] args)
at Tizen.NUI.NUIApplication.Run(String[] args)
at nuiapp65.Program.Main(String[] args) in /home/aswani/tes-appium/nuiapp65/nuiapp65/nuiapp65.cs:line 48

Following is the csproj file
<Project Sdk="Tizen.NET.Sdk/1.1.7"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>tizen90</TargetFramework> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>None</DebugType> </PropertyGroup> <ItemGroup> <Folder Include="lib\"/> <Folder Include="res\"/> </ItemGroup> <ItemGroup> <PackageReference Include="Tizen.Appium" Version="1.0.0-preview3"/> </ItemGroup> </Project>

Getting currently focused element is not supported

  • Requirement
    Getting currently focused element to support Xamarin.UITest.IApp.EnterText method.
    (https://developer.xamarin.com/api/member/Xamarin.UITest.IApp.EnterText/p/System.String/)

  • Expected behavior
    If the ContentPage has an Entry, the Entry will be returned as a currently focused element after the page is appeared.

  • Related TC
    EntryUITests.Completed

  • Issue
    There is a difference between expected behavior and Tizen platform behavior.
    In Tizen platform, Entry doesn't have a focus until it is clicked.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.