def test_unselect(self): '''不选择任何设备''' d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.delete() self.assertEqual(d.reason(), "请选择一条数据") function.screenshot(self.driver, "device_unselect.jpg")
def test_multiselect(self): '''选择两个设备''' d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.multi_select() d.modify() self.assertEqual(d.reason(), "只能选择一条数据") function.screenshot(self.driver, "device_multiselect.jpg")
def test_delete(self): '''删除设备''' d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.delete_obj() self.assertEqual(d.result(), "您确定要删除这条信息吗") d.confirm() self.assertEqual(d.result(), "删除成功") function.screenshot(self.driver, "delete_device.jpg")
def test_cancle(self): '''取消删除''' d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) s = d.serial_list() d.delete_obj() self.assertEqual(d.result(), "您确定要删除这条信息吗") d.cancel() self.assertEqual(d.serial_list(), s) function.screenshot(self.driver, "delete_device_cancle.jpg")
def test_device_modify_error2(self): '''版本号输入无效''' d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.modify_obj() self.assertEqual(d.sub_tagname(), "设备管理-修改") d.serial_clear() d.add_device("", "中文", "") d.add_save() self.assertEqual(d.error_version(), "数字或字母") function.screenshot(self.driver, "modify_device_serial_invalid.jpg")
def test_device_add_error2(self): '''版本号输入无效''' d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.add() self.assertEqual(d.sub_tagname(), "设备管理-新增") d.add_device(Data.devicename, "中文", "1") d.select_company() d.add_save() self.assertEqual(d.error_version(), "数字或字母") function.screenshot(self.driver, "add_device_serial_invalid.jpg")
def test_device_add(self): '''添加设备''' D = Data() d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.add() self.assertEqual(d.sub_tagname(), "设备管理-新增") d.add_device(Data.devicename, ''.join(D.version()), "1") d.select_company() d.add_save() self.assertEqual(d.success(), True) function.screenshot(self.driver, "add_device.jpg")
def test_device_add_error1(self): '''输入为空''' d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.add() self.assertEqual(d.sub_tagname(), "设备管理-新增") d.add_save() self.assertEqual(d.error_name(), "不能为空哦") self.assertEqual(d.error_company(), "不能为空哦") self.assertEqual(d.error_serial(), "不能为空哦") self.assertEqual(d.error_version(), "不能为空哦") function.screenshot(self.driver, "add_device_blank.jpg")
def test_device_modify_error1(self): '''输入为空''' d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.modify_obj() self.assertEqual(d.sub_tagname(), "设备管理-修改") d.name_clear() d.serial_clear() d.version_clear() d.add_save() self.assertEqual(d.error_name(), "不能为空哦") self.assertEqual(d.error_serial(), "不能为空哦") self.assertEqual(d.error_version(), "不能为空哦") function.screenshot(self.driver, "modify_device_blank.jpg")