コード例 #1
0
    def test_e2e(self):
        log = self.getLogger()
        homePage = HomePage(self.driver)
        homePage.shopItems()
        log.info("getting all the card titles")
        checkoutPage = CheckoutPage(self.driver)
        cards = checkoutPage.getCardTitles()
        cardName = checkoutPage.getCardName()
        cardButton = checkoutPage.getCardButton()

        for card in cards:
            productName = card.text
            log.info(productName)
            if productName == "Blackberry":
                cardButton.click()

        self.driver.find_element_by_css_selector(
            "a[class*='btn-primary']").click()
        self.driver.find_element_by_xpath(
            "//button[@class='btn btn-success']").click()
        log.info("Entering country name as ind")
        self.driver.find_element_by_id("country").send_keys("ind")
        self.verifyLinkPresence("India")
        self.driver.find_element_by_link_text("India").click()
        self.driver.find_element_by_xpath(
            "//div[@class='checkbox checkbox-primary']").click()
        self.driver.find_element_by_css_selector(
            "input[type='submit']").click()
        success = self.driver.find_element_by_class_name("alert-success").text
        log.info("Text received from application is" + success)
        assert "Success! Thank you!" in success

        self.driver.get_screenshot_as_file("screen.png")
コード例 #2
0
    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
コード例 #3
0
 def test_e2e(self):
     home_page_obj = HomePage(self.driver)
     shop_page_obj = ShopPage(self.driver)
     check_out_page_obj = CheckoutPage(self.driver)
     delivery_page_obj = DeliveryPage(self.driver)
     log = self.get_logger()
     home_page_obj.click_shop()
     log.info("Clicking Shop Link Successfully")
     shop_page_obj.select_desired_product("BlackBerry")
     log.info("Selecting BlakBerry")
     shop_page_obj.click_checkout_btn()
     check_out_page_obj.confirm_checkout()
     delivery_page_obj.select_delivery_country()
     delivery_page_obj.agree_terms_with_app()
     delivery_page_obj.submit_purchase()
     assert "Success! Thank you!" in delivery_page_obj.get_success_message()
     log.info("first Test Case passed successfully")
コード例 #4
0
ファイル: test_e2e.py プロジェクト: capstesting/Repo5
    def test_e2e(self):
        log = self.getLogger()
        homepage = HomePage(self.driver)
        log.info("Application started")
        homepage.shopItems().click()
        log.info("Shops Page started")

        checkout = CheckoutPage(self.driver)
        cards = checkout.cardTitles()
        log.info("Cards Selected")
        log.info(len(cards))
        i = -1
        for card in cards:
            i = i + 1
            cardText = card.text
            if cardText == "Blackberry":
                checkout.addProduct()[i].click()
        checkout.checkOut().click()

        confirmPage = ConfirmPage(self.driver)
        confirmPage.CartPage()
        confirmPage.CountrySelect().send_keys("ind")
        self.verifyLinkPresence("India", 7)
        self.driver.find_element_by_link_text("India").click()
        confirmPage.CheckBoxTerms()
        confirmPage.submitButton()
        successText = self.driver.find_element_by_class_name(
            "alert-success").text

        assert "Success! Thank you!" in successText
コード例 #5
0
    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
コード例 #6
0
    def test_checkout(self):
        log = self.getLogger()
        log.info("Checkout Page:")
        homepage = HomePage(self.driver)
        checkout = CheckoutPage(self.driver)
        items = homepage.getCartItems()
        log.info("Adding items to the basket...")


        for i in range(1, 3):
            items[i].click()
            time.sleep(1)


        homepage.getCheckoutButton().click()
        log.info("Clicking checkot button...")
        self.verifyLinkPresenceByTag("bdi")

        prices = checkout.getPrices()

        capturedPrices = []
        for i in prices:
            capturedPrices.append(i.text.replace("₪", ""))
        finalPrices = [float(i) for i in capturedPrices]
        pricesList = ",".join(capturedPrices)
        log.info("Prices: " + pricesList)
        discount = 0
        if (sum(finalPrices[0:-1]) == finalPrices[-1]):
            discount = 0
            log.info("Final Price: " + str(finalPrices[-1]))
            log.info("Discount Is: " + str(discount))

        elif (sum(finalPrices[0:-2]) == finalPrices[-2]):
            discount = finalPrices[-2] - finalPrices[-1]
            log.info("Price Before Discount: " + str(finalPrices[-2]))
            log.info("Discount Is: " + str(discount))
            log.info("Prices After Discount: " + str(finalPrices[-1]))
    def test_e2e(self):
        # on creating HomePage driver object the HomePage.py constructor will be invoked
        homePage = HomePage(self.driver)

        homePage.shopItems().click()

        checkoutPage = CheckoutPage(self.driver)

        cards = checkoutPage.getCardTitles()

        confirmPage = ConfirmPage(self.driver)

        i = -1
        for card in cards:
            i = i + 1
            cardText = card.text
            print(cardText)
            if cardText == "Blackberry":
                checkoutPage.getCardFooter()[i].click()

        checkoutPage.confirmCheckoutButton().click()

        checkoutPage.checkOutItems().click()

        confirmPage.fillCountryField().send_keys("ind")

        element = WebDriverWait(self.driver, 10).until(
            expected_conditions.presence_of_element_located((By.LINK_TEXT, "India")))

        confirmPage.chooseCountry().click()

        confirmPage.fillAgreement().click()

        confirmPage.confirmPurchase().click()

        textMatch = confirmPage.confirmGetText().text

        assert ("Success! Thank you!" in textMatch)
