def test_004_verify_application(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() self.homePage = HomePage(self.loginPage.driver) self.homePage.create_application() self.createApplicationPage = CreateEditApplicationPage(self.homePage.driver) # Upload required documents and check a checkmark when the upload process is finished self.createApplicationPage.upload(Locators.UPLOAD_NRIC_BUTTON, TestData.NRIC_PATH) self.createApplicationPage.is_visible_long(Locators.NRIC_SUCCESS_ICON) #Submit the application self.createApplicationPage.submit_application() #Instantiate an object of HomePage class and check a toaster appear self.homePage = HomePage(self.createApplicationPage.driver) self.homePage.is_enabled(Locators.NOTIFICATION_TOASTER) self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2) #Go to Claim Officer role and sort the claim list by the latest entries self.homePage.claim_officer_role() self.homePage.sort_by_latest() self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_1) # Go to the latest application details, instantiate an object of # ApplicationPage class and verify the application then assert # it has been verified self.applicationDetailPage = ApplicationDetailPage(self.homePage.driver) self.applicationDetailPage.verify_application() self.applicationDetailPage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2) self.homePage = HomePage(self.applicationDetailPage.driver) self.homePage.sort_by_latest() self.assertTrue(self.homePage.assert_element_text(Locators.CLAIM_APPLICATION_ROW_1_STATUS, TestData.STATUS_VERIFIED))
def test_001_create_application_submit_uploaded_document(self): #Instantiate an object of LoginPage class and login using provided credential self.loginPage = LoginPage(self.driver) self.loginPage.login() #Instantiate an object of HomePage class and go to Create Application page self.homePage = HomePage(self.loginPage.driver) self.homePage.create_application() #Instantiate an object of CreateApplicationPage class and start to upload documents self.createApplicationPage = CreateEditApplicationPage( self.homePage.driver) # Upload required documents and assert a checkmark when the upload process is finished self.createApplicationPage.upload_document() for locator in checkmark_icon_locators: self.assertTrue(self.createApplicationPage.is_visible(locator)) #Submit the application self.createApplicationPage.submit_application() #Instantiate an object of HomePage class and assert a toaster appear self.homePage = HomePage(self.createApplicationPage.driver) self.assertTrue(self.homePage.is_enabled( Locators.NOTIFICATION_TOASTER))
def test_login(self, driver, username, password, tag_message): print(username) # print(data['username']) login = LoginPage(driver, username, password) login.Login() print(tag_message) login.check_tagmessage(tag_message) sleep(3)
def test_001_login_with_correct_credential(self): #Instantiate an object of LoginPage class. When the constructor of LoginPage #is called, it opens up the browser and navigates to Login Page of IMDA iCheck #then login using provided credential self.loginPage = LoginPage(self.driver) self.loginPage.login() #Assert that redirect to Home page with Extract name is visible at the page self.assertTrue(self.loginPage.is_visible(Locators.APP_NAME))
def test_004_login_with_not_existed_user(self): # Instantiate an object of LoginPage class. When the constructor of LoginPage # is called, it opens up the browser and navigates to Login Page of IMDA iCheck # then login using non existing credential but with wrong password self.loginPage = LoginPage(self.driver) self.loginPage.login_wrong_user() # Asserting the Login alert is visible and its text self.assertTrue(self.loginPage.is_visible(Locators.LOGIN_ALERT)) self.assertTrue(self.loginPage.assert_element_text(Locators.LOGIN_ALERT, TestData.LOGIN_ALERT_TEXT))
def test_002b_login_then_logout(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() self.homePage = HomePage(self.loginPage.driver) self.assertTrue(self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2)) self.homePage.logout() #Asserting redirection to Login page with Login button is visible self.assertTrue(self.homePage.is_visible(Locators.LOGIN_PAGE_TITLE))
def test_002_click_pending_application(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() self.homePage = HomePage(self.loginPage.driver) self.homePage.claim_officer_role() self.assertTrue(self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2)) #Click application with 'Pending Approval' status and assert redirection to Application Detail page self.homePage.verify_application() self.assertTrue(self.homePage.is_visible(Locators.VERIFY_APPLICATION_BUTTON))
class LoginModel(object): def __init__(self, wd): self.page = LoginPage(wd) def __del__(self): pass def login(self, username, password): self.page.user_name_input(username) self.page.passwrod_input(password) self.login_click()
def test_002a_first_time_login_then_logout(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() # Asserting that claim application list is not present self.homePage = HomePage(self.loginPage.driver) self.assertFalse(self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2)) self.homePage.logout() #Asserting redirection to Login page with Login button is visible self.assertTrue(self.homePage.is_visible(Locators.LOGIN_PAGE_TITLE))
def test_001_login_with_claim_officer_role(self): #Instantiate an object of LoginPage class and login using provided credential self.loginPage = LoginPage(self.driver) self.loginPage.login() #Instantiate an object of HomePage class and go to Claim Officer role self.homePage = HomePage(self.loginPage.driver) self.homePage.claim_officer_role() # Assert Claim Applications table is visible and the applications with Pending Approval status # are clickable self.assertTrue(self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2_APPLICANT_NAME)) #Assert Create New Application is not visible self.assertFalse(self.homePage.is_visible(Locators.CREATE_NEW_APPLICATION))
def test_006_edit_application_view_document(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() # Instantiate an object of HomePage class and go to Edit Application page of the first application self.homePage = HomePage(self.loginPage.driver) self.homePage.edit_application() #Instantiate an object of CreateEditApplicationPage class and remove all the documents self.editApplicationPage = CreateEditApplicationPage(self.homePage.driver) # View uploaded documents and assert the checkmarks when all the view process is finished self.editApplicationPage.view_document() for locator in checkmark_icon_locators: self.assertTrue(self.editApplicationPage.is_visible(locator))
def test_002_create_application_remove_uploaded_document(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() self.homePage = HomePage(self.loginPage.driver) self.homePage.create_application() self.createApplicationPage = CreateEditApplicationPage(self.homePage.driver) # Upload required documents and assert a checkmark when the upload process is finished self.createApplicationPage.upload_document() for locator in checkmark_icon_locators: self.assertTrue(self.createApplicationPage.is_visible(locator)) #Remove the uploaded documents & assert the checkmark disappear from its respective document self.createApplicationPage.remove_document() for locator in checkmark_icon_locators: self.assertFalse(self.createApplicationPage.is_visible(locator))
def test_003_create_application_view_uploaded_document(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() self.homePage = HomePage(self.loginPage.driver) self.homePage.create_application() self.createApplicationPage = CreateEditApplicationPage(self.homePage.driver) # Upload required documents and assert a checkmark when the upload process is finished self.createApplicationPage.upload_document() for locator in checkmark_icon_locators: self.assertTrue(self.createApplicationPage.is_visible(locator)) # View uploaded documents and assert the checkmarks when all the view process is finished self.createApplicationPage.view_document() for locator in checkmark_icon_locators: self.assertTrue(self.createApplicationPage.is_visible(locator))
def test_login(data): #print('1112222') driver = InitDriver.startBrowser() login = LoginPage.LoginClass(driver) login.enter_name(data[0]) login.enter_passwd(data[1]) login.click_button()
def test_Run_ComeTO_Testforgn(self, driver): LoginPage(driver, configRead().read_username(), configRead().read_pwd()).Login() # HomePage_one(driver).click_TestManage() #点击自动化功能测试按钮,进入功能测试列表 HomePage_one(driver).click_gongneng()
def test_creat_group(self, driver): LoginPage(driver, configRead().read_username(), configRead().read_pwd()).Login() # 主页选择项目组 HomePage_one(driver).choise_project() sleep(3) #点击脚本管理 HomePage_one(driver).click_auto_script() sleep(3) for i in range(1, 2): # 点击脚本组tab ScriptManagerPage(driver).click_scrpt_group_tab() sleep(3) #点击创建脚本组 ScriptManagerPage(driver).click_creat_scrpt_group() sleep(3) #输入脚本组名称 ScriptManagerPage(driver).input_description_value("asdadasdasd") sleep(3) #添加两个脚本 ScriptManagerPage(driver).add_button_twice() sleep(3) #点击已添加 ScriptManagerPage(driver).click_added() sleep(3) ScriptManagerPage(driver).click_ALL_clear() sleep(3) #点击创建 ScriptManagerPage(driver).click_success_creat() assert ScriptManagerPage(driver).Get_Alert_message() == "操作成功"
def test_comein_manage(self, driver): LoginPage(driver, configRead().read_manage_username(), configRead().read_manage_pwd()).Login() # 主页选择项目组 HomePage_one(driver).choise_project() # 主页进入管理中心 ManagePage(driver).click_comein()
def setUp(self): '''该函数主要完成每个测试用例的初始换工作''' url = "http://192.168.1.101:10020" self.driver = CreateDriver.getBrowserDriver() time.sleep(1) self.page = LoginPage.LoginPage(self.driver, url) self.homePage = HomePage.HomePage(self.driver)
def test_004_edit_application_remove_document(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() # Instantiate an object of HomePage class and go to Edit Application page of the first application self.homePage = HomePage(self.loginPage.driver) self.homePage.edit_application() #Instantiate an object of CreateEditApplicationPage class and remove all the documents self.editApplicationPage = CreateEditApplicationPage(self.homePage.driver) # Remove the uploaded documents & assert the checkmark disappear from its respective document self.editApplicationPage.remove_document() for locator in checkmark_icon_locators: self.assertFalse(self.editApplicationPage.is_visible(locator)) #Return to Home page and assert the applicant name in the is empty self.editApplicationPage.back_to_application_list() self.assertTrue(self.editApplicationPage.assert_element_text(Locators.CLAIM_APPLICATION_ROW_2_APPLICANT_NAME, TestData.EMPTY_TEXT))
def test_005_edit_application_upload_document(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() # Instantiate an object of HomePage class and go to Edit Application page of the first application self.homePage = HomePage(self.loginPage.driver) self.homePage.edit_application() #Instantiate an object of CreateEditApplicationPage class and remove all the documents self.editApplicationPage = CreateEditApplicationPage(self.homePage.driver) # Upload reqired documents and assert a checkmark when the upload process is finished ## NRIC self.editApplicationPage.upload_document() for locator in checkmark_icon_locators: self.assertTrue(self.editApplicationPage.is_visible(locator)) #Return to Home page and assert the applicant name in the first row is not empty self.editApplicationPage.back_to_application_list() self.assertFalse(self.editApplicationPage.assert_element_text(Locators.CLAIM_APPLICATION_ROW_2_APPLICANT_NAME, TestData.EMPTY_TEXT))
def test_upload_ios(self, driver): LoginPage(driver, configRead().read_username(), configRead().read_pwd()).Login() # 主页选择项目组 HomePage_one(driver).choise_project() # 主页进入应用列表 HomePage_one(driver).appmanage() # 应用管理页面点击上传 AppMangerPage(driver).upload_click() # 上传所选择的应用 AppMangerPage(driver).upload_app_byname(u"D:\\3.ipa") sleep(5)
def test_InvalidLogin(): driver = InitiateDriver.start_Browser() login = LoginPage.Login(driver) login.enterUserName("*****@*****.**") login.clickContinue() login.enterPassword("Password@1111") login.clickLoginButton() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Email_xpath')).send_keys( # "*****@*****.**") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Continue_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Password_xpath')).send_keys("Password@110") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Login_xpath')).click() # assert driver.find_element_by_id(ConfigReader.readElementLocators('Login','Error_message_id')) InitiateDriver.close_Browser()
def test_Download_android(self, driver): # 上传APP LoginPage(driver, configRead().read_username(), configRead().read_pwd()).Login() # 主页选择项目组 HomePage_one(driver).choise_project() # 主页进入应用列表 HomePage_one(driver).appmanage() # 应用管理页面点击上传 AppMangerPage(driver).upload_click() # 上传所选择的应用 AppMangerPage(driver).upload_app_byname(u"D:\\3.ipa") sleep(50) AppMangerPage(driver).click_back_APPmanage() AppMangerPage(driver).click_download() sleep(20)
def test_Deleteapp_ios(self, driver): # 登录 print(driver) LoginPage(driver, configRead().read_username(), configRead().read_pwd()).Login() # 主页选择项目组 HomePage_one(driver).choise_project() # 主页进入应用列表 HomePage_one(driver).appmanage() # 应用管理页面查找应用 AppMangerPage(driver).selectByAppName("咪咕阅读") # 9 AppMangerPage(driver).DeleteApp("咪咕阅读") # 断言是否删除成功 assert AppMangerPage(driver).Get_Alert_message() == "删除成功"
def test_ValidLogin(): driver=InitiateDriver.start_Browser() login = LoginPage.Login(driver) login.enterUserName("*****@*****.**") login.clickContinue() login.enterPassword("Ytrewq@11") login.clickLoginButton() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Email_xpath')).send_keys( # "*****@*****.**") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Continue_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Password_xpath')).send_keys("Password@11") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Login_xpath')).click() # assert driver.title== "OneTrust | Privacy Management Software" print("Title is matching") InitiateDriver.close_Browser()
def test_nodefortest_yunjiankong(self, driver): # 上传APP LoginPage(driver, configRead().read_username(), configRead().read_pwd()).Login() # 主页选择项目组 HomePage_one(driver).choise_project() # 主页进入应用列表 HomePage_one(driver).appmanage() # 应用管理页面点击上传 AppMangerPage(driver).upload_click() # 上传所选择的应用 AppMangerPage(driver).upload_app_byname(u"D:\\1.apk") sleep(50) # 返回到应用管理 AppMangerPage(driver).click_back_APPmanage() # 点击功能测试记录 AppMangerPage(driver).click_node_yunjiankong()
def test_NavigateTo_DataMapping(): driver = InitiateDriver.start_Browser() login = LoginPage.Login(driver) login.enterUserName("*****@*****.**") login.clickContinue() login.enterPassword("Password@11") login.clickLoginButton() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Email_xpath')).send_keys( # "*****@*****.**") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Continue_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Password_xpath')).send_keys("Password@11") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Login_xpath')).click() home = HomePage.Home(driver) home.selectModule() home.verifydashBoard() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Home', 'Module_DM_xpath')).click() # DM=driver.find_element_by_xpath(ConfigReader.readElementLocators('DM', 'Dashboard_xpath')) # assert DM.is_displayed() InitiateDriver.close_Browser()
def test_username_wrong(self): try: self.testcaseinfo.starttime = Common.getCurrentTime() self.driver.get(self.baseurl) loginpage = LoginPage.LoginPage(self.driver) loginpage.set_username("") loginpage.set_password("111111") loginpage.click_login() if loginpage.get_nameerrorinfo() != '请输入用户名': data = Common.zentao_bug_info( u'用户名提示信息不正确$TestLogin.test_username_wrong()', u'正确输入密码,点击登录按钮', u'用户提示信息不正确', u'正确显示提示信息') CreateBug.createbug(data) except Exception as err: self.testcaseinfo.errorinfo = str(err) print(self.testcaseinfo.errorinfo) finally: self.testcaseinfo.endtime = Common.getCurrentTime() self.testcaseinfo.secondsDuration = Common.timeDiff( self.testcaseinfo.starttime, self.testcaseinfo.endtime)
def test_create_Asset(): driver = InitiateDriver.start_Browser() login = LoginPage.Login(driver) login.enterUserName("*****@*****.**") login.clickContinue() login.enterPassword("Password@11") login.clickLoginButton() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Email_xpath')).send_keys( # "*****@*****.**") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Continue_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Password_xpath')).send_keys("Password@11") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Login', 'Login_xpath')).click() home = HomePage.Home(driver) home.selectModule() home.clickAssets() home.clickaddnewButton() home.enterAssetName('AutoAsset2') home.selectManagingOrg('DEMerge') home.selectHostingLocation('Afghanistan') home.clicksaveButton() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Home', 'Module_DM_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('DM','Assets_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Asset','AddNew_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Asset','Name_xpath')).send_keys("AutoAsset2") # driver.find_element_by_xpath(ConfigReader.readElementLocators('Asset','ManagingOrg_dropdown_xpath')).send_keys('DEMerge') # driver.find_element_by_xpath(ConfigReader.readElementLocators('Asset','Org_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Asset','HostingLocation_xpath')).send_keys('Afghanistan') # driver.find_element_by_xpath(ConfigReader.readElementLocators('Asset','country_xpath')).click() # driver.find_element_by_xpath(ConfigReader.readElementLocators('Asset','save_xpath')).click() time.sleep(5) assert driver.find_element_by_xpath( ConfigReader.readElementLocators('Details_tab', 'name_xpath')).is_displayed() InitiateDriver.close_Browser()
class IMDGLoginTest(IMDGBaseTest): def setUp(self): super().setUp() def test_001_login_with_correct_credential(self): #Instantiate an object of LoginPage class. When the constructor of LoginPage #is called, it opens up the browser and navigates to Login Page of IMDA iCheck #then login using provided credential self.loginPage = LoginPage(self.driver) self.loginPage.login() #Assert that redirect to Home page with Extract name is visible at the page self.assertTrue(self.loginPage.is_visible(Locators.APP_NAME)) @unittest.skip("Not first time login") def test_002a_first_time_login_then_logout(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() # Asserting that claim application list is not present self.homePage = HomePage(self.loginPage.driver) self.assertFalse( self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2)) self.homePage.logout() #Asserting redirection to Login page with Login button is visible self.assertTrue(self.homePage.is_visible(Locators.LOGIN_PAGE_TITLE)) def test_002b_login_then_logout(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() self.homePage = HomePage(self.loginPage.driver) self.assertTrue( self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2)) self.homePage.logout() #Asserting redirection to Login page with Login button is visible self.assertFalse(self.homePage.is_visible(Locators.LOGIN_PAGE_TITLE))