Merge lp:~bzoltan/qtcreator-plugin-ubuntu/new_tests into lp:qtcreator-plugin-ubuntu

Proposed by Zoltan Balogh
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 226
Merged at revision: 216
Proposed branch: lp:~bzoltan/qtcreator-plugin-ubuntu/new_tests
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 301 lines (+155/-102)
2 files modified
share/qtcreator/ubuntu/scripts/local_wait_for_emulator (+6/-3)
tests/autopilot/qtcreator_plugin_ubuntu/tests/test_qtcreator_plugin_functionality.py (+149/-99)
To merge this branch: bzr merge lp:~bzoltan/qtcreator-plugin-ubuntu/new_tests
Reviewer Review Type Date Requested Status
Benjamin Zeller Approve
PS Jenkins bot continuous-integration Approve
I Ahmad Pending
Review via email: mp+226972@code.launchpad.net

Commit message

Add tests to check Ubuntu plugins and validate the simple qml app template

Description of the change

Add tests to check Ubuntu plugins and validate the simple qml app template

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
211. By Zoltan Balogh

Remove flaky tests and add click chroot creation test

212. By Zoltan Balogh

Corrected test naming

213. By Zoltan Balogh

password

214. By Zoltan Balogh

password

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
215. By Zoltan Balogh

Chroot creation added

216. By Zoltan Balogh

Chroot creation added

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
217. By Zoltan Balogh

Asserting the result of the chroot creation

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
218. By Zoltan Balogh

Emulator creation test added

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
219. By Zoltan Balogh

wait for the new button to be visible before clicking.

220. By Zoltan Balogh

code style

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
221. By Zoltan Balogh

wait for the new button to be visible before clicking.

222. By Zoltan Balogh

Emulator creation test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
223. By Zoltan Balogh

Emulator start test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
224. By Zoltan Balogh

Disable the setup wizard for the emualtors, so automatic emulator deployment can be tested

225. By Zoltan Balogh

set +e before phablet-config

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
226. By Zoltan Balogh

