qapreload - Library for automated testing Aurora OS, Sailfish OS, Qt widgets and Qt QML application using Appium framework
Library implements common subset of commands to perform UI operations
Library must be injected into application. bridge is responsible for injecting while launching applications via Appium framework. For Aurora OS and Sailfish OS bridge is installed via rpm package and automatically listening for incoming communications from Appium driver on 8888 port. On other platforms you should build project and run bridge target manually.
- Build and run
appium-aurora
docker container
- Build and install
qapreload
rpm to device
-
Build and run
bridge
from this projectExtra: if you running Linux-based distro, need to manually copy built
libqapreloadhook.so
andlibqaengine.so
to libdir (usually/usr/lib
or/usr/lib64
), otherwise bridge won't be able to automatically inject library to applciation.
Note: your application and qapreload
should be built with same Qt versions
To initialize Appium driver use following example:
#!/usr/bin/env python3
from appium import webdriver
def get_driver(device = '192.168.1.248', app = '/usr/bin/aurora-test-example', auto_launch = True):
appium_socket = 'http://localhost:4723/wd/hub'
data = {
'platformName': 'Aurora',
'appPackage': app,
'deviceName': device,
'autoLaunch': auto_launch,
}
return webdriver.Remote(appium_socket, data)
driver = get_driver()
perform pulldown action on view. if view is not at beginning it will scroll to top, then pull down.
Usage:
driver.execute_script("app:pullDownTo", "some text label")
or
driver.execute_script("app:pullDownTo", index)
perform pushup action on view. if view is not at end it will scroll to end, then push up.
Usage:
driver.execute_script("app:pushUpTo", "some text label")
or
driver.execute_script("app:pushUpTo", index)
perform context menu click on item
Usage:
driver.execute_script("app:clickContextMenuItem", "ContextMenu_0x12345678", "some text label")
or
driver.execute_script("app:clickContextMenuItem", "ContextMenu_0x12345678", index)
"ContextMenu_0x12345678"
is element.id, you should find element before using this method
synchronously wait for page change
Usage:
driver.execute_script("app:waitForPageChange", 1000)
1000 - is timeout to wait for change or continue anyway
synchronously wait for element property value change
Usage:
driver.execute_script("app:waitForPropertyChange", "ContextMenu_0x12345678", "opened", true, 10000)
"ContextMenu_0x12345678"
is element.id, you should find element before using this method
You can use None as property value to wait for any property change, or exact value to watch for.
10000 - is timeout to wait for change or continue anyway
perform swipe action in selected direction
Usage:
driver.execute_script("app:swipe", "left")
Allowed directions are: left, right, up, down
perform peek action in selected direction
Usage:
driver.execute_script("app:peek", "left")
Allowed directions are: left, right, up, down
perform back navigation action on current page
Usage:
driver.execute_script("app:goBack")
perform back navigation action on current page
Usage:
driver.execute_script("app:goForward")
type code on KeyPad item. You can use #
for confirm action and *
for cancel action
Usage:
driver.execute_script("app:enterCode", "12345#")
perform press and hold touch action on choosen coordinates
Usage:
driver.execute_script("touch:pressAndHold", 20, 40)
perform mouse swipe touch action from one point to another
Usage:
driver.execute_script("touch:mouseSwipe", 20, 40, 60, 80)
perform mouse drag touch action from one point to another
Usage:
driver.execute_script("touch:mouseDrag", 20, 40, 60, 80)
perform scroll on view to some item
Usage:
driver.execute_script("app:scrollToItem", "ContextMenu_0x12345678")
"ContextMenu_0x12345678"
is element.id, you should find element before using this method
invoke meta method on element
Usage:
driver.execute_script("app:method", "MyItem_0x12345678", "myFunction", ["some", "args", 15])
"MyItem_0x12345678"
is element.id, you should find element before using this method
execute js code in element context
Usage:
driver.execute_script("app:js", "MyItem_0x12345678", "function() { return "hello!"; }"
"MyItem_0x12345678"
is element.id, you should find element before using this method
set attribute value in element
Usage:
driver.execute_script("app:setAttribute", "MyItem_0x12345678", "attribute_name", "value")
"MyItem_0x12345678"
is element.id, you should find element before using this method
Save a screenshot with the specified file name
Usage:
driver.execute_script("app:saveScreenshot", "test.png")
dump current page items tree
Usage:
driver.execute_script("app:dumpCurrentPage")
dump application items tree
Usage:
driver.execute_script("app:dumpTree")
executes script with root privileges. use with caution
Usage:
driver.execute_script("system:shell", "ls", ["-la", "/"])
List elements in view
Usage:
driver.execute_script("app:dumpInView", "MyItem_0x12345678")
"MyItem_0x12345678"
is element.id, you should find element before using this method
Returns center coordinates of element item in view
Usage:
driver.execute_script("app:posInView", "MyItem_0x12345678", "ElementName")
"MyItem_0x12345678"
is element.id, you should find element before using this method
Click center coordinates of element item in view
Usage:
driver.execute_script("app:clickInView", "MyItem_0x12345678", "ElementName")
"MyItem_0x12345678"
is element.id, you should find element before using this method
Scroll view to show element
Usage:
driver.execute_script("app:scrollInView", "MyItem_0x12345678", "ElementName")
"MyItem_0x12345678"
is element.id, you should find element before using this method
List all menu elements
Usage:
driver.execute_script("app:dumpInMenu")
Trigger menu item
Usage:
driver.execute_script("app:triggerInMenu", "MenuItemName")
List elements in ComboBox
Usage:
driver.execute_script("app:dumpInComboBox", "MyItem_0x12345678")
"MyItem_0x12345678"
is element.id, you should find element before using this method
Activates ComboBox element
Usage:
driver.execute_script("app:activateInComboBox", "MyItem_0x12345678", "ElementName")
or by index (starts from 0)
driver.execute_script("app:activateInComboBox", "MyItem_0x12345678", 1)
"MyItem_0x12345678"
is element.id, you should find element before using this method
List elements in TabBar
Usage:
driver.execute_script("app:dumpInTabBar", "MyItem_0x12345678")
"MyItem_0x12345678"
is element.id, you should find element before using this method
Returns center coordinates of element item in TabBar
Usage:
driver.execute_script("app:posInTabBar", "MyItem_0x12345678", "ElementName")
or by index (starts from 0)
driver.execute_script("app:posInTabBar", "MyItem_0x12345678", 1
"MyItem_0x12345678"
is element.id, you should find element before using this method
Activates TabBar element
Usage:
driver.execute_script("app:activateInTabBar", "MyItem_0x12345678", "ElementName")
or by index (starts from 0)
driver.execute_script("app:activateInTabBar", "MyItem_0x12345678", 1)
"MyItem_0x12345678"
is element.id, you should find element before using this method