示例#1
0
    def test_with_noData_input(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        actual_title = self.driver.title
        print("Title of page is Stripe Checkout Sample")

        self.Dt = Donate(self.driver)

        if actual_title == "Stripe Checkout Sample":
            assert True
        else:
            assert False
        print("Now click on Donate $5 button")
        self.Dt.ClickOnDonateButton()
        payment_page_title1 = self.driver.title
        print(payment_page_title1)

        print("user can fill card details now")
        self.cp = Pasha_page(self.driver)
        self.cp.Click_Pay()
        print("REQUIRED:Please enter Email ID")
        print("REQUIRED:Please enter CARD number")
        print("REQUIRED:Please enter Name")
        print("Failed,System not allow to proceed")
        self.driver.close()
    def test_positive_flow(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        actual_title = self.driver.title
        print("Title of page is Stripe Checkout Sample")

        self.Dt = Donate(self.driver)

        if actual_title == "Stripe Checkout Sample":
            assert True
        else:
            self.driver.save_screenshot(".\\Screenshots\\"+"test_Without_3D_secure_Verfication.png")
            assert False
        print("Now click on Donate $5 button")
        self.Dt.ClickOnDonateButton()
        payment_page_title1 = self.driver.title
        print(payment_page_title1)

        print("user can fill card details now")
        self.driver.find_element_by_xpath("//div//form//div//span/input[@id='email']").send_keys("*****@*****.**")
        self.cp = Pasha_page(self.driver)
        #self.cp.Enter_EmailID(self.email)
        self.cp.Enter_card_Number(self.cardNum)
        self.cp.Enter_ExpiryDate(self.expiryDate)
        self.cp.Enter_CVC(self.CVC)
        self.cp.Enter_Name(self.Name)
        self.cp.Click_Pay()
        self.cp.getMessage()
        if self.cp.message == "Your test payment succeeded":
            self.driver.save_screenshot(".\\Screenshots\\" + "test_Without_3D_secure_Verfication.png")
            print("payment done successfull,Screenshot captured")
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_Without_3D_secure_Verfication.png")
            print("Payment failed")
示例#3
0
    def test_3D_secure(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        actual_title = self.driver.title
        print("Title of page is Stripe Checkout Sample")

        self.Dt = Donate(self.driver)

        if actual_title == "Stripe Checkout Sample":
            assert True
        else:
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_3D_secure.png")
            assert False
        print("Now click on Donate $5 button")
        self.Dt.ClickOnDonateButton()
        payment_page_title1 = self.driver.title
        print(payment_page_title1)

        print("user can fill card details now")
        self.driver.find_element_by_xpath(
            "//div//input[@id='email']").send_keys("*****@*****.**")
        self.cp = Pasha_page(self.driver)
        # self.cp.Enter_EmailID(self.email)
        self.cp.Enter_card_Number(self.cardNum)
        self.cp.Enter_ExpiryDate(self.expiryDate)
        self.cp.Enter_CVC(self.CVC)
        self.cp.Enter_Name(self.Name)
        self.cp.Click_Pay()

        # {----AFTER PAY CLICK , UNABLE TO SWITCH TO IFRAME----,following are the further code..}

        # self.driver.find_element_by_css_selector("button#test-source-authorize-3ds").click()
        # iframe = self.driver.find_element_by_xpath("//iframe[@name='stripe-challenge-frame']")
        # self.driver.switch_to.frame(iframe)
        # print("switched to frame")

        # self.driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")
        # print("scrolled down")
        # self.button = self.driver.find_element_by_xpath("(//form[@class='ActionForm']//button)[2]")
        # print(self.button.is_displayed())
        # self.button.click()
        # print("clicked on complete button")
        # self.cp.getMessage()
        # if self.cp.message == "Your test payment succeeded":
        # self.driver.save_screenshot(".\\Screenshots\\" + "test_3D_secure.png")
        # print("3D Secure Payment Successful ,Screenshot captured")
        # else:
        # self.driver.save_screenshot(".\\Screenshots\\" + "test_3D_secure.png")
        # print("Payment failed")
        self.driver.close()
    def test_With_invalid_data(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        actual_title = self.driver.title
        print("Title of page is Stripe Checkout Sample")

        self.Dt = Donate(self.driver)

        if actual_title == "Stripe Checkout Sample":
            assert True

        else:
            assert False
        print("Now click on Donate $5 button")
        self.Dt.ClickOnDonateButton()
        payment_page_title1 = self.driver.title
        print(payment_page_title1)

        print("user can fill card details now")

        self.cp = Pasha_page(self.driver)
        self.cp.Enter_EmailID(self.email)
        print("error shown: 'Your email is incomplete.'")
        self.cp.Enter_card_Number(self.cardNum)
        print("error shown: 'Your card number is incomplete.'")
        self.driver.find_element_by_id(self.cp.CardNum_TF_ID).clear()
        self.cp.Enter_card_Number(self.Cnum)
        self.cp.Enter_ExpiryDate(self.expiryDate)
        print("error shown: 'Your card's expiration year is invalid.'")
        self.driver.find_element_by_xpath(self.cp.ExpireDate_TF_xpath).clear()
        self.cp.Enter_ExpiryDate(self.edate)
        self.cp.Enter_CVC(self.CVC)
        print("error shown: 'Your card's security code is incomplete.'")
        self.cp.Enter_Name(self.Name)
        self.cp.Click_Pay()
        if actual_title == "Stripe Checkout Sample":
            print("Above entered details are invalid")
            assert True
        else:
            assert False
        self.driver.close()
    def test_cancel_pay(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        actual_title = self.driver.title
        print("Title of page is Stripe Checkout Sample")

        self.Dt = Donate(self.driver)

        if actual_title == "Stripe Checkout Sample":
            assert True
        else:
            assert False
        print("Now click on Donate $5 button")
        self.Dt.ClickOnDonateButton()
        payment_page_title1 = self.driver.title
        print(payment_page_title1)
        print("user can fill card details now")
        self.driver.find_element_by_xpath(
            "//div//input[@id='email']").send_keys("*****@*****.**")
        self.cp = Pasha_page(self.driver)
        self.cp.Enter_card_Number(self.cardNum)
        self.cp.Enter_ExpiryDate(self.expiryDate)
        self.cp.Enter_CVC(self.CVC)
        self.cp.Enter_Name(self.Name)
        print("Click on back button")
        self.driver.find_element_by_xpath(
            "//div[@class='Header-merchantLogoContainer']//span").click()
        alert = Alert(self.driver)
        print(alert.text)
        alert.accept()
        self.cp.getMessage()
        if self.cp.message == "Your test payment was canceled":

            print("3D Secure Payment cancelled ")
        else:
            print("Failed to cancel payment")
        self.driver.close()
示例#6
0
class Test_01_Payment:
    baseURL = "https://stripe-samples.github.io/github-pages-stripe-checkout//"
    email = "*****@*****.**"
    cardNum = 4242424242424242
    expiryDate = 525
    CVC = 456
    Name = "Vidya"

    def test_positive_flow(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        actual_title = self.driver.title
        print("Title of page is Stripe Checkout Sample")

        self.Dt = Donate(self.driver)

        if actual_title == "Stripe Checkout Sample":
            assert True
        else:
            assert False
        print("Now click on Donate $5 button")
        self.Dt.ClickOnDonateButton()
        payment_page_title1 = self.driver.title
        print(payment_page_title1)

        print("user can fill card details now")
        self.driver.find_element_by_xpath(
            "//div//form//div//span/input[@id='email']").send_keys(
                "*****@*****.**")
        self.cp = Pasha_page(self.driver)
        # self.cp.Enter_EmailID(self.email)
        self.cp.Enter_card_Number(self.cardNum)
        self.cp.Enter_ExpiryDate(self.expiryDate)
        self.cp.Enter_CVC(self.CVC)
        self.cp.Enter_Name(self.Name)
        self.cp.Click_Pay()
        self.cp.getMessage()
        if self.cp.message == "Your test payment succeeded":
            print("payment done successfull,Screenshot captured")
        else:
            print("Payment failed")

        self.driver.find_element_by_xpath(
            "//a[@class='sr-header__logo']").click()
        print("Returned to home page")
        self.driver.close()
示例#7
0
class Test_02_Payment:
    baseURL = "https://stripe-samples.github.io/github-pages-stripe-checkout//"
    email = "vishesham@"
    cardNum = "4000000000003QQQ"
    Cnum = '4242424242424242'
    expiryDate = 1199
    edate = "1025"
    CVC = 40
    Name = "Vish000000000003QQQesh"

    def test_With_invalid_data(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        actual_title = self.driver.title
        print("Title of page is Stripe Checkout Sample")

        self.Dt = Donate(self.driver)

        if actual_title == "Stripe Checkout Sample":
            assert True
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_With_invalid_data.png")
            assert False
        print("Now click on Donate $5 button")
        self.Dt.ClickOnDonateButton()
        payment_page_title1 = self.driver.title
        print(payment_page_title1)

        print("user can fill card details now")

        self.cp = Pasha_page(self.driver)
        self.cp.Enter_EmailID(self.email)
        if self.cp.checkEmailError():
            print("error shown: 'Your email is incomplete.'")
        else:
            print("Email validation not available")
        self.cp.Enter_card_Number(self.cardNum)
        if self.cp.checkCardError():
            print("error shown: 'Your card number is incomplete.'")
        else:
            print("Card validation not available")
        self.driver.find_element_by_id(self.cp.CardNum_TF_ID).clear()
        self.cp.Enter_card_Number(self.Cnum)

        self.cp.Enter_ExpiryDate(self.expiryDate)
        if self.driver.find_element_by_xpath("(//div//span[@role='alert'])[1]").is_displayed():
            print("error shown: 'Your card's expiration year is invalid.'")
        else:
            print("Your card's expiration validation not available")
        self.driver.find_element_by_xpath(self.cp.ExpireDate_TF_xpath).clear()
        self.cp.Enter_ExpiryDate(self.edate)

        self.cp.Enter_CVC(self.CVC)
        if self.cp.checkCVCError():
            print("error shown: 'Your card's security code is incomplete.'")
        else:
            print("Your card's security code validation not available")

        self.cp.Enter_Name(self.Name)
        self.cp.Click_Pay()

        if self.cp.checkCVCError():
            print("error shown: 'Your card's security code is incomplete.'")

        else:
            print("Your card's security code validation not available")

        self.cp.Click_Pay()
        if self.cp.getMessage().is_displayed():
            print("validation failed")
        else:
            print("validation successful ,Test passed ")
            self.driver.save_screenshot(".\\Screenshots\\" + "test_With_invalid_data.png")