コード例 #8
0
 def test_shop_items(self):
     log = self.getlogger()
     log.info("getting all card titles")
     checkout = CheckoutPage(self.driver)
     products = checkout.checkout()
     for product in products:
         productname = product.text
         log.info(productname)
         if productname == "Blackberry":
             checkout.addtocart()
     checkout.checkoutbtn()
     confirmpage = checkout.checkoutsuccessbtn()
     log.info("Entering country name as IND")
     confirmpage.getcountry("Ind")
     self.verifyelementpresence("India")
     confirmpage.selectcountry()
     confirmpage.checkboxbtn()
     confirmpage.getpurchasebtn()
     log.info("Text recieved from application is" +
              confirmpage.get_successmsg())
     assert "Thank you! Yourhjsdahashsahjsadk" in confirmpage.get_successmsg(
     )
コード例 #9
0
 def userinfo_continuebutton(self):
     self.driver.find_element(*ProductPage.userinfocontiuebutton).click()
     Checkout_Page = CheckoutPage(self.driver)
     return Checkout_Page
コード例 #10
0
ファイル: ShopPage.py プロジェクト: ivernik/selenium_demo
 def checkout(self):
     self.driver.find_element(*ShopPage.checkout_button).click()
     checkout_page = CheckoutPage(self.driver)
     return checkout_page
コード例 #11
0
 def shopItems(self):
     self.driver.find_element(*HomePage.shop).click()
     checkOutPage = CheckoutPage(self.driver)
     return checkOutPage
コード例 #12
0
 def shopItems(self):
     self.driver.find_element(*HomePage.shop).click(
     )  #Class variable, to access have to refer to class name.variable name AND * to deserialzes shop variable value else it will not work
     checkoutPage = CheckoutPage(self.driver)
     return checkoutPage
コード例 #13
0
 def getCheckoutButton(self):
     self.driver.find_element(*ShopPage.checkoutButton).click()
     confirm_checkout_page = CheckoutPage(self.driver)
     return confirm_checkout_page
コード例 #14
0
 def shop_items(self):
     self.driver.find_element(
         *HomePage.shop).click()  # use * to de-serialize the tuple
     # driver.find_element_by_css_selector("a[href*='shop']")
     checkout_page = CheckoutPage(self.driver)
     return checkout_page
コード例 #15
0
 def getCheckout(self):
     self.driver.find_element(*ShopPage.checkout).click()
     checkoutPage = CheckoutPage(self.driver)
     return checkoutPage
コード例 #16
0
 def shopItems(self):
     self.driver.find_element(*HomePage.shop).click(
     )  # self.driver.find_element_by_css_selector("a[href*='shop']")
     checkoutPage = CheckoutPage(self.driver)
     return checkoutPage
コード例 #17
0
 def click_shop_button(self):
     self.dr.find_element(*HomePage.shop).click()
     checkout_Page = CheckoutPage(self.dr)
     return checkout_Page
コード例 #18
0
 def continueoption(self):
     self.driver.find_element(*ConfirmPage.Continue).click()
     checkoutpage = CheckoutPage(self.driver)
     return checkoutpage
コード例 #19
0
 def shopItems(self):
     self.driver.find_element(*HomePage.shop).click()
     checkoutPage = CheckoutPage(
         self.driver
     )  # by creating next page object in home page - we can avoid each page object creation in tests
     return checkoutPage