def setUp(self): super(ReportTestCase, self).setUp() # self.login_page = LoginPage(self.driver) # is part of super().setUp() self.pim = PIMPage(self.driver) self.reports = ReportsPage(self.driver) self.new_report = NewReportPage(self.driver) self.report_run = ReportRunPage(self.driver)
def setUp(self): self.driver = webdriver.Chrome() self.driver.get('http://hrm.seleniumminutes.com') self.wait = WebDriverWait(self.driver, 10) self.login_page = LoginPage(self.driver) self.pim_page = PimPage(self.driver) self.reports_page = ReportsPage(self.driver) self.new_report_page = NewReportPage(self.driver) self.report_run_page = ReportRunPage(self.driver) self.logout_page = LogoutPage(self.driver)
def setUp(self): self.driver = webdriver.Chrome( "/Users/igor/Desktop/Docs/Git/Python/Selenium-Python-HRM/chromedriver/chromedriver" ) self.driver.get("http://hrm-online.portnov.com/") self.wait = WebDriverWait(self.driver, 2) self.login_page = LoginPage(self.driver) self.pim = PIMPage(self.driver) self.reports = ReportsPage(self.driver) self.new_report = NewReportPage(self.driver) self.report_run = ReportRunPage(self.driver)
class ReportTestCase(POMAdminLoginTestCase): def setUp(self): super(ReportTestCase, self).setUp() self.pim = PIMPage(self.driver) self.reports = ReportsPage(self.driver) self.new_report = NewReportPage(self.driver) self.report_run = ReportRunPage(self.driver) def test_create_report(self): report_name = "Rprt" + str(randint(1, 99)) self.reports.goto_page() self.reports.add() self.new_report.set_name(report_name) self.new_report.select_selection_criteria("Job Title") self.new_report.select_display_field_groups("Personal") self.new_report.enable_display_fields() self.new_report.save() self.report_name = report_name self.reports.search(report_name) self.assertTrue( is_element_present(self.driver, By.XPATH, "//td[text()='{0}']".format(report_name))) self.reports.run(report_name) report_header = self.report_run.get_report_header() self.assertEqual('Report Name : {0}'.format(report_name), report_header) print('Report Name : {0}'.format(report_name), report_header) def tearDown(self): if self.report_name: self.pim.goto_page() self.pim.goto_reports() self.reports.search(self.report_name) self.reports.delete_report(self.report_name) super(ReportTestCase, self).tearDown()
class ReportCreate(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.get('http://hrm.seleniumminutes.com') self.wait = WebDriverWait(self.driver, 10) self.login_page = LoginPage(self.driver) self.pim_page = PimPage(self.driver) self.reports_page = ReportsPage(self.driver) self.new_report_page = NewReportPage(self.driver) self.report_run_page = ReportRunPage(self.driver) self.logout_page = LogoutPage(self.driver) def test_create_report(self): report_name = "DC report: " + str(randint(1, 100)) selection_ctiteria = 'Job Title' display_field_group = 'Personal ' expected_report_header = 'Report Name : {}'.format(report_name) self.login_page.login() self.pim_page.go_to_reports_page() self.reports_page.add_report() self.new_report_page.set_report_name(report_name) self.new_report_page.select_selection_criteria(selection_ctiteria) self.new_report_page.select_display_field_group(display_field_group) self.new_report_page.enable_display_fields() self.new_report_page.save() self.assertTrue(self.reports_page.find_report_name(report_name)) self.report_name = report_name self.reports_page.search(report_name) self.reports_page.run(report_name) report_header = self.report_run_page.get_header() self.assertEqual(expected_report_header,report_header) def tearDown(self): if self.report_name: self.report_run_page.go_to_pim_page() self.pim_page.go_to_reports_page() self.reports_page.search(self.report_name) self.reports_page.report_delete() self.logout_page.logout() self.driver.quit()
class ReportTestCase(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome( "/Users/igor/Desktop/Docs/Git/Python/Selenium-Python-HRM/chromedriver/chromedriver" ) self.driver.get("http://hrm-online.portnov.com/") self.wait = WebDriverWait(self.driver, 2) self.login_page = LoginPage(self.driver) self.pim = PIMPage(self.driver) self.reports = ReportsPage(self.driver) self.new_report = NewReportPage(self.driver) self.report_run = ReportRunPage(self.driver) def tearDown(self): driver = self.driver if self.report_name: driver.find_element_by_id("menu_pim_viewPimModule").click() driver.find_element_by_id( "menu_core_viewDefinedPredefinedReports").click() driver.find_element_by_id("search_search").send_keys( self.report_name) driver.find_element_by_class_name("searchBtn").click() driver.find_element_by_css_selector("td>input").click() driver.find_element_by_id("btnDelete").click() self.wait.until( EC.visibility_of_element_located( (By.ID, "dialogDeleteBtn"))).click() # tearDown: remove the report self.driver.quit() def test_create_report(self): report_name = "IP Report #" + str(random.randint(1, 100)) self.login_page.login() self.pim.goto_reports() self.reports.add() self.new_report.set_name(report_name) self.new_report.setelect_selection_criteria("Job Title") self.new_report.select_display_field_groups("Personal") self.new_report.enable_display_fields() self.new_report.save() self.reports.search(report_name) # assertion self.reports.run(report_name) report_header = self.report_run.get_report_header()
class ReportTestCase(POMAdminLoginTestCase): def setUp(self): super(ReportTestCase, self).setUp() # self.login_page = LoginPage(self.driver) # is part of super().setUp() self.pim = PIMPage(self.driver) self.reports = ReportsPage(self.driver) self.new_report = NewReportPage(self.driver) self.report_run = ReportRunPage(self.driver) def tearDown(self): if self.report_name: self.pim.goto_reports() self.reports.search(self.report_name) self.reports.delete_report(self.report_name) super(ReportTestCase, self).tearDown() def test_create_report(self): report_name = 'EY Report #' + str(random.randint(1, 100)) # self.login_page.login() # is part of super().setUp() self.pim.goto_reports() self.reports.add() self.new_report.set_name(report_name) self.new_report.select_selection_criteria("Job Title") self.new_report.select_display_field_groups("Personal") self.new_report.enable_display_fields() self.new_report.save() self.report_name = report_name # just an example of using a locator inside a page object module print RL["search_button"][0], RL["search_button"][1] button_label = self.driver.find_element(RL["search_button"][0], RL["search_button"][1]).get_attribute('value') self.assertEqual('Search', button_label) ################# self.reports.search(report_name) self.assertTrue(is_element_present(self.driver, By.XPATH, "//td[text()='{0}']".format(report_name))) self.reports.run(report_name) report_header = self.report_run.get_report_header() self.assertEqual('Report Name : {0}'.format(report_name), report_header)
def setUp(self): super(ReportTestCase, self).setUp() self.pim = PIMPage(self.driver) self.reports = ReportsPage(self.driver) self.new_report = NewReportPage(self.driver) self.report_run = ReportRunPage(self.driver)