First off this is a great start :-) Well Done. Its always the trickiest part learning what you can and can't do with autopilot.
So my first thoughts are (and keeping in mind the near release of autopilot 1.4),
1) the test window title failed on my box. Due to having a different locale where analyzer is actually analyser. So to make this work you would probably be better testing the title with something like Contains('Disk Usage'). Then we miss the strange locale issues.
Note that if you wanted the test to pass on any locale you could assertThat(title, NotEquals(None)) and then assertIsInstance(title, unicode). This will test that the title contains text (we don't know what the title text will be, but we can test the title is there and that its unicode.
2) the other 3 tests are very similar so you could probably break them up a little. My first point with this is you are finishing each test outside of the test function with the self.disk_usage_display_common() call. Ideally you should be finishing each test with asserts as the last lines inside your test function. This way you can see the intended end result of the test i.e "the treeviewmap and ringmap should display a 'x' directory/folder" try and do the setup type parts to get you to the point you need outside the test function and then come back once setup to test the thing you are actually testing
another thing when entering /home in the file chooser dialog you should use the provided function in the keyboard class 'focused_type' so for example once you have clicked the toggle button and the entry is visible you could use something like this
entry = self.app.select_single('GtkFileChooserEntry')
with self.keyboard.focused_type(entry) as kb:
kb.type('/home')
self.assertThat(entry.text, Equals('/home'))
kb.press_and_release('Enter')
First off this is a great start :-) Well Done. Its always the trickiest part learning what you can and can't do with autopilot.
So my first thoughts are (and keeping in mind the near release of autopilot 1.4),
1) the test window title failed on my box. Due to having a different locale where analyzer is actually analyser. So to make this work you would probably be better testing the title with something like Contains('Disk Usage'). Then we miss the strange locale issues.
Note that if you wanted the test to pass on any locale you could assertThat(title, NotEquals(None)) and then assertIsInstanc e(title, unicode). This will test that the title contains text (we don't know what the title text will be, but we can test the title is there and that its unicode.
2) the other 3 tests are very similar so you could probably break them up a little. My first point with this is you are finishing each test outside of the test function with the self.disk_ usage_display_ common( ) call. Ideally you should be finishing each test with asserts as the last lines inside your test function. This way you can see the intended end result of the test i.e "the treeviewmap and ringmap should display a 'x' directory/folder" try and do the setup type parts to get you to the point you need outside the test function and then come back once setup to test the thing you are actually testing
another thing when entering /home in the file chooser dialog you should use the provided function in the keyboard class 'focused_type' so for example once you have clicked the toggle button and the entry is visible you could use something like this
entry = self.app. select_ single( 'GtkFileChooser Entry') focused_ type(entry) as kb: type('/ home') assertThat( entry.text, Equals('/home')) press_and_ release( 'Enter' )
with self.keyboard.
kb.
self.
kb.
This will get the entries focus and type the text see http:// unity.ubuntu. com/autopilot/ api/input. html#autopilot. input.Keyboard. focused_ type
There is also some changes needed to be made for 1.4 if you check this link about boolean properties are now represented correctly and not 1/0. http:// unity.ubuntu. com/autopilot/ porting/ porting. html#gtk- tests-and- boolean- parameters
I'll leave it there for now and see how we fair once these changes are made.
Feel free to ping myself or balloons if your are getting stuck :-)