Back to index

unity  6.0.0
test_home_lens.py
Go to the documentation of this file.
00001 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
00002 # Copyright 2012 Canonical
00003 # Author: Michal Hruby
00004 #
00005 # This program is free software: you can redistribute it and/or modify it
00006 # under the terms of the GNU General Public License version 3, as published
00007 # by the Free Software Foundation.
00008 
00009 from __future__ import absolute_import
00010 
00011 from autopilot.matchers import Eventually
00012 from testtools.matchers import Equals
00013 from time import sleep
00014 
00015 from unity.tests import UnityTestCase
00016 
00017 
00018 class HomeLensSearchTests(UnityTestCase):
00019     """Test the command lense search bahavior."""
00020 
00021     def setUp(self):
00022         super(HomeLensSearchTests, self).setUp()
00023 
00024     def tearDown(self):
00025         self.dash.ensure_hidden()
00026         super(HomeLensSearchTests, self).tearDown()
00027 
00028     def test_quick_run_app(self):
00029         """Hitting enter runs an application even though a search might not have fully finished yet."""
00030         if self.app_is_running("Text Editor"):
00031             self.close_all_app("Text Editor")
00032             sleep(1)
00033 
00034         kb = self.keyboard
00035         self.dash.ensure_visible()
00036         kb.type("g")
00037         self.assertThat(self.dash.search_string, Eventually(Equals("g")))
00038         kb.type("edit", 0.1)
00039         kb.press_and_release("Enter", 0.1)
00040         self.addCleanup(self.close_all_app,  "Text Editor")
00041         app_found = self.bamf.wait_until_application_is_running("gedit.desktop", 5)
00042         self.assertTrue(app_found)