summaryrefslogtreecommitdiff
path: root/tests/autopilot
diff options
authorThomi Richards <thomi.richards@canonical.com>2012-07-13 08:30:50 +1200
committerThomi Richards <thomi.richards@canonical.com>2012-07-13 08:30:50 +1200
commit295f0aa9fe00bea93d83c53911a2c464864b63aa (patch)
treea1e4008ddb86a2e511770750a95f296fd79c68f4 /tests/autopilot
parent028c286c6220f32d3df29cefb3559a55835e803e (diff)
parent4dd1038dfbae9753749dbbe824d29cdd8e922f6b (diff)
Merged branch that fixes regressions.
(bzr r2478.1.9)
Diffstat (limited to 'tests/autopilot')
-rw-r--r--tests/autopilot/unity/emulators/hud.py1
-rw-r--r--tests/autopilot/unity/tests/launcher/test_icon_behavior.py2
-rw-r--r--tests/autopilot/unity/tests/test_hud.py4
-rw-r--r--tests/autopilot/unity/tests/test_panel.py22
-rw-r--r--tests/autopilot/unity/tests/test_showdesktop.py9
5 files changed, 20 insertions, 18 deletions
diff --git a/tests/autopilot/unity/emulators/hud.py b/tests/autopilot/unity/emulators/hud.py
index 72e3a4872..500a607a8 100644
--- a/tests/autopilot/unity/emulators/hud.py
+++ b/tests/autopilot/unity/emulators/hud.py
@@ -36,6 +36,7 @@ class Hud(KeybindingsHelper):
# need this to clear the search string, and then another to
# close the hud.
self.keyboard.press_and_release("Escape")
+ self.search_string.wait_for("")
self.keyboard.press_and_release("Escape")
self.visible.wait_for(False)
diff --git a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
index f214b3a08..82947f83c 100644
--- a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
+++ b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
@@ -146,7 +146,7 @@ class LauncherDragIconsBehavior(LauncherTestCase):
# the old fashioned way.
refresh_fn = lambda: self.launcher.model.get_children_by_type(
BamfLauncherIcon, desktop_id="gcalctool.desktop")
- self.assertThat(refresh_fn, Eventually(Equals(None)))
+ self.assertThat(refresh_fn, Eventually(Equals([])))
def test_can_drag_icon_below_bfb(self):
"""Application icons must be draggable to below the BFB."""
diff --git a/tests/autopilot/unity/tests/test_hud.py b/tests/autopilot/unity/tests/test_hud.py
index 9411184a0..859b018a0 100644
--- a/tests/autopilot/unity/tests/test_hud.py
+++ b/tests/autopilot/unity/tests/test_hud.py
@@ -358,9 +358,9 @@ class HudLockedLauncherInteractionsTests(HudTestsBase):
for icon in self.launcher.model.get_launcher_icons_for_monitor(self.hud_monitor):
if isinstance(icon, HudLauncherIcon):
- self.assertFalse(icon.desaturated)
+ self.assertThat(icon.desaturated, Eventually(Equals(False)))
else:
- self.assertTrue(icon.desaturated)
+ self.assertThat(icon.desaturated, Eventually(Equals(True)))
def test_hud_launcher_icon_click_hides_hud(self):
"""Clicking the Hud Icon should hide the HUD"""
diff --git a/tests/autopilot/unity/tests/test_panel.py b/tests/autopilot/unity/tests/test_panel.py
index af25c808a..d98580909 100644
--- a/tests/autopilot/unity/tests/test_panel.py
+++ b/tests/autopilot/unity/tests/test_panel.py
@@ -54,9 +54,8 @@ class PanelTestsBase(UnityTestCase):
"""
self.close_all_app(app_name)
- app = self.start_app(app_name, locale="C")
-
- [app_win] = app.get_windows()
+ app_win = self.start_app_window(app_name, locale="C")
+ app = app_win.application
app_win.set_focus()
self.assertTrue(app.is_active)
@@ -880,10 +879,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)))
@@ -892,8 +898,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:
@@ -906,8 +911,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:
diff --git a/tests/autopilot/unity/tests/test_showdesktop.py b/tests/autopilot/unity/tests/test_showdesktop.py
index e2f87faed..6efc9d972 100644
--- a/tests/autopilot/unity/tests/test_showdesktop.py
+++ b/tests/autopilot/unity/tests/test_showdesktop.py
@@ -8,11 +8,8 @@
from __future__ import absolute_import
-from autopilot.matchers import Eventually
-from testtools.matchers import NotEquals
from time import sleep
-from unity.emulators.icons import DesktopLauncherIcon
from unity.tests import UnityTestCase
@@ -65,13 +62,13 @@ class ShowDesktopTests(UnityTestCase):
def test_unhide_single_app(self):
"""Un-hide a single app from launcher after hiding all apps."""
- test_windows = self.launch_test_apps()
+ charmap, calc = self.launch_test_apps()
# show desktop, verify all windows are hidden:
self.window_manager.enter_show_desktop()
self.addCleanup(self.window_manager.leave_show_desktop)
- for win in test_windows:
+ for win in (charmap, calc):
self.assertProperty(win, is_valid=True)
self.assertProperty(win, is_hidden=True)
@@ -88,7 +85,7 @@ class ShowDesktopTests(UnityTestCase):
# hide desktop - now all windows should be visible:
self.window_manager.leave_show_desktop()
- for win in test_windows:
+ for win in (charmap, calc):
self.assertProperty(win, is_hidden=False)
def test_showdesktop_switcher(self):