qtwebdriver
qtwebdriver copied to clipboard
Wait for qml animations
I am evaluating qtwebdriver for use with our qml project, and I have built it and gotten simple test cases to work. I am using python selenium at the moment.
However we have some transition animations and I have not found how to properly wait for them (except an ugly and not optimal time.sleep() ). I have tried the existing wait conditions such as visibiliy_of_element_located and element_to_be_clickable but they both trigger before the animation is done.
Do I need some custom wait condition to handle this, or is there some other known way to deal with this? Or possibly some known limitations or issues? Any pointer would be helpful.
Maybe trying with selenium JS injection, and some qml features of QtWebdriver
1-From selenium you can locate a qml element by id see https://github.com/cisco-open-source/qtwebdriver/wiki/QML-Specifics if you define "objectName" of element to locate
2-Use 1) to locate your qml animation
3-Then use Selenium javascript inject to interact with qml element, e.g: query get animation "running" status
isRunning = webdriver.execute_script("var v = ObjectNameUtils.findChild('animationId'); return v.running;")
4-Refactor previous in a method in your selenium test, e.g
public void waitForAnim(String animID) {
// locate anim
// While (anim.running) sleep (1s)
}