Support of Appium with C++ apps using Ruby will be deprecated in future releases.
You.i C++ includes a Gemfile and a Brewfile to install all necessary components to your machine. Prior to running either file, ensure you have the following tools installed:
brew bundle
)gem install bundler
)bundle install
)Download Appium Desktop from the Appium website.
Download Appium from the Appium website and enter the following command:
npm install -g appium
The brewfile installs the following dependencies:
Tool or Component | Role |
---|---|
carthage |
Required for Facebook’s WebDriverAgent used in appium-xcuitest-driver |
libimobiledevice |
Captures device logs |
ideviceinstaller |
Installs the target app on an iOS real device (for iOS 9 and earlier) |
ios-deploy |
Installs the target app on iOS real devices running on iOS 10 |
node |
The Appium server runs on top of the node.js server. |
The gemfile installs the following components:
Tool/component | Role |
---|---|
ruby |
Checks that you have the right Ruby version installed. |
rspec |
Provides behavioral-driven development for Ruby. Used in the execution of tests. |
appium_console |
Sends Appium commands interactively using the Appium Ruby Console (ARC) |
ipaddress |
Gem used by the getiOSIP app to read the iOS IP address of an iOS app |
toml |
Gem used by the yi_appium_caps_util utility to automatically update the caps in the appium.txt file |
yi_appium_caps_util |
Gem that automatically updates the caps in the appium.txt file |
The gemfile installs the following components:
Tool/component | Role |
---|---|
Appium |
Checks if the correct version of Appium is installed or not. |
babel-jest |
Checks if the correct version of babel-jest is installed or not. |
babel-preset-env |
Checks if the correct version of babel-preset-env is installed or not. |
babel-preset-react-native |
Checks if the correct version of babel-preset-react-native is installed or not. |
babel-register |
Checks if the correct version of babel-register is installed or not. |
chai |
Checks if the correct version of chai is installed or not. |
node-fetch |
Checks if the correct version of node-fetch is installed or not. |
react-test-renderer |
Checks if the correct version of react-test-renderer is installed or not. |
wdio-appium-service |
Checks if the correct version of wdio-appium-service is installed or not. |
wdio-mocha-framework |
Checks if the correct version of wdio-mocha-framework is installed or not. |
wdio-spec-reporter |
Checks if the correct version of wdio-spec-reporter is installed or not. |
webdriverio |
Checks if the correct version of webdriverio is installed or not. |
Do the following steps:
yarn appiumtest
Open another Terminal window and run the scripts by executing ./runTests.sh -a <appname>
If you haven’t created the appium.txt
file, you can create it now by entering:yi_appium_caps_util -c <platformName>
in the Terminal window.
You need to add the app path manually.
./runTests.sh -h
for more options.The wdio.conf.js
file holds all of the important information regarding your test session.
This is where all your capabilities are defined that configures the Appium server session.
You must create the wdio.conf.js
file and configure the capabilities as you require.
Store it in the same directory as all other Appium files.
You can create a wdio.conf.js
file for each of the supported target platform; for example, wdio.conf.ios.js
, wdio.conf.android.js
, and wdio.conf.tvos.js
.
For more information on capabilities, see Desired Capabilities.
Now that you have your environment set up, you must ensure that each application you want to test with Appium is able to communicate with the Appium server.
To enable an application for Appium use, open a socket for server communication.
Some large apps may initialize many different components upon start-up, which may cause the Appium server to time out before it finds the open socket.
You.i TV recommends that you add the socket code to the app’s OnInit
file early in the development cycle.
Do not ship your app with this socket code enabled.
Do the following steps:
{appname].cpp
file for the target app.
The following example is based on the VideoPlayer sample.Add a start method to the CYIWebDriver object:
#include <automation/YiWebDriverLocator.h>
bool VideoPlayerApp::UserInit()
{
CYIWebDriver *pWebDriver = CYIWebDriverLocator::GetWebDriver();
if (pWebDriver)
{
pWebDriver->Start();
}
// other (normal) application specific initialization code
}
As of You.i Platform 5.5, a new default port has been added for testing with Appium on PS4 devices, as well as the ability to configure custom ports if desired.
To configure a custom port, you need to define the port both in the You.i Platform and in the appium-youiengine-driver caps.
In the You.i Platform, use GetWebDriver(<customPort>)
and in Appium server, set youiEngineAppPort = "customPort"
.
The Appium CYIWebDriver
code is not included in the default C++ libraries linked to a You.i application.
This ensures that this code can be removed in production builds.
To link the Appium library to your application:
CMakeLists.txt
or TargetList.cmake
file in your application.In CMakeLists.txt
after the call to yi_add_executable
, or anywhere in TargetList.cmake
add:
find_package(YouiEngine
${YI_YOUI_ENGINE_VERSION}
COMPONENTS appium_server
HINTS ${YouiEngine_DIR}
REQUIRED
)
target_link_libraries(${YI_PROJECT_NAME}
PRIVATE youi::appium_server
)
Shared scripts can be found within your You.i Platform package: <package>/Test/appium
A complete list of supported commands is on the appium-youi-driver GitHub page.