当前位置: 首页>>代码示例>>Python>>正文


Python Cart.verifygrandtotal方法代码示例

本文整理汇总了Python中cart.Cart.verifygrandtotal方法的典型用法代码示例。如果您正苦于以下问题:Python Cart.verifygrandtotal方法的具体用法?Python Cart.verifygrandtotal怎么用?Python Cart.verifygrandtotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cart.Cart的用法示例。


在下文中一共展示了Cart.verifygrandtotal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Test23andMeWebsite

# 需要导入模块: from cart import Cart [as 别名]
# 或者: from cart.Cart import verifygrandtotal [as 别名]
class Test23andMeWebsite(unittest.TestCase):
    @classmethod
    def setUp(self):
        self.driver = webdriver.Chrome('/Users/User1/Downloads/chromedriver')
        self.driver.get('http://store.23andme.com/en-us/')
        time.sleep(5)

        formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')

        # debug log
        self.debugLogger = logging.getLogger('debuglogger')
        debug_handler = logging.FileHandler('debug.log')
        debug_handler.setFormatter(formatter)
        self.debugLogger.addHandler(debug_handler)

        # info log
        self.infoLogger = logging.getLogger('infologger')
        info_handler = logging.FileHandler('info.log')
        info_handler.setFormatter(formatter)
        self.infoLogger.addHandler(info_handler)

        # error log
        self.errLogger = logging.getLogger('errlogger')
        err_handler = logging.FileHandler('err.log')
        err_handler.setFormatter(formatter)
        self.errLogger.addHandler(err_handler)

        self.cartInst = Cart(self.driver)
        self.billInst = Billing(self.driver)
        self.shipInst = Shipping(self.driver)
        self.verifyAddyInst = VerifyAddy(self.driver)
        self.driver.save_screenshot('setup.png')

    """ Check if the cart is empty or not """
    def testWebsiteFunc(self):
        print('testwebsitefunc')
        try:
            WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.LINK_TEXT, 'Add a kit.')))
            addkitlink = self.driver.find_element_by_link_text('Add a kit.')
            if addkitlink:
                print('CART EMPTY')
                addkitlink.click()
                self.cartInst.additemstocart(5)
                self.cartInst.sendkitnames()
                self.cartInst.verifysubtotal()
                self.cartInst.verifysavings()
                self.cartInst.verifygrandtotal()
                self.cartInst.verifycontbtn()
                self.shipInst.fillOutForm()
                assert 'verifyaddress' in self.driver.current_url
                self.verifyAddyInst.verifyContent()
                assert 'payment' in self.driver.current_url
                self.billInst.verifyContent()
            else:
                print('CART NOT EMPTY')
                self.cartInst.sendkitnames()
                self.cartInst.verifysubtotal()
                self.cartInst.verifysavings()
                self.cartInst.verifygrandtotal()
                self.cartInst.verifycontbtn()
                self.shipInst.fillOutForm()
                assert 'verifyaddress' in self.driver.current_url
                self.verifyAddyInst.verifyContent()
                assert 'payment' in self.driver.current_url
                self.billInst.verifyContent()
        except TimeoutException as te:
            self.errLogger.error(te.message)
            self.errLogger.error(te.stacktrace)
        except ElementNotVisibleException as enve:
            self.errLogger.error(enve.message)
            self.errLogger.error(enve.stacktrace)
        finally:
            self.debugLogger.debug(self.driver.session_id)
            self.driver.save_screenshot('testwebsitefunc.png')

    @classmethod
    def tearDown(self):
        self.driver.save_screenshot('teardown.png')
        self.driver.quit()
开发者ID:btamada,项目名称:23andMe,代码行数:81,代码来源:checkout.py


注:本文中的cart.Cart.verifygrandtotal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。