diff options
| author | Thomi Richards <thomi.richards@canonical.com> | 2012-07-12 14:48:38 +1200 |
|---|---|---|
| committer | Thomi Richards <thomi.richards@canonical.com> | 2012-07-12 14:48:38 +1200 |
| commit | 3b1164a5676dc4d8948cd8e8527992aea85d403b (patch) | |
| tree | b7f5ae54f248162c41ff5d435e71e8568d812867 /tests/autopilot | |
| parent | facebb907c9ae48a0be3be2baa10ad6b894b5f3e (diff) | |
Made the panel menu entry tests more reliable.
(bzr r2496.1.1)
Diffstat (limited to 'tests/autopilot')
| -rw-r--r-- | tests/autopilot/unity/tests/test_panel.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/autopilot/unity/tests/test_panel.py b/tests/autopilot/unity/tests/test_panel.py index abbb77641..460f1c292 100644 --- a/tests/autopilot/unity/tests/test_panel.py +++ b/tests/autopilot/unity/tests/test_panel.py @@ -906,10 +906,17 @@ class PanelIndicatorEntryTests(PanelTestsBase): scenarios = _make_monitor_scenarios() - def test_menu_opens_on_click(self): - """Tests that clicking on a menu entry, opens a menu.""" + def open_app_and_get_menu_entry(self): + """Open the test app and wait for the menu entry to appear.""" self.open_new_application_window("Calculator") + refresh_fn = lambda: len(self.panel.menus.get_entries()) + self.assertThat(refresh_fn, Eventually(GreaterThan(0))) menu_entry = self.panel.menus.get_entries()[0] + return menu_entry + + def test_menu_opens_on_click(self): + """Tests that clicking on a menu entry, opens a menu.""" + menu_entry = self.open_app_and_get_menu_entry() self.mouse_open_indicator(menu_entry) self.assertThat(menu_entry.active, Eventually(Equals(True))) @@ -918,8 +925,7 @@ class PanelIndicatorEntryTests(PanelTestsBase): def test_menu_opens_closes_on_click(self): """Clicking on an open menu entru must close it again.""" - self.open_new_application_window("Calculator") - menu_entry = self.panel.menus.get_entries()[0] + menu_entry = self.open_app_and_get_menu_entry() self.mouse_open_indicator(menu_entry) # This assert is for timing purposes only: @@ -932,8 +938,7 @@ class PanelIndicatorEntryTests(PanelTestsBase): def test_menu_closes_on_click_outside(self): """Clicking outside an open menu must close it.""" - self.open_new_application_window("Calculator") - menu_entry = self.panel.menus.get_entries()[0] + menu_entry = self.open_app_and_get_menu_entry() self.mouse_open_indicator(menu_entry) # This assert is for timing purposes only: |
