Merge lp:~elopio/address-book-app/new-visual-contact-editor-autopilot into lp:~renatofilho/address-book-app/new-visual-contact-editor

Proposed by Leo Arias
Status: Merged
Merged at revision: 209
Proposed branch: lp:~elopio/address-book-app/new-visual-contact-editor-autopilot
Merge into: lp:~renatofilho/address-book-app/new-visual-contact-editor
Diff against target: 158 lines (+18/-43)
4 files modified
tests/autopilot/address_book_app/__init__.py (+0/-1)
tests/autopilot/address_book_app/pages/_contact_editor.py (+15/-38)
tests/autopilot/address_book_app/tests/__init__.py (+1/-2)
tests/autopilot/address_book_app/tests/test_edit_contact.py (+2/-2)
To merge this branch: bzr merge lp:~elopio/address-book-app/new-visual-contact-editor-autopilot
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho Pending
Review via email: mp+223460@code.launchpad.net

Commit message

Autopilot proposed changes.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/address_book_app/__init__.py'
2--- tests/autopilot/address_book_app/__init__.py 2014-06-17 00:20:22 +0000
3+++ tests/autopilot/address_book_app/__init__.py 2014-06-17 18:00:31 +0000
4@@ -65,7 +65,6 @@
5 pages.ContactEditor, objectName="contactEditorPage")
6 for p in contact_editor_pages:
7 if p.active:
8- p.set_main_window(self)
9 return p
10 raise dbus.StateNotFoundError('contactEditorPage not found')
11 return None
12
13=== modified file 'tests/autopilot/address_book_app/pages/_contact_editor.py'
14--- tests/autopilot/address_book_app/pages/_contact_editor.py 2014-06-17 00:20:22 +0000
15+++ tests/autopilot/address_book_app/pages/_contact_editor.py 2014-06-17 18:00:31 +0000
16@@ -59,28 +59,26 @@
17 'professionalDetails': 'Profissional Details'
18 }
19
20- def set_main_window(self, main_window):
21- self._main_window = main_window
22-
23- def add_detail(self, detail_name, main_window = None):
24+ @autopilot.logging.log_action(logger.info)
25+ def add_field(self, detail_name):
26 """Create a new field into the edit contact form.
27
28 :param detail_name: The detail field name
29
30 """
31
32- btn = self.select_single("Button", objectName="addNewFieldButton")
33- self._make_visible(btn)
34- self.pointing_device.click_object(btn)
35-
36- if not main_window:
37- main_window = self._main_window
38-
39- dlg = main_window.wait_select_single("Dialog", objectName="addFieldDialog")
40- new_field_btn = dlg.select_single("Button",
41+ add_field_button = self.select_single(
42+ 'Button', objectName='addNewFieldButton')
43+ add_field_button.swipe_into_view()
44+ self.pointing_device.click_object(add_field_button)
45+
46+ add_field_dialog = self.get_root_instance().wait_select_single(
47+ 'Dialog', objectName='addFieldDialog')
48+ new_field_button = add_field_dialog.select_single(
49+ 'Button',
50 objectName=self._DETAIL_ALIAS[detail_name])
51
52- self.pointing_device.click_object(new_field_btn)
53+ self.pointing_device.click_object(new_field_button)
54
55 @autopilot.logging.log_action(logger.info)
56 def fill_form(self, contact_information):
57@@ -143,20 +141,6 @@
58 ContactDetailGroupWithTypeEditor, objectName=object_name)
59 return editor.get_values(object_name)
60
61- def _get_keyboard(self):
62- return _get_text_field(self, 'first_name').keyboard
63-
64- def _make_visible(self, item):
65- keyboard = self._get_keyboard()
66-
67- while not item.activeFocus:
68- # XXX We should just swipe the text field into view.
69- # Update this once bug http://pad.lv/1286479 is implemented.
70- # --elopio - 2014-03-01
71- keyboard.press_and_release('Tab')
72- time.sleep(0.1)
73- self.wait_to_stop_moving()
74-
75 def wait_to_stop_moving(self):
76 flickable = self.select_single(
77 'QQuickFlickable', objectName='scrollArea')
78@@ -184,7 +168,7 @@
79 """Fill a contact detail group."""
80 for index, detail in enumerate(details):
81 if self.detailsCount <= index:
82- editor.add_detail(self.objectName)
83+ editor.add_field(self.objectName)
84 self._fill_detail(index, detail)
85
86 def _fill_detail(self, index, detail):
87@@ -224,15 +208,11 @@
88 self._select_type(detail)
89
90 def _select_type(self, detail):
91- # get keyboard
92- contact_editor = self.get_root_instance().select_single(
93- ContactEditor, objectName='contactEditorPage', active=True)
94- keyboard = contact_editor._get_keyboard()
95 type_index = detail.TYPES.index(detail.type)
96 value_selector = self.select_single('ValueSelector')
97
98 while(value_selector.currentIndex != type_index):
99- keyboard.press_and_release("Shift+Right")
100+ ubuntuuitoolkit.get_keyboard().press_and_release("Shift+Right")
101 time.sleep(0.1)
102
103 def _get_selected_type_index(self):
104@@ -260,10 +240,7 @@
105 self._make_field_visible_and_write(text_field, value)
106
107 def _make_field_visible_and_write(self, text_field, value):
108- contact_editor = self.get_root_instance().select_single(
109- ContactEditor, objectName='contactEditorPage', active=True)
110-
111- contact_editor._make_visible(text_field)
112+ text_field.swipe_into_view()
113 text_field.write(value)
114
115 def _fill_address(self, index, address):
116
117=== modified file 'tests/autopilot/address_book_app/tests/__init__.py'
118--- tests/autopilot/address_book_app/tests/__init__.py 2014-06-17 00:20:22 +0000
119+++ tests/autopilot/address_book_app/tests/__init__.py 2014-06-17 18:00:31 +0000
120@@ -143,7 +143,7 @@
121 self.pointing_device.click_object(clear_button)
122 self.assertThat(field.text, Eventually(Equals("")))
123
124- # FIXME: Remove this function use ContactEditor.add_detail
125+ # FIXME: Remove this function use ContactEditor.add_field
126 def create_new_detail(self, detailGroup):
127 detCount = detailGroup.detailsCount
128 add_button = detailGroup.select_single("Icon",
129@@ -162,7 +162,6 @@
130
131 # Edit contact
132 edit_page = view_page.go_to_edit_contact()
133- edit_page.set_main_window(self.main_window)
134 self.assertThat(edit_page.visible, Eventually(Equals(True)))
135
136 return edit_page
137
138=== modified file 'tests/autopilot/address_book_app/tests/test_edit_contact.py'
139--- tests/autopilot/address_book_app/tests/test_edit_contact.py 2014-06-17 00:20:22 +0000
140+++ tests/autopilot/address_book_app/tests/test_edit_contact.py 2014-06-17 18:00:31 +0000
141@@ -37,7 +37,7 @@
142 edit_page = self.edit_contact(0)
143
144 # Add a new phone
145- edit_page.add_detail("phones")
146+ edit_page.add_field('phones')
147
148 # fill phone number
149 phone_number_1 = self.app.main_window.select_single(
150@@ -102,7 +102,7 @@
151 def test_add_email(self):
152 self.add_contact("Fulano", "")
153 edit_page = self.edit_contact(0)
154- edit_page.add_detail("emails")
155+ edit_page.add_field("emails")
156
157 # fill email address
158 email_field = edit_page.select_single(

Subscribers

People subscribed via source and target branches