Code review comment for lp:~senan/ubuntu-autopilot-tests/DiskUsageAnalyser

Revision history for this message
Dan Chapman  (dpniel) wrote :

Senan

so the test_window_title is still failing for me due to the locale issue with the spelling of analyser so i would just remove that and assert 'Disk Usage '.

Also when entering text you need explicitly make sure you get the text entry focus, by either clicking on it assert entry.is_focus = True and then type or you can use the focused_type context manager. e.g currenlty you have this

111 + self.create_toggle_button = self.app.select_single('GtkToggleButton',tooltip_text=u'Type a file name')
112 + self.pointing_device.move_to_object(self.create_toggle_button)
113 + self.pointing_device.click()
114 + self.keyboard.type(key_input)

Which once you have clicked the toggle button we do not actually know if the entry is now visable and has focus before typing. So after the clicking the toggle button you need to

1) assert entry.visible == True

2) either click on the entry and assert entry.is_focus == True before typing
or use the focused_type context manager (which i prefer) which looks something like

entry = self.app.select_single('GtkFileChooserEntry')
 with self.keyboard.focused_type(entry) as kb:
     kb.type(key_input)
     self.assertThat(entry.text, Equals(key_input)) (after typing assert it type correctly)
     kb.press_and_release('Enter')

3) test you have ended where you expected :-)

So anywhere in your tests you are entering text you need to do one of the above so we know the entry has focus if we can't get focus then we have a bug :-)

One last thing all boolean values your test that are using ints need to be changed for autopilot 1.4 i.e

self.assertThat(window.visible, Equals(1)) will become self.assertThat(window.visible, Equals(True)) and all 0 values become False. If you are on saucy install autopilot from the ppa:autopilot/ppa and you will get autopilot 1.4
We need to make our tests compliant with 1.4 as soon as possible.

THank you for iterating over these tests, your doing a great job and soon you will get into the swing of it, just hang in there :-)

Dan

« Back to merge proposal