class SeachTest(UIATestBase):
    """
    @summary: Test google search application
    """
    def setUp(self):
        cfg_file = 'tests.tablet.google_fast.conf'
        super(SeachTest, self).setUp()
        self._test_name = __name__
        self.search = SearchImpl(\
            self.config.read(cfg_file, 'google_search'))
        self.browser = BrowserImpl(self.config.read(cfg_file, 'browser'))
        self.contacts = ContactsImpl(self.config.read(cfg_file, 'wifisetting'))
        print "[Setup]: %s" % self._test_name
        self.__search_setup()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        self.__search_teardown()
        super(SeachTest, self).tearDown()

    def testSearchSuggestion(self):
        """
        This test case is to test search app

        Test Case Step:
        1.Enter search text, verify suggestions displayed and after search results are displayed
        2.Click the suggestions link to launch application

        Expect Result:
        1.Verify that users can access to Search,
        2.Verify that the searched result with keyword can be shown.

        """
        print "[RunTest]: %s" % self.__str__()

        app_key = self.search.cfg.get("app_key")
        check_app = self.search.cfg.get("check_app")
        web_key = self.search.cfg.get("web_key")
        check_web = self.search.cfg.get("check_web")
        contact_key = self.search.cfg.get("contact_key")
        check_contact = self.search.cfg.get("check_contact")

        self.search.search(app_key)
        time.sleep(5)
        self.search.check_search(check_app)
        self.search.search(web_key)
        time.sleep(5)
        self.search.check_search(check_web)
        self.search.search(contact_key)
        time.sleep(5)
        self.search.check_search(check_contact)

    def __search_setup(self):
        """
        @summary: setup search function
        """

        website = self.search.cfg.get("check_web")
        webcheck = self.search.cfg.get("check_webcheck")
        contact = self.search.cfg.get("check_contact")

        if website != "" and webcheck != "":
            self.browser.browser_setup()
            self.browser.open_website(website)
            self.browser.web_check(webcheck)
        if contact != "":
            self.contacts.contact_add(contact)
        g_common_obj.back_home()

    def __search_teardown(self):
        """
        @summary: clear data
        """
        self.search.stop_from_am()
        self.browser.clear_data()
Exemple #2
0
class SeachTest(UIATestBase):
    """
    @summary: Test google search application
    """
    def setUp(self):
        cfg_file = 'tests.tablet.google_fast.conf'
        super(SeachTest, self).setUp()
        self._test_name = __name__
        self.search = SearchImpl(\
            self.config.read(cfg_file, 'google_search'))
        self.browser = BrowserImpl(self.config.read(cfg_file, 'browser'))
        self.contacts = ContactsImpl(self.config.read(cfg_file, 'wifisetting'))
        print "[Setup]: %s" % self._test_name
        self.__search_setup()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        self.__search_teardown()
        super(SeachTest, self).tearDown()

    def testSearchOption(self):
        """
        This test case is to test search app

        Test Case Step:
        1.Google Now: Verify user can opt in in Google Now and Cards are displayed

        Expect Result:
        1.Verify that users can access to Search,
        2.Verify that the searched result with keyword can be shown.
        3.The search result can link to application

        """
        print "[RunTest]: %s" % self.__str__()

        app_key = self.search.cfg.get("app_key")
        check_app = self.search.cfg.get("check_app")
        web_key = self.search.cfg.get("web_key")
        check_web = self.search.cfg.get("check_web")
        contact_key = self.search.cfg.get("contact_key")
        check_contact = self.search.cfg.get("check_contact")
        app_package = self.search.cfg.get("app_package")
        web_package = self.search.cfg.get("web_package")
        contact_package = self.search.cfg.get("contact_package")

        self.search.search(app_key)
        self.search.check_search(check_app)
        self.search.launch_app_from_search(check_app, app_package)
        self.search.search(web_key)
        self.search.check_search(check_web)
        self.search.launch_app_from_search(check_web, web_package)
        self.search.search(contact_key)
        self.search.check_search(check_contact)
        self.search.launch_app_from_search(check_contact, contact_package)

    def __search_setup(self):
        """
        @summary: setup search function
        """

        website = self.search.cfg.get("check_web")
        webcheck = self.search.cfg.get("check_webcheck")
        contact = self.search.cfg.get("check_contact")

        if website != "" and webcheck != "":
            self.browser.browser_setup()
            self.browser.open_website(website)
            self.browser.web_check(webcheck)
        if contact != "":
            self.contacts.contact_add(contact)
        #self.wifi.launch_from_am()
        #self.wifi.turn_off_wifi()
        g_common_obj.back_home()

    def __search_teardown(self):
        """
        @summary: clear data
        """
        self.search.stop_from_am()
        self.browser.clear_data()
class SeachLowBatteryTest(UIATestBase):
    """
    @summary: Test google play application
    """
    def setUp(self):
        cfg_file = 'tests.tablet.google_fast.conf'
        super(SeachLowBatteryTest, self).setUp()
        self._test_name = __name__
        self.search = SearchImpl(\
            self.config.read(cfg_file, 'google_search'))
        self.browser = BrowserImpl(self.config.read(cfg_file, 'browser'))
        self.contacts = ContactsImpl(self.config.read(cfg_file, 'contacts'))
        print "[Setup]: %s" % self._test_name
        self.__search_setup()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        self.__search_teardown()
        super(SeachLowBatteryTest, self).tearDown()

    def testSearchLowBattery(self):
        """
        This test case is to test search while battery low status

        Test Case Precondition:
        1. DUT at battery low status

        Test Case Step:
        1.Launch Search.Verify that users can access to Search,
        2.Input some search keyword to search.Verify that the searched
        result with keyword can be show

        Expect Result:
        1.Verify that users can access to Search,
        2.Verify that the searched result with keyword can be shown.

        """
        print "[RunTest]: %s" % self.__str__()

        search_key = self.search.cfg.get("search_key")
        check_app = self.search.cfg.get("check_app")
        check_web = self.search.cfg.get("check_web")
        check_contact = self.search.cfg.get("check_contact")

        self.search.search(search_key)
        self.search.check_search(check_app, check_web, check_contact)

    def __search_setup(self):
        """
        @summary: setup search function
        """

        website = self.search.cfg.get("check_web")
        webcheck = self.search.cfg.get("check_webcheck")
        contact = self.search.cfg.get("check_contact")
        #check battery
        low_battery_level = self.search.cfg.get("low_battery_level")
        self.search.check_low_battery(low_battery_level)

        if website != "" and webcheck != "":
            self.browser.browser_setup()
            self.browser.open_website(website)
            self.browser.web_check(webcheck)
        if contact != "":
            self.contacts.contact_add(contact)
        g_common_obj.back_home()

    def __search_teardown(self):
        """
        @summary: clear data
        """
        self.search.stop_from_am()
        self.browser.clear_data()
class SeachLowMemoryTest(UIATestBase):
    """
    @summary: Test google play application
    """
    def setUp(self):
        cfg_file = 'tests.tablet.google_fast.conf'
        super(SeachLowMemoryTest, self).setUp()
        self._test_name = __name__
        self.search = SearchImpl(\
            self.config.read(cfg_file, 'google_search'))
        self.browser = BrowserImpl(self.config.read(cfg_file, 'browser'))
        self.contacts = ContactsImpl(\
            self.config.read(cfg_file, 'contacts'))
        print "[Setup]: %s" % self._test_name
        self.__search_setup()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        self.__search_teardown()
        super(SeachLowMemoryTest, self).tearDown()


    def testSearchLowMemorry(self):
        """
        This test case is to test search works well when memory is full

        Test Case Precondition:
        1.Full memory card
        2.Many contact records exist in DUT memory.
        3.Many APK (Contains installed) exist in DUT memory

        Test Case Step:
        1.Launch Search.Verify that users can access to Search and DUT works well when full memory card
        2.Input some search keyword to search.Verify that contacts, applications and web items containing the\
        keyword would be shown in search result if exist

        Expect Result:
        1.Verify that users can access to Search and DUT works well when full memory card
        2.Verify that contacts, applications and web items containing the keyword would be shown
        in search result if exist
        """
        print "[RunTest]: %s" % self.__str__()

        search_key = self.search.cfg.get("search_key")
        check_app = self.search.cfg.get("check_app")
        check_web = self.search.cfg.get("check_web")
        check_contact = self.search.cfg.get("check_contact")

        self.search.search(search_key)
        self.search.check_search(check_app, check_web, check_contact)

    def __search_setup(self):
        """
        @summary: setup search function
        """

        website = self.search.cfg.get("check_web")
        webcheck = self.search.cfg.get("check_webcheck")
        contact = self.search.cfg.get("check_contact")
        #fill memory

        if website != "" and webcheck != "":
            self.browser.browser_setup()
            self.browser.open_website(website)
            self.browser.web_check(webcheck)
        if contact != "":
            self.contacts.contact_add(contact)
        g_common_obj.back_home()

    def __search_teardown(self):
        """
        @summary: clear data
        """
        #delete fill data
        self.search.stop_from_am()
        self.contacts.clear_contact()
        self.browser.clear_browser()