def test3_performancemenu_kpi(self, ): try: driver = self.driver logger = self.logger self.assertEquals(self.driver.title, "OrangeHRM", "Tittle mismatch") #self.assertEquals(self.driver.title, "OrangeHRM-Fail", "Tittle mismatch") homepage = HomePage(driver) performancepageobj = PerformancePage(driver) homepage.click_welcome() performancepageobj.performance_page_imple() for kpiaddstatus in performancepageobj.Performance_config_kpis_imple( ): self.assertTrue(kpiaddstatus, "add kpi failed") logger.debug("KPI validation-{}- {}".format( kpiaddstatus, self.assertTrue(kpiaddstatus, "kpi-add-failures"))) except Exception as e: logger.debug("Error - {}".format(e.args)) logger.debug("Stack trace - {} -{} ".format( traceback.print_exc(), traceback.print_stack())) status = sys.exc_info() == (None, None, None) logger.debug("stack trace {},funnname:{}".format( sys.exc_info(), self._testMethodName)) UtilCalss.takescreenshot_failure(driver, self._testMethodName) finally: logger.debug("End of TestCase {}:{}".format( self._testMethodName, sys.exc_info()))
def test3_Qulification_adds(self): driver=self.driver homepage = HomePage(driver) adminpage = AdminPage(driver) homepage.click_welcome() #time.sleep(5) adminpage.click_adminmenu() #self.assertTrue(WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MH.ADMIM_PAGE_VLID_ID)),"Invalid admin page") qulification=driver.find_element(*MU.USER_QLIFICATION_MENU) actions = ActionChains(driver) actions.move_to_element(qulification).perform() qulification.click() time.sleep(2) items = qulification.find_elements_by_tag_name("li") print('ITEMS',items) for item in items: #actions.move_to_element(qulification).perform() actions.move_to_element(item).perform() #item.click() text = item.text print text pass
def test1_adminmenu(self): driver=self.driver self.assertEquals(driver.current_url,"https://opensource-demo.orangehrmlive.com/index.php/dashboard", 'Invalid URL') self.assertEquals(driver.title, "OrangeHRM", "Title mismatch") homepage = HomePage(driver) homepage.click_welcome() #time.sleep(5) adminpage = AdminPage(driver) adminpage.click_adminmenu() self.assertTrue(WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MH.ADMIM_PAGE_VLID_ID)),"Invalid admin page") '''
def test4_performance_required_field(self, ): try: driver = self.driver logger = self.logger homepage = HomePage(driver) performancepageobj = PerformancePage(driver) homepage.click_welcome() performancepageobj.performance_page_imple() self.assertTrue( performancepageobj.performance_required_field_imple( eval(self.parser['INPUT_FIELDS']['INPUTS'].encode()), self.parser["PAGECONTAINS"]["KPI_REQ1"].encode()), "required message not placed in page") except AssertionError: logger.debug("Required field validation not available")
def test2_adminusersearch(self): driver=self.driver ''' parser =Adminpagetest.get_url_parser() loginpage = LoginPage(driver) #self.parser["BEHAV"]["username"] # print("") loginpage.enter_username(parser["BEHAV"]["username1"]) loginpage.enter_password(parser["BEHAV"]["password"]) loginpage.click_login() ''' homepage = HomePage(driver) homepage.click_welcome() adminpage = AdminPage(driver) adminpage.click_adminmenu() adminpage.click_adminsearchuser('Rohith','ESS','John Smith',1) ''' driver.find_element(*MU.USER_SEARCH_TEXTBOX_ID).is_displayed() driver.find_element(*MU.USER_SEARCH_TEXTBOX_ID).clear() driver.find_element(*MU.USER_SEARCH_TEXTBOX_ID).send_keys('Rohith') role= driver.find_element(*MU.USER_ROLE_DROPDOWN_ID) role.is_displayed() dropdown = Select(role) dropdown.select_by_visible_text('ESS') # print(len(dropdown.options())) driver.find_element(*MU.USER_EMPNAME_TEXTBOX).send_keys("John Smith") status = driver.find_element(*MU.USER_STATUS_DROPDOWN_ID) dropdown1 = Select(status) dropdown1.select_by_index(1) driver.find_element(*MU.USER_SEARCH_BUTTON_CLASS).click() time.sleep(3) ''' self.assertIs(driver.find_element(By.LINK_TEXT,'Rohith').text,"Rohith", "Employee search failed") time.sleep(2) adminpage.click_adminlogout() #//*[@id="resultTable"]/tbody/tr/td[2]/a '''
def test1_Loginpage(self): try: print("LogIn page elements {}".format(self.driver)) self.driver.get((LogInpagetest.get_url('URL'))) driver = self.driver logger = self.logger loginpage = LoginPage(driver) #self.parser["BEHAV"]["username"] # print("") loginpage.enter_username(self.parser["BEHAV"]["username1"]) loginpage.enter_password(self.parser["BEHAV"]["password"]) loginpage.click_login() self.assertEquals(self.driver.title, "OrangeHRM", "Tittle mismatch") #self.assertEquals(self.driver.title, "OrangeHRM-Fail", "Tittle mismatch") homepage = HomePage(driver) homepage.click_welcome() #logger = UtilCalss.getlogger(UtilCalss()) logger.debug("stack trace {},funnname:{}".format( sys.exc_info(), self._testMethodName)) status = sys.exc_info() == (None, None, None) print("status: {}".format(status)) homepage.click_logout() except Exception as e: status = sys.exc_info() == (None, None, None) print("status: {}".format(status)) print("Invalid logIn message not present") logger.debug("stack trace {},funnname:{}".format( sys.exc_info(), self._testMethodName)) timestamp = re.sub('[-:. ]', '', str(datetime.datetime.now()))[:-3] failedtestscreen = os.getcwd( ) + self._testMethodName + timestamp + ".png" distdir = 'C:/Users/NOORSHAVALI/eclipse-workspace/HelloPythonWorld/output' self.driver.get_screenshot_as_file(failedtestscreen) shutil.copy(failedtestscreen, distdir) time.sleep(2) '''
def test1_performancemenu(self, ): try: driver = self.driver logger = self.logger self.assertEquals(self.driver.title, "OrangeHRM", "Tittle mismatch") #self.assertEquals(self.driver.title, "OrangeHRM-Fail", "Tittle mismatch") homepage = HomePage(driver) performancepageobj = PerformancePage(driver) homepage.click_welcome() performancepageobj.performance_page_imple() self.assertTrue( WebDriverWait(self.driver, WaitTime).until( EC.visibility_of_element_located( PU.PEFORMANCE_CONFIG_menu)), "Config menu does n't displayed") except Exception, e: logger.debug("Error - {}".format(e.args))
def test6_admin_job_category_add(self): driver= self.driver homepage = HomePage(driver) adminpage = AdminPage(driver) homepage.click_welcome() #time.sleep(5) adminpage.click_adminmenu() driver.find_element(*MU.USER_ADMIN_JOB).click() WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MU.USER_ADMIN_JOB_CATETORY)) driver.find_element(*MU.USER_ADMIN_JOB_CATETORY).click() WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MU.USER_ADMIN_JOB_CATETORY_ADD)) driver.find_element(*MU.USER_ADMIN_JOB_CATETORY_ADD).click() WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MU.USER_ADMIN_JOB_CATETORY_VALID)) driver.find_element(*MU.USER_ADMIN_JOB_CATETORY_ADD_TXT).clear() driver.find_element(*MU.USER_ADMIN_JOB_CATETORY_ADD_TXT).send_keys("Job Cat") driver.find_element(*MU.USER_ADMIN_JOB_CATETORY_ADD_TXT).send_keys(Keys.TAB) WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MU.USER_ADMIN_JOB_CATETORY_ADD_SAVE)) driver.find_element(*MU.USER_ADMIN_JOB_CATETORY_ADD_SAVE).click() self.assertEquals(WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MU.USER_ADMIN_JOB_CATETORY_ADD)).is_displayed(), True, "Faile to add job category")
def test4_admin_allsubmenu_navigations(self): driver=self.driver homepage = HomePage(driver) adminpage = AdminPage(driver) homepage.click_welcome() #time.sleep(5) adminpage.click_adminmenu() #self.assertTrue(WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MH.ADMIM_PAGE_VLID_ID)),"Invalid admin page") adminsubmenu= driver.find_element(*MU.USER_ADMIN_SUBMENU_NAVIGATION) actions = ActionChains(driver) items = adminsubmenu.find_elements_by_tag_name("li") print(' length{} ITEMS{}'.format(len(items),items)) for item in items: actions.move_to_element(item).perform() ''' item.click() text = item.text print text ''' time.sleep(2) pass
def test5_admin_submenu_navigations(self): driver=self.driver homepage = HomePage(driver) homepage.click_welcome() #time.sleep(5) adminpage = AdminPage(driver) adminpage.click_adminmenu() #self.assertTrue(WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MH.ADMIM_PAGE_VLID_ID)),"Invalid admin page") adminsubmenu= driver.find_element(*MU.USER_ADMIN_SUBMENU_NAVIGATION) actions = ActionChains(driver) ## This will be used validate visible text in key value process items = adminsubmenu.find_elements(*MU.USER_ADMIN_SUBMENU_LIST) ecs = MU.USER_ADMIN_SUBMENU_VALIDATION_LIST #print(' length{} ITEMS{}'.format(len(items),items)) #for expected,item in map(lambda x,y: (x,y) , ecs,items): # pass for item in items: actions.move_to_element(item).perform() #self.assertTrue(WebDriverWait(driver,WaitTime).until(EC.presence_of_element_located(MH.ADMIM_PAGE_VLID_ID)),"Invalid admin page") self.assertEquals(WebDriverWait(driver,WaitTime).until(lambda driver: item).is_displayed() , True , "Item" + item.text + "not displayed") time.sleep(0.5) '''