def test_blog(self): common_obj = Common(self.driver) common_obj.wait_for_element_visibility(50, "xpath", PublicPageMap["BlogButtonsXpath"] ) common_obj.click(50, "xpath", PublicPageMap["BlogButtonsXpath"] ) common_obj.wait_for_element_visibility(50, "xpath", PublicPageMap["NewsEmailfieldXpath"] )
def setUp(self): super(TestCase, self).setUp() productPageURL = TT_Constants['Base_URL']+"store/p1/Leatherback_Turtle_Picture.html" self.navigate_to_page(productPageURL) common_obj = Common(self.driver) common_obj.wait_for_element_visibility(10, "id", "wsite-com-product-option-Quantity" ) mainWindowHandle = self.driver.window_handles common_obj.click(10, "xpath", "//a[@title='Share on Facebook']") allWindowsHandles = self.driver.window_handles for handle in allWindowsHandles: if handle != mainWindowHandle[0]: common_obj.switch_to_window(handle) break common_obj.wait_for_element_visibility(10, "id", "email" ) common_obj.fill_out_field("id", "email", TT_Constants['Facebook_Username'] ) common_obj.fill_out_field("id", "pass", TT_Constants['Facebook_Password'] ) common_obj.click(10, "name", "login") common_obj.wait_for_element_visibility(10, "name", "share" )
def test_addDescProgram(self): common_obj = Common(self.driver) common_obj.wait_for_element_visibility(45, "xpath", PublicPageMap["UsernameFieldXpath"] ) #Given I am a Pro common_obj.fill_out_field("xpath", PublicPageMap["UsernameFieldXpath"], TT_Constants["proUsername"] ) common_obj.fill_out_field("xpath", PublicPageMap["PasswordFieldXpath"], TT_Constants["proPassword"] ) common_obj.click(45, "xpath", PublicPageMap["LoginButtonNameXpath"] ) common_obj.wait_for_element_visibility(45, "xpath", ProHomepage["GlobalSearchBarXpath"] ) #And I added a new Program #And I am in Program List common_obj.click(45, "xpath", ProSidebar["ProgramButtonLink"] ) #When I press Add Program #And A modal pop up appears mainWindowHandle = self.driver.window_handles common_obj.click(45, "xpath", ProHomepage["AddEWPButtonXpath"]) allWindowsHandles = self.driver.window_handles for handle in allWindowsHandles: if handle != mainWindowHandle[0]: common_obj.switch_to_window(handle) break #And I enter an Program name randomNumber = randint(0001, 9999) exerciseNameGenerate = "Program ", randomNumber common_obj.fill_out_field("xpath", ModalPopupMap["AddExercisePopup"], exerciseNameGenerate ) common_obj.click(45, "xpath", ModalPopupMap["AddExerciseButton"] ) #Then see my workout in Program list common_obj.wait_for_element_visibility(45, "xpath", "//a[contains(text(),"+str(randomNumber)+")][@class='gc-exercises-link']" ) #And I click on the new Program common_obj.click(45, "xpath", "//a[contains(text(),"+str(randomNumber)+")][@class='gc-exercises-link']" ) #And I am redirected to Program overview common_obj.wait_for_element_visibility(45, "xpath", "//span[.='Programs']" ) #When I enter a description common_obj.wait_for_element_visibility(45, "xpath", ProHomepage["ProgramDescField"] ) common_obj.fill_out_field("xpath", ProHomepage["ProgramDescField"], "This is an auto generated text created for WebApp Testing...!" ) #And I click outside of the description area common_obj.click(45, "xpath", "//div [@class='gc-topbar-search']" ) #Then the my input value is visible VerifyValue = WebDriverWait(self.driver, 10).until(lambda driver: self.driver.find_element_by_xpath(ProHomepage["ProgramDescField"])).get_attribute("value") assert "This is an auto generated text created for WebApp Testing...!" == VerifyValue time.sleep(5)