Fix typo and wait with adb device before the phablet-config

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Benjamin Zeller (zeller-benjamin) wrote :

Ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'share/qtcreator/ubuntu/scripts/local_wait_for_emulator'
2--- share/qtcreator/ubuntu/scripts/local_wait_for_emulator 2014-05-14 14:18:55 +0000
3+++ share/qtcreator/ubuntu/scripts/local_wait_for_emulator 2014-07-21 13:27:52 +0000
4@@ -21,20 +21,23 @@
5 EMULATOR_NAME=$1
6
7 # wait for the emulator process to come up
8-
9 until pid=$(${SCRIPTPATH}/local_emulator_pid ${EMULATOR_NAME});
10 do
11 sleep 0.1;
12 done;
13
14 # wait for the emulator to assign the port
15-
16 until port=$(netstat -anp 2>&1|grep tcp|grep ${pid}|head -1|awk '{print $4}'|sed -n 's/.*\:\([0-9]*$\)/\1/p'|egrep -v "^$")
17 do
18 sleep 0.1;
19 done;
20
21+# disable the setup wizard for the emulator, so it can boot straight to the shell
22+set +e
23+adb -s emulator-${port} wait-for-device
24+phablet-config -s emulator-${port} welcome-wizard --disable|grep -v "already disabled"
25+set -e
26+
27 # return the serial number the adb will use for that emulator
28-
29 echo "emulator-${port}"
30
31
32=== renamed directory 'tests/autopilot/qtcreator' => 'tests/autopilot/qtcreator_plugin_ubuntu'
33=== renamed file 'tests/autopilot/qtcreator/tests/test_simple_app_template.py' => 'tests/autopilot/qtcreator_plugin_ubuntu/tests/test_qtcreator_plugin_functionality.py'
34--- tests/autopilot/qtcreator/tests/test_simple_app_template.py 2014-05-16 11:43:27 +0000
35+++ tests/autopilot/qtcreator_plugin_ubuntu/tests/test_qtcreator_plugin_functionality.py 2014-07-21 13:27:52 +0000
36@@ -5,116 +5,166 @@
37 # under the terms of the GNU General Public License version 3, as published
38 # by the Free Software Foundation.
39
40-"""qtcreator autopilot tests."""
41+""" qtcreator-plugin-ubuntu autopilot tests."""
42
43-from qtcreator.tests import QtCreatorTestCase
44+from qtcreator_plugin_ubuntu.tests import QtCreatorTestCase
45
46 from autopilot.matchers import Eventually
47 from testtools.matchers import Equals
48 from autopilot.input import Keyboard
49 from time import sleep
50
51-class CMakeApplicationTest(QtCreatorTestCase):
52+#class CMakeApplicationTest(QtCreatorTestCase):
53+class QtCreatorPluginTestPlan(QtCreatorTestCase):
54
55 def setUp(self):
56- super(CMakeApplicationTest, self).setUp()
57- sleep(5)
58-
59- def create_new_local_cmake_project(self):
60- """Create a cmake project with Tabbed UI + QML plugin against local desktop kit"""
61- sleep(5)
62- kbd = Keyboard.create("X11")
63- kbd.press_and_release('Ctrl+N')
64- sleep(1)
65- kbd.press_and_release('Tab')
66- kbd.press_and_release('Down')
67- kbd.press_and_release('Down')
68- kbd.press_and_release('Down')
69- kbd.press_and_release('Down')
70- kbd.press_and_release('Enter')
71- kbd.press_and_release('Enter')
72- kbd.press_and_release('Enter')
73- kbd.press_and_release('Enter')
74- sleep(10)
75- kbd.press_and_release('Ctrl+r')
76- sleep(10)
77-
78- def create_new_simple_ui_project_and_deploy_on_device(self):
79- """Create a Simple UI QML app"""
80- sleep(5)
81- kbd = Keyboard.create("X11")
82- kbd.press_and_release('Ctrl+N')
83- sleep(1)
84- kbd.press_and_release('Tab')
85- kbd.press_and_release('Enter')
86- kbd.press_and_release('Enter')
87- kbd.press_and_release('Enter')
88- sleep(3)
89- kbd.press_and_release('Ctrl+F12')
90- sleep(20)
91-
92- def create_new_simple_ui_project_and_run_locally(self):
93- """Create a Simple UI QML app"""
94- sleep(5)
95- kbd = Keyboard.create("X11")
96- kbd.press_and_release('Ctrl+N')
97- self._get_main_window().wait_select_single('Core::Internal::NewDialog')
98- sleep(1)
99- kbd.press_and_release('Tab')
100- button = self._get_new_project_dialog().select_single('QPushButton', text='&Choose...' )
101- self.pointing_device.click_object(button)
102- next_button = self._get_new_project_wizard_dialog().select_single('QPushButton', text='&Next >')
103- self.pointing_device.click_object(next_button)
104- finish_button = self._get_new_project_wizard_dialog().select_single('QPushButton', text='&Finish')
105- self.pointing_device.click_object(finish_button)
106- sleep(3)
107- kbd.press_and_release('Ctrl+r')
108- sleep(20)
109-
110-
111- def create_new_chroot_cmake_project(self):
112- """Create a cmake project with Tabbed UI + QML plugin against click chroot kit"""
113- sleep(5)
114- kbd = Keyboard.create("X11")
115- kbd.press_and_release('Ctrl+N')
116- sleep(1)
117- kbd.press_and_release('Tab')
118- kbd.press_and_release('Down')
119- kbd.press_and_release('Down')
120- kbd.press_and_release('Down')
121- kbd.press_and_release('Down')
122- kbd.press_and_release('Enter')
123- kbd.press_and_release('Enter')
124- kbd.press_and_release('Tab')
125- kbd.press_and_release('Tab')
126- kbd.press_and_release('Space')
127- kbd.press_and_release('Tab')
128- kbd.press_and_release('Tab')
129- kbd.press_and_release('Tab')
130- kbd.press_and_release('Space')
131- kbd.press_and_release('Tab')
132- kbd.press_and_release('Enter')
133- kbd.press_and_release('Enter')
134- sleep(10)
135-# kbd.press_and_release('Ctrl+r')
136-# sleep(20)
137-
138- def test_options(self):
139- sleep(1)
140- kbd = Keyboard.create("X11")
141- kbd.press_and_release('Alt+t')
142- sleep(1)
143- kbd.press_and_release('o')
144+ super(QtCreatorPluginTestPlan, self).setUp()
145+
146+ def type_password(self):
147+ """ Hopefully soon obsolate function to enter the user's password to the pkexec's dialog """
148+ sleep(2)
149+ kbd = Keyboard.create("X11")
150+ kbd.type("here comes the password", delay=0.2)
151+ kbd.press_and_release('Enter')
152+
153+ def test_x86_emulator_start(self):
154+ """ Change to the Devices mode, select the TestX86Emulator and deploy it """
155+ kbd = Keyboard.create("X11")
156+ kbd.press_and_release('Ctrl+9')
157+ devices_quickview = self.ide.wait_select_single('QQuickView', source='file:///usr/share/qtcreator/ubuntu/devicespage/main.qml')
158+ devices_ubuntulistview = devices_quickview.wait_select_single('UbuntuListView', objectName = 'devicesList')
159+ while True:
160+ if(devices_ubuntulistview.visible): break;
161+ sleep(1)
162+ emulator_listitem = devices_ubuntulistview.wait_select_single('Standard', text = 'TestX86Emulator')
163+ self.pointing_device.click_object(emulator_listitem)
164+ # TODO: continue with capturing the started emulator en evaluate the status
165+
166+ def test_x86_emulator_creation(self):
167+ """ Change to the Devices mode and click on the add new emulator button """
168+ kbd = Keyboard.create("X11")
169+ kbd.press_and_release('Ctrl+9')
170+ devices_quickview = self.ide.wait_select_single('QQuickView', source='file:///usr/share/qtcreator/ubuntu/devicespage/main.qml')
171+ add_emulator_button = devices_quickview.select_single('Button', text='Add Emulator')
172+ add_emulator_button.visible.wait_for(True)
173+ """ The simple click_object() moves the pointer to the center of the button, but in some environment the responsive area of the button is smaller """
174+ self.pointing_device.move(add_emulator_button.globalRect.x + add_emulator_button.width - 1, add_emulator_button.globalRect.y + add_emulator_button.height - 1)
175+ self.pointing_device.click()
176+ config_emulator_dialog = devices_quickview.wait_select_single('Dialog', title='Create emulator')
177+ emulatorname_textfield = config_emulator_dialog.wait_select_single('TextField', placeholderText = 'Emulator name')
178+ self.pointing_device.click_object(emulatorname_textfield)
179+ kbd = Keyboard.create("X11")
180+ kbd.type("TestX86Emulator", delay=0.2)
181+ create_button = config_emulator_dialog.wait_select_single('Button', text = 'create')
182+ self.pointing_device.click_object(create_button)
183+ """ Enter the password to the pkexec's dialog """
184+ self.type_password()
185+
186+ """ Wait the emulator creation to finish """
187+ devices_ubuntulistview = devices_quickview.wait_select_single('UbuntuListView', objectName = 'devicesList')
188+ while True:
189+ if(devices_ubuntulistview.visible): break;
190+ sleep(1)
191+ print("The device is created")
192+ emulator_listitem = devices_ubuntulistview.wait_select_single('Standard', text = 'TestX86Emulator')
193+ sleep(2)
194+
195+ def test_x86_fw1410_click_chroot_creation(self):
196+ """ Open the Options dialog by triggering the right action """
197+ action = self.ide.wait_select_single('QAction', text = '&Options...')
198+ action.slots.trigger()
199 setting_dialog = self._get_main_window().wait_select_single('Core::Internal::SettingsDialog')
200- kbd.press_and_release('u')
201- new_target_button = setting_dialog.select_single('QPushButton', text='Create Click Target' )
202+
203+ """ Select the Ubuntu category and click on the Create Click Target button """
204+ ubuntu_modelindex = setting_dialog.wait_select_single('QModelIndex', text='Ubuntu')
205+ self.pointing_device.click_object(ubuntu_modelindex)
206+ new_target_button = setting_dialog.wait_select_single('QPushButton', text='Create Click Target' )
207 self.pointing_device.click_object(new_target_button)
208- sleep(2)
209+
210+ """ Select the i386 architecture and 14.10 framework in the dialog and push the OK button """
211+ new_chroot_dialog = self.ide.wait_select_single('Ubuntu::Internal::UbuntuCreateNewChrootDialog')
212+ arch_combobox = new_chroot_dialog.wait_select_single('QComboBox', objectName = 'comboBoxArch')
213+ self.pointing_device.click_object(arch_combobox)
214+ i386_modelindex = new_chroot_dialog.wait_select_single('QModelIndex', text='i386')
215+ self.pointing_device.click_object(i386_modelindex)
216+ series_combobox = new_chroot_dialog.wait_select_single('QComboBox', objectName = 'comboBoxSeries')
217+ self.pointing_device.click_object(series_combobox)
218+ fw1410_modelindex = new_chroot_dialog.wait_select_single('QModelIndex', text='Framework-14.10')
219+ self.pointing_device.click_object(fw1410_modelindex)
220+ button_box = new_chroot_dialog.wait_select_single('QDialogButtonBox', objectName = 'buttonBox')
221+ ok_pushbutton = button_box.wait_select_single('QPushButton', text='&OK')
222+ self.pointing_device.click_object(ok_pushbutton)
223+
224+ """ Enter the password to the pkexec's dialog """
225+ self.type_password()
226+
227+ """ Open the Click run dialog and wait for it finishes the job """
228+ click_dialog = self.ide.wait_select_single('Ubuntu::Internal::UbuntuClickDialog')
229+ dialog_button_box = click_dialog.wait_select_single('QDialogButtonBox', objectName = 'buttonBox')
230+ close_button = dialog_button_box.wait_select_single('QPushButton', text = '&Close')
231+ while True:
232+ if(close_button.enabled): break;
233+ sleep(1)
234+ output_plaintextedit = click_dialog.wait_select_single('QPlainTextEdit', objectName = 'output')
235+ self.assertFalse('Click exited with errors, please check the output' in output_plaintextedit.plainText)
236+ self.assertTrue('Click exited with no errors' in output_plaintextedit.plainText)
237+ self.pointing_device.click_object(close_button)
238+
239+ def test_create_app_with_simple_ui(self):
240+ """" Open the New File and Project dialog by triggering the right action """
241+ action = self.ide.wait_select_single('QAction', text = '&New File or Project...')
242+ action.slots.trigger()
243+ new_project_dialog = self._get_main_window().wait_select_single('Core::Internal::NewDialog')
244+
245+ """ Choose the App with Simple UI template in the Ubuntu category """
246+ ubuntu_modelindex = new_project_dialog.wait_select_single('QModelIndex', text=' Ubuntu')
247+ self.pointing_device.click_object(ubuntu_modelindex)
248+ app_with_simple_ui_modelindex = new_project_dialog.wait_select_single('QModelIndex', text='App with Simple UI')
249+ self.pointing_device.click_object(app_with_simple_ui_modelindex)
250+ choose_pushbutton = new_project_dialog.wait_select_single('QPushButton', text='Choose...')
251+ self.pointing_device.click_object(choose_pushbutton)
252+ application_wizard_dialog = self._get_main_window().wait_select_single('Ubuntu::Internal::UbuntuProjectApplicationWizardDialog')
253+
254+ """ Clear the default project name and enter the test name to the edit line and hit the Next->Next->Finish buttons """
255+ projectname_lineedit = application_wizard_dialog.wait_select_single('Utils::ProjectNameValidatingLineEdit')
256+ kbd = Keyboard.create("X11")
257+ kbd.press_and_release('Ctrl+A')
258+ kbd.press_and_release('Delete')
259+ with kbd.focused_type(projectname_lineedit) as kb:
260+ kb.type("appwithsimpleui")
261+ self.assertThat(projectname_lineedit.text, Equals("appwithsimpleui"))
262+ next_pushbutton = application_wizard_dialog.wait_select_single('QPushButton', text = '&Next >')
263+ self.pointing_device.click_object(next_pushbutton)
264+ next_pushbutton = application_wizard_dialog.wait_select_single('QPushButton', text = '&Next >')
265+ self.pointing_device.click_object(next_pushbutton)
266+ next_pushbutton = application_wizard_dialog.wait_select_single('QPushButton', text = '&Finish')
267+ self.pointing_device.click_object(next_pushbutton)
268+
269+ """ Change to the Publish mode and click on the Create package button"""
270+ kbd.press_and_release('Ctrl+6')
271+ fancy_tab_widget = self._get_main_window().wait_select_single('Core::Internal::FancyTabWidget')
272+ packaging_widget = fancy_tab_widget.wait_select_single('UbuntuPackagingWidget', objectName = 'UbuntuPackagingWidget')
273+ packaging_groupbox = packaging_widget.wait_select_single('QGroupBox', objectName = 'groupBoxPackaging')
274+ click_package_pushbutton = packaging_groupbox.wait_select_single('QPushButton', objectName = 'pushButtonClickPackage')
275+ self.pointing_device.click_object(click_package_pushbutton)
276+
277+ """ I do not know how to figure out when the click package check is done """
278+ sleep(10)
279+
280+ """ Check the error type if there was any error during the package creation """
281+ validation_groupbox = packaging_widget.wait_select_single('QGroupBox', objectName = 'groupBoxValidate')
282+ errorinfo_groupbox = validation_groupbox.wait_select_single('QGroupBox', objectName = 'groupBoxErrorInfo')
283+ errortype_label = errorinfo_groupbox.wait_select_single('QLabel', objectName = 'labelErrorType')
284+ self.assertThat(errortype_label.text, Equals(""))
285
286 def test_plugins(self):
287- sleep(1)
288- action = self.ide.wait_select_single(
289- 'QAction', text='About &Plugins...'
290- )
291+ """ Open the About Plugins dialog """
292+ action = self.ide.wait_select_single('QAction', text='About &Plugins...')
293 action.slots.trigger()
294- sleep(10)
295+
296+ """ Check for each Ubuntu specific plugin in the plugin tree """
297+ plugin_dialog = self._get_main_window().wait_select_single('Core::Internal::PluginDialog')
298+ ubuntu_treewidgetitem = plugin_dialog.wait_select_single('QTreeWidgetItem', text='Ubuntu')
299+ cmake_treewidgetitem = plugin_dialog.wait_select_single('QTreeWidgetItem', text='CMakeProjectManager')
300+ remotelinux_treewidgetitem = plugin_dialog.wait_select_single('QTreeWidgetItem', text='RemoteLinux')
301+ golang_treewidgetitem = plugin_dialog.wait_select_single('QTreeWidgetItem', text='GoLang')

Subscribers

People subscribed via source and target branches

to all changes: