def setUp(self):
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.battery = BatterySetting()
     self.battery.set_screen_status("on")
     self.battery.unlock_screen()
     super(BatteryShowPercentage, self).setUp()
Ejemplo n.º 2
0
 def setUp(self):
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.battery = BatterySetting()
     self.battery.set_screen_status("on")
     self.battery.unlock_screen()
     DisplaySetting().set_sleep_mode("30 minutes")
     super(BatteryUsageData, self).setUp()
Ejemplo n.º 3
0
 def test_SDP_charging(self):
     """
     SDP charging
     """
     print "[RunTest]: %s" % self.__str__()
     battery = BatterySetting()
     status = battery.get_battery_status()
     if "Full" in status:
         return
     assert "USB" in status
Ejemplo n.º 4
0
 def test_power_show_charging_status(self):
     """
     Test power show charging status
     """
     print "[RunTest]: %s" % self.__str__()
     battery = BatterySetting()
     status = battery.get_battery_status()
     if "Full" in status:
         return
     assert "Charging" in status
Ejemplo n.º 5
0
 def test_charged_by_usb_cable(self):
     """
     Test charged by usb cable
     """
     print "[RunTest]: %s" % self.__str__()
     battery = BatterySetting()
     battery.launch()
     status = battery.get_battery_status()
     print status
     assert "USB" in status
Ejemplo n.º 6
0
 def test_power_gauge_app(self):
     """
     power gauge app
     """
     print "[RunTest]: %s" % self.__str__()
     level_widget = self.app.get_battery_level()
     level_noti = Notification().get_battery_level()
     level_settings = BatterySetting().get_battery_level()
     assert abs(level_widget - level_noti) <= 1
     assert abs(level_widget - level_settings) <= 1
class BatteryShowPercentage(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.battery = BatterySetting()
        self.battery.set_screen_status("on")
        self.battery.unlock_screen()
        super(BatteryShowPercentage, self).setUp()

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

    def test_battery_show_percentage_in_settings(self):
        """
        Test battery show percentage in settings
        """
        print "[RunTest]: %s" % self.__str__()
        level_setting = self.battery.get_battery_level()
        level_drop_menu = Notification().get_battery_level()
        assert abs(level_drop_menu - level_setting) < 2
    def test_power_show_battery_status(self):
        """
        Test power show battery status
        """
        print "[RunTest]: %s" % self.__str__()

        uidump = os.path.join(self.tmp_dir, "uidump.xml")
        BatterySetting().launch()
        self.energy.capture_uidump_with_charging(uidump_file=uidump,
                                                 charger_type=None)
        status = self.energy.get_battery_status_from_uidump(uidump)
        print status
        assert not ("Charging over" in status or "Full" in status)
Ejemplo n.º 9
0
 def test_sdp_charger_insertion_when_device_on(self):
     """
     SDP charger insertion when device is on
     """
     print "[RunTest]: %s" % self.__str__()
     from testlib.em.tools import get_tmp_dir, remove_tmp_dir
     from testlib.em.crop_battery_icon import CropBatteryImage
     rect = BatterySetting().get_status_bar_rect()
     tmp_dir = get_tmp_dir()
     screenshot = os.path.join(tmp_dir, "screenshot.png")
     self.energy.capture_screen(screenshot)
     crop_battery = CropBatteryImage(screenshot, rect)
     crop_battery.check_charging_status_by_icon(True)
     remove_tmp_dir(tmp_dir)
Ejemplo n.º 10
0
class BatteryUsageData(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.battery = BatterySetting()
        self.battery.set_screen_status("on")
        self.battery.unlock_screen()
        DisplaySetting().set_sleep_mode("30 minutes")
        super(BatteryUsageData, self).setUp()

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

    def test_battery_usage_data(self):
        """
        Test battery usage data in settings
        """
        print "[RunTest]: %s" % self.__str__()
        for i in range(20):
            if self.battery.check_battery_usage_data():
                break
            USBCut().cut(30)
        assert self.battery.check_battery_usage_data()