def tearDown(self): logger.info("测试后退出.") ProjectActions(self.__driver).saveDeleteProject() WorkbenchActions(self.__driver).switchBackToFrame() WorkbenchActions(self.__driver).logout() self.__driver.quit()
def setUp(self): logger.info("测试前准备.") self.__driver = browser(glo.GLO_BROWSER_TYPE) PMCloudIndexActions(self.__driver).openPMCloudIndex() PMCloudIndexActions(self.__driver).clickLoginButton() PMCloudLoginActions(self.__driver).pmcloudLogin() ApptenantActions(self.__driver).apptenantLogin() WorkbenchActions(self.__driver).clickProject() WorkbenchActions(self.__driver).switchToIframe()
def setUp(self): logger.info("测试前准备.") self.__driver = browser(glo.GLO_BROWSER_TYPE) PMCloudIndexActions(self.__driver).openPMCloudIndex() PMCloudIndexActions(self.__driver).clickLoginButton() PMCloudLoginActions(self.__driver).pmcloudLogin() ApptenantActions(self.__driver).apptenantLogin() WorkbenchActions(self.__driver).clickProject() WorkbenchActions(self.__driver).switchToIframe() ProjectActions(self.__driver).saveCreateProject() ProjectActions(self.__driver).closeListToast() ProjectActions(self.__driver).selectFirstProject() ProjectActions(self.__driver).clickEnterpriseButton()
def tearDownClass(cls): # 测试完成要删除新建的联系类型 cls.contacttype_page.saveDeleteContactType() WorkbenchActions(cls.__driver).logout() logger.info("测试后退出.") cls.__driver.quit()
def setUp(self): logger.info("测试前准备.") self.__driver = browser(glo.GLO_BROWSER_TYPE) PMCloudIndexActions(self.__driver).login() PMCloudLoginActions(self.__driver).pmcloudLogin() ApptenantActions(self.__driver).apptenantLogin() WorkbenchActions(self.__driver).clickContactType() self.contacttype_page = ContactTypeActions(self.__driver)
def setUpClass(cls): logger.info("测试前准备.") cls.__driver = browser(glo.GLO_BROWSER_TYPE) PMCloudIndexActions(cls.__driver).login() PMCloudLoginActions(cls.__driver).pmcloudLogin() ApptenantActions(cls.__driver).apptenantLogin() WorkbenchActions(cls.__driver).clickContactType() # 提前新建好联系类型 cls.contacttype_page = ContactTypeActions(cls.__driver) cls.contacttype_page.clickAddContactTypeCancelButton() cls.contacttype_page.saveAddContactType() cls.contacttype_page.clickAddContactTypeCancelButton()
def test_login_success(self): """登录成功""" logger.info("执行TestLogin_test_login_success测试用例.") expected_result = "孙旭冉" index_page = PMCloudIndexActions(self.__driver) index_page.openPMCloudIndex() index_page.clickLoginButton() login_page = PMCloudLoginActions(self.__driver) login_page.pmcloudLogin() apptenant_page = ApptenantActions(self.__driver) apptenant_page.apptenantLogin() self.workbench_page = WorkbenchActions(self.__driver) result = self.workbench_page.getCurrentUser() self.assertEqual(expected_result, result, msg="测试不通过,期望结果为:{expect}, 实际结果为:{result}.".format( expect=expected_result, result=result))
class TestLogin(unittest.TestCase): """测试友工程登录""" def setUp(self): logger.info("测试前准备.") self.__driver = browser(glo.GLO_BROWSER_TYPE) def tearDown(self): logger.info("测试后退出.") self.workbench_page.logout() self.__driver.quit() def test_login_success(self): """登录成功""" logger.info("执行TestLogin_test_login_success测试用例.") expected_result = "孙旭冉" index_page = PMCloudIndexActions(self.__driver) index_page.openPMCloudIndex() index_page.clickLoginButton() login_page = PMCloudLoginActions(self.__driver) login_page.pmcloudLogin() apptenant_page = ApptenantActions(self.__driver) apptenant_page.apptenantLogin() self.workbench_page = WorkbenchActions(self.__driver) result = self.workbench_page.getCurrentUser() self.assertEqual(expected_result, result, msg="测试不通过,期望结果为:{expect}, 实际结果为:{result}.".format( expect=expected_result, result=result))
def tearDown(self): WorkbenchActions(self.__driver).logout() logger.info("测试后退出.") self.__driver.quit()
def tearDownClass(cls): WorkbenchActions(cls.__driver).logout() logger.info("测试后退出.") cls.__driver.quit()