Ejemplo n.º 1
0
    def test_e2e(self, getData):
        log = logging.getlogger()
        log.info("get home page")
        homepage = HomePgae(self.driver)
        homepage.load_url()
        homepage.myname().send_keys(
            getData["firstName"])  # Send Send Values from dictionary Option 1
        homepage.enter_my_email().send_keys(
            getData["lastName"])  # Send Send Values from dictionary Option 1
        # homepage.myname().send_keys(getData[0])  # Send Values from tuple Option 2
        # homepage.enter_my_email().send_keys(getData[1])  # Send Values from tuple Option 2
        homepage.example_Check1()
        self.selectOptionByText(
            homepage.list_box(),
            getData["Gender"])  # Send Send Values from dictionary Option 1
        # self.selectOptionByText(homepage.list_box(), getData[2])  # Send Values from tuple Option 2
        homepage.btn_success()
        homepage.shopItem()

        Check_Out_Page = CheckOutPage(self.driver)
        All_products = Check_Out_Page.getProductNumber()
        Check_Out_Page.find_prod(All_products)
        Check_Out_Page.Check_out_Button1()
        Check_Out_Page.CheckoutBtnSucsees()
        #
        #       ProtoCommerce Page - IND Page
        confirm_page = ConfirmPage(self.driver)
        confirm_page.SelectCuntry().send_keys("ind")
        self.verifyLinkPresence("India")  # take from Baas class
        confirm_page.ClickOn_Select_Cuntry()
        confirm_page.clickonCheck_box()
        confirm_page.PurchaseClick()
        SuccessText = confirm_page.Success_Text()
        assert "Success! Thank you!" in SuccessText
        self.driver.refresh()
Ejemplo n.º 2
0
    def test_e2e(self):
        homepage = HomePage(self.driver)

        checkout_page = homepage.shop_items(
        )  # Smart way of optimizing as this will return an object of CheckoutPage Class

        products = checkout_page.get_product_titles()

        confirmpage = ConfirmPage(self.driver)

        for product in products:
            name = product.find_element_by_xpath("div/div/h4/a").text
            print(name)
            if name == "iphone X":
                product.find_element_by_xpath("div/div/button").click()

        # Clicking Checkout button
        checkout_page.checkout().click()

        selected_product = confirmpage.select_product().text

        assert selected_product == "iphone X"

        confirmpage.success().click()

        confirmpage.country().send_keys("ind")

        wait = WebDriverWait(self.driver, 7)

        wait.until(
            expected_conditions.presence_of_element_located(
                (By.LINK_TEXT, "India")))

        self.driver.find_element_by_link_text("India").click()

        checkbox = self.driver.find_element_by_xpath(
            "//div[@class='checkbox checkbox-primary']")
        checkbox.click()
        # assert checkbox.is_selected()

        self.driver.find_element_by_xpath("//input[@value='Purchase']").click()

        var = self.driver.find_element_by_class_name("alert-success")
        end_text = var.text

        print(end_text)
        assert "Success" in end_text

        self.driver.save_screenshot("screen.png")
Ejemplo n.º 3
0
 def CheckoutItems(self):
     self.driver.find_element(*CheckoutPage.btnCheckout).click()
     confirmPage = ConfirmPage(self.driver)
     return confirmPage
Ejemplo n.º 4
0
 def getcheckoutbutton(self):
     self.driver.find_element(*CheckOutPage.checkout_button).click()
     confirmpage = ConfirmPage(self.driver)
     return confirmpage
Ejemplo n.º 5
0
 def getFinalCheckout(self):
     self.driver.find_element(*CheckOutPage.finalCheckOut).click()
     confirmPage = ConfirmPage(self.driver)
     return confirmPage
Ejemplo n.º 6
0
 def purchaseButton(self):
     self.driver.find_element(*Checkout.purchasebutton).click()
     confirmPage = ConfirmPage(self.driver)
     return confirmPage
Ejemplo n.º 7
0
 def click_checkout(self):
     self.driver.find_element(*CheckoutPage.checkout_button).click()
     return ConfirmPage(self.driver)
Ejemplo n.º 8
0
 def CheckOutItems(self):
     self.driver.find_element(*CheckOutPage.chceckOutButton).click()
     confirmPage = ConfirmPage(self.driver)
     return confirmPage
Ejemplo n.º 9
0
 def get_final_checkout_button(self):
     self.driver.find_element(*CheckOutPage.final_checkout_button).click()
     confirmPageObj = ConfirmPage(self.driver)
     return confirmPageObj