def test_e2e(self): homePage = HomePage(self.driver) homePage.shopItems().click() checkOutPage = CheckoutPage(self.driver) products = checkOutPage.getCardTitles() for _ in products: product_Name = checkOutPage.productName if product_Name == 'Blackberry': checkOutPage.getCardFooter().click() checkOutPage.getCheckOutbutton().click() checkOutPage.getConfirmButton().click() confirmPage = ConfirmPage(self.driver) confirmPage.getCountry().send_keys('ind') wait = WebDriverWait(self.driver, 7) wait.until( expected_conditions.presence_of_element_located( (By.LINK_TEXT, "India"))) confirmPage.getselectCountry().click() confirmPage.getclickCountry().click() confirmPage.getsubmitbutton().click() success_text = confirmPage.getassertmsg().text assert 'Success' in success_text
def test_e2e(self): log = self.test_getLogger() homePage = HomePage(self.driver) homePage.shopItems().click() self.driver.implicitly_wait(5) ##Choose All Products and Parent-Child Tag Movement Concept Application checkoutPage = CheckoutPage(self.driver) log.info("Getting all the Cart Titles") Products = checkoutPage.getproductItems() ProductName = checkoutPage.getProductName() ProductButton = checkoutPage.getProductButton() i = -1 for product in ProductName: i = i+1 ProdName = product.text log.info(ProdName) if ProdName == "Blackberry": ProductButton[i].click() break # Proceed to Checkout firstCheckOut = checkoutPage.getCheckoutPageConfirm() firstCheckOut.click() finalCheckOut = checkoutPage.getFinalCheckoutConfirm() finalCheckOut.click() ##Confirm Page - Auto Suggestive Dropdown List confirmPage = ConfirmPage(self.driver) log.info("Entering Country Name as Ind") sendCountry = confirmPage.getCountry() sendCountry.send_keys("Ind") #Explicit wait - Common in Base Class self.verifyLinkPresenceWait("India") confirmPage.getSelectedCountry().click() confirmPage.getClickCheckBox().click() confirmPage.getPurchaseButton().click() assert self.driver.find_element_by_xpath("//input[@id='checkbox2']").is_selected() ##Validate Text print(self.driver.find_element_by_xpath("//div[@class='alert alert-success alert-dismissible']").text) Sucess_Text = "Success! Thank you! Your order will be delivered in next few weeks :-)." log.info("Test received from Apllication is: "+Sucess_Text) log.info("Succesfull Shopping -- Happy to Serve you") assert "Success! Thank you" in Sucess_Text