Test fails, using example from tutorial section "QML"
Closed this issue · 7 comments
Hello
I have read your manual, and tried to using it for run examples in section "QML" , but got exception:
nosetests --with-funq
funq is initialized on port 9999 .
ERROR: test1.py:TestOne.test_click_rectangle_change_color
Traceback (most recent call last):
File "/home/test/Downloads/funqts/qmltest/test1.py", line 8, in test_click_rectangle_change_color
quick_view = self.funq.active_widget()
File "/home/test/.local/lib/python3.6/site-packages/funq/client.py", line 244, in active_widget
wait_for(get_widget, timeout, timeout_interval)
File "/home/test/.local/lib/python3.6/site-packages/funq/tools.py", line 74, in wait_for
raise res
File "/home/test/.local/lib/python3.6/site-packages/funq/client.py", line 238, in get_widget
wdata[0] = self.send_command('active_widget', type=widget_type)
File "/home/test/.local/lib/python3.6/site-packages/funq/client.py", line 154, in send_command
raise FunqError(response["errName"], response["errDesc"])
funq.errors.FunqError: NoActiveWindow: There is no active widget (window)
-------------------- >> begin captured logging << --------------------
funq.client: INFO: The tested application will be launched in the directory '/home/test/Downloads/funqts/qmltest/.' with the command ['/home/test/.local/bin/funq', '/usr/bin/qmlscene', 'test.qml']
funq.client: INFO: Launching tested application [2186].
funq.client: INFO: Closing tested application [2186].
--------------------- >> end captured logging << ---------------------
Ran 1 test in 11.362s
FAILED (errors=1)
I using Ubuntu 18.04 and fedora 29, Python3, qt5 , pip show that libs (funq, funq-server) was installed successfully, tests from first section "player_tester" passed, qmlscene I think work properly.
My folder contains:
test@test-VirtualBox:~/Downloads/funqts/qmltest$ ls
funq.conf pycache test1.py test.qml test.qmlc
If need more information I will provide
funq.errors.FunqError: NoActiveWindow: There is no active widget (window)
Try to keep the window active when running your tests, or change it instead of active_widget
method use the method item
, passing the class path as argument.
Hello,
sorry but I dont catch what you mean sir.
I have "test.qml"
`import QtQuick 2.0
Item {
width: 600
height: 600
visible: true
Rectangle {
id: rectangle
color: "#272822"
width: 600
height: 600
MouseArea {
anchors.fill: parent
onClicked: rectangle.color = "#FFFFFF"
}
}
}file "func.conf"
[applitest]
executable = /usr/bin/qmlscene
cwd = .
args = test.qml
and python file "test1.py"
from funq.testcase import FunqTestCase
class TestOne(FunqTestCase):
# identify the configuration
app_config_name = 'applitest'
def test_click_rectangle_change_color(self):
quick_view = self.funq.active_widget()
rect = quick_view.item(id="rectangle")
self.assertEqual(rect.properties()["color"], "#272822")
# click on the item
rect.click()
# color has changed
self.assertEqual(rect.properties()["color"], "#ffffff")`
this codes are all from manual
I run test like : "nosetests --with-funq test1.py"
What should I change ?
What I should done to make window active ?
I have funq version 1.1.4
Anytime you minimize or put the window in the background, the window stop being active.
Sorry, but I don't touch or minimize window
Maybe this behaviour depends on version?
I used pip install funq-server (install v 1.1.4 ) , but not latest version 1.1.5
if I type
from funq.models import QuickWindow, QuickItem
does not find such modules
I changed my funq version on 1.1.5 , and your example work fine.
@parkouss Can you upload the 1.1.5 version to pypi? I have tried but I do not have permission :/