def test_e2e_functionality(self):
     home_page = HomePage(self.driver)
     search_page = SearchPage(self.driver)
     home_page.get_search_box().send_keys("laptop")
     home_page.get_search_icon().click()
     assert "laptop" in search_page.get_first_item_text_element(
     ).text.lower()
     assert "laptop" in search_page.get_searched_text().text
예제 #2
0
 def test_search_existing_product(self):
     product = "dress"
     self.browser.get('http://automationpractice.com/index.php')
     self.assertIn('My Store', self.browser.title)
     home_page = HomePage(self.browser)
     home_page.search_product(product)
     home_page.search_button()
     search_results = SearchPage(self.browser)
     res = search_results.product_found()
     self.assertTrue(res)
예제 #3
0
 def setUpClass(cls):
     # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe"
     cls.driver = webdriver.Chrome(executable_path=chromedriver)
     cls.driver.implicitly_wait(5)  # 隐式等待
     cls.url = test_url
     cls.username = username
     cls.password = "******"
     cls.public_page = PublicMethod(cls.driver, cls.url,
                                    u"合纵易购搜索界面")  # 声明PublicMethod类对象
     cls.home_page = HomePage(cls.driver, cls.url,
                              u"合纵易购搜索界面")  # 声明homePage类对象
     cls.cart_page = CartPage(cls.driver, cls.url,
                              u"合纵易购搜索界面")  # 声明cartPage类对象
     cls.categories_page = CategoriesPage(
         cls.driver, cls.url, u"合纵易购搜索界面")  # 声明categoriesPage类对象
     cls.puyao_page = PuYaoPage(cls.driver, cls.url,
                                u"合纵易购搜索界面")  # 声明puyaoPage类对象
     cls.settle_page = SettlePage(cls.driver, cls.url,
                                  u"合纵易购搜索界面")  # 声明settlePage类对象
     cls.goodsdetail_page = GoodsDetailPage(
         cls.driver, cls.url, u"合纵易购搜索界面")  # 声明goodsDetailPage类对象
     cls.search_page = SearchPage(cls.driver, cls.url,
                                  u"合纵易购搜索界面")  # 声明SearchPage类对象
     cls.public_page.get_url(cls.url)
     cls.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
     cls.public_page.login(cls.username, cls.password)
     cls.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
예제 #4
0
 def verify_user(self, should_see, email, test_rc, error):
     SearchPage(self.driver).find_user_basic(test_rc)
     if should_see:
         assert "employee-card" in self.driver.current_url, error % (
             email, test_rc)
     else:
         assert "employee-card" not in self.driver.current_url, error % (
             email, test_rc)
예제 #5
0
 def test_search_existing_product_and_register_user(self):
     product = "dress"
     user_information = PersonalInformation(email="*****@*****.**",
                                            first_name="John",
                                            last_name="Doe",
                                            password="******")
     user_address = Address(address="4374  Traders Alley",
                            city="Kansas City",
                            state="Missouri",
                            postal_code="64106",
                            phone_mobile="8164465964")
     self.browser.get('http://automationpractice.com/index.php')
     self.assertIn('My Store', self.browser.title)
     home_page = HomePage(self.browser)
     home_page.search_product(product)
     home_page.search_button()
     search_results = SearchPage(self.browser)
     res = search_results.product_found()
     self.assertTrue(res)
     search_results.select_list_view()
     search_results.add_to_cart_first_product_found()
     cart = ShoppingCartPopupPage(self.browser)
     cart.proceed_to_checkout()
     cart_summary = ShoppingCartSummary(self.browser)
     cart_summary.proceed_to_checkout()
     authentication = Authentication(self.browser)
     authentication.create_an_account(user_information.email)
     c = CreateAccount(self.browser)
     c.register(user_information=user_information, address=user_address)
예제 #6
0
 def test_search_existing_product_sign_in_existing_user_not_tos(self):
     product = "dress"
     user_information = PersonalInformation(email="*****@*****.**",
                                            first_name="John",
                                            last_name="Doe",
                                            password="******")
     self.browser.get('http://automationpractice.com/index.php')
     self.assertIn('My Store', self.browser.title)
     home_page = HomePage(self.browser)
     home_page.sign_in()
     home_page.search_product(product)
     home_page.search_button()
     search_results = SearchPage(self.browser)
     res = search_results.product_found()
     self.assertTrue(res)
     search_results.select_list_view()
     search_results.add_to_cart_first_product_found()
     cart = ShoppingCartPopupPage(self.browser)
     cart.proceed_to_checkout()
     cart_summary = ShoppingCartSummary(self.browser)
     cart_summary.proceed_to_checkout()
     authentication = Authentication(self.browser)
     authentication.sign_in(user=user_information)
     addresses = Addresses(self.browser)
     addresses.proceed_to_checkout()
     shipping = Shipping(self.browser)
     shipping.proceed_to_checkout()
     self.assertTrue(shipping.tos_not_selected())
 def test_e2e_functionality(self):
     home_page = HomePage(self.driver)
     search_page = SearchPage(self.driver)
     product_page = ProductPage(self.driver)
     home_page.get_search_box().send_keys("laptop")
     home_page.get_search_icon().click()
     search_page.get_first_item_price_element().click()
     main_window = self.driver.window_handles[0]
     child_window = self.driver.window_handles[1]
     self.driver.switch_to.window(child_window)
     assert product_page.get_add_to_card_button().is_displayed()
     assert product_page.get_buy_now_button().is_displayed()
     assert "buy now" in product_page.get_buy_now_button(
     ).find_element_by_xpath("parent::span/span").text.lower()
     assert "add to cart" in product_page.get_add_to_card_button(
     ).get_attribute('value').lower()
     self.driver.close()
     self.driver.switch_to.window(main_window)
def test_google_search(browser):
    search_page = SearchPage(browser)
    search_page.go_to_site()
    search_page.set_search_field("markets")
    search_result_page = SearchResultPage(browser)
    assert 10 == len(search_result_page.get_search_results())
    search_result_page.click_on_second_link()
    assert browser.title == "Markets: Indexes, Bonds, Forex, Key Commodities, ETFs"
예제 #9
0
 def setUp(self):
     # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe"
     self.driver = webdriver.Chrome(executable_path=chromedriver)
     self.url = test_url
     self.public_page = PublicMethod(self.driver, self.url,
                                     u"合纵药易购订单界面")  # 声明publicMethod类对象
     self.categories_page = CategoriesPage(
         self.driver, self.url, u"合纵药易购订单界面")  # 声明categoriesPage类对象
     self.home_page = HomePage(self.driver, self.url,
                               u"合纵药易购订单界面")  # 声明homepage类对象
     self.puyao_page = PuYaoPage(self.driver, self.url,
                                 u"合纵药易购订单界面")  # 声明puyaopage类对象
     self.jpzq_page = JingPinZhuanQuPage(
         self.driver, self.url, u"合纵药易购订单界面")  # 声明jingpinzhuanqu类对象
     self.settle_page = SettlePage(self.driver, self.url,
                                   u"合纵药易购订单界面")  # 声明settlepage类对象
     self.cart_page = CartPage(self.driver, self.url,
                               u"合纵药易购订单界面")  # 声明cartpage类对象
     self.order_page = OrderPage(self.driver, self.url,
                                 u"合纵药易购订单界面")  # 声明orderpage类对象
     self.zhongyao_page = ZhongYaoPage(self.driver, self.url,
                                       u"合纵药易购订单界面")  # 声明zhongyaoPage类对象
     self.goodsDetail_Page = GoodsDetailPage(
         self.driver, self.url, u"合纵药易购订单界面")  # 声明GoodsDetailPage类对象
     self.search_page = SearchPage(self.driver, self.url,
                                   u"合纵药易购订单界面")  # 声明SearchPage类对象
     self.driver.implicitly_wait(5)
     self.ssnr = "阿胶"
     self.username = username
     self.password = "******"
     self.ddbz = "订单备注"
     self.shuliang = 20
     self.public_page.get_url(self.url)
     self.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
     self.public_page.login(self.username, self.password)
     self.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
예제 #10
0
def test_SearchWithFilters():
    LandingPage().setUp()
    LandingPage().inputCityName(city='Lake Forest, CA')
    LandingPage().submitSearchCityName(
        XPATH_var='//a[@href="/city/10039/CA/Lake-Forest"]')
    time.sleep(3)
    SearchPage().clickFilter()
    SearchPage().selectHouseFilter()
    SearchPage().selectBathFilter()
    SearchPage().selectOpenHouseFilter()
    SearchPage().clickApplyFilters()
    SearchPage().verifyFiltersHouseBathOpenHouse()
    BasePage().teardown()
예제 #11
0
 def test_case01(self, quit_driver, data):
     '''
     搜索测试
     '''
     sp = SearchPage()
     # sp.test_search(keyword=sp.get_excel_datas()[0]['操作输入值'])
     # assert sp.op_title() == sp.get_excel_datas()[0]['断言']
     log.info(ed.get_excel_datas())
     log.info(el.get_ids())
     log.info(data['操作输入值'])
     sp.test_search(keyword=data['操作输入值'])
     assert sp.op_title() == data['断言']
     log.info(sp.op_title())
예제 #12
0
    def testSearch(self):
        driver = self.driver
        # 百度网址
        url = u"http://www.baidu.com"
        # 搜索文本
        text = u"开源优测"
        # 期望验证的标题
        assert_title = u"开源优测_百度搜索"
        print(assert_title)

        searchPage = SearchPage(driver, url)

        # 启动浏览器,访问百度首页
        searchPage.goto_baidu_homepage()

        # 输入 搜索词
        searchPage.input_search_text(text)

        # 单击 百度一下 按钮进行搜索
        searchPage.click_search_btn()

        # 验证标题
        self.assertEqual(assert_title, u"开源优测_百度搜索")
예제 #13
0
 def test_product_correctly_inserted_into_cart_user_not_signed_in(self):
     product = "dress"
     p = Product(name="Printed Summer Dress",
                 sku="demo_5",
                 color="Yellow",
                 size="S")
     self.browser.get('http://automationpractice.com/index.php')
     self.assertIn('My Store', self.browser.title)
     home_page = HomePage(self.browser)
     home_page.sign_in()
     home_page.search_product(product)
     home_page.search_button()
     search_results = SearchPage(self.browser)
     res = search_results.product_found()
     self.assertTrue(res)
     search_results.select_list_view()
     search_results.add_to_cart_first_product_found()
     cart = ShoppingCartPopupPage(self.browser)
     cart.proceed_to_checkout()
     cart_summary = ShoppingCartSummary(self.browser)
     self.assertTrue(cart_summary.product_correctly_inserted(p))
예제 #14
0
 def login_as_user(self, email):
     SearchPage(self.driver).find_user(email)
     self.driver.find_element(*OtherLocators.link_login_as_employee).click()
     assert "employee-card" in self.driver.current_url, "Nepovedlo se přihlásit jako zaměstnanec " + email
예제 #15
0
class TestOrderProcess(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        pass

    def setUp(self):
        # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe"
        self.driver = webdriver.Chrome(executable_path=chromedriver)
        self.url = test_url
        self.public_page = PublicMethod(self.driver, self.url,
                                        u"合纵药易购订单界面")  # 声明publicMethod类对象
        self.categories_page = CategoriesPage(
            self.driver, self.url, u"合纵药易购订单界面")  # 声明categoriesPage类对象
        self.home_page = HomePage(self.driver, self.url,
                                  u"合纵药易购订单界面")  # 声明homepage类对象
        self.puyao_page = PuYaoPage(self.driver, self.url,
                                    u"合纵药易购订单界面")  # 声明puyaopage类对象
        self.jpzq_page = JingPinZhuanQuPage(
            self.driver, self.url, u"合纵药易购订单界面")  # 声明jingpinzhuanqu类对象
        self.settle_page = SettlePage(self.driver, self.url,
                                      u"合纵药易购订单界面")  # 声明settlepage类对象
        self.cart_page = CartPage(self.driver, self.url,
                                  u"合纵药易购订单界面")  # 声明cartpage类对象
        self.order_page = OrderPage(self.driver, self.url,
                                    u"合纵药易购订单界面")  # 声明orderpage类对象
        self.zhongyao_page = ZhongYaoPage(self.driver, self.url,
                                          u"合纵药易购订单界面")  # 声明zhongyaoPage类对象
        self.goodsDetail_Page = GoodsDetailPage(
            self.driver, self.url, u"合纵药易购订单界面")  # 声明GoodsDetailPage类对象
        self.search_page = SearchPage(self.driver, self.url,
                                      u"合纵药易购订单界面")  # 声明SearchPage类对象
        self.driver.implicitly_wait(5)
        self.ssnr = "阿胶"
        self.username = username
        self.password = "******"
        self.ddbz = "订单备注"
        self.shuliang = 20
        self.public_page.get_url(self.url)
        self.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
        self.public_page.login(self.username, self.password)
        self.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭

    def tearDown(self):
        self.driver.quit()
        sleep(2)

    @classmethod
    def tearDownClass(cls):
        # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe"
        # cls.driver = webdriver.Chrome(executable_path=chromedriver)
        # cls.driver.quit()
        pass

    def test_OrderProcess_01(self):
        """测试下单前检查清除购物车商品"""
        sleep(1)
        self.categories_page.click_py()  # 点击进入普药列表
        sleep(2)
        self.home_page.click_gwc()  # 进入购物车界面
        sleep(1)
        self.cart_page.is_scsp_exist()  # 判断是否存在商品
        sleep(1)
        self.driver.back()  # 返回首页
        sleep(1)
        self.public_page.is_element_exist()  # 判断广告也是否弹出,弹出自动关闭

    def test_OrderProcess_02(self):
        """在普药中选择商品进行下单"""
        sleep(2)
        self.categories_page.click_py()  # 点击普药进入普药列表
        sleep(0.5)
        for i in range(3):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 点击第一个商品加入购物车
        sleep(2)
        self.home_page.click_gwc()  # 进入购物车界面
        for i in range(3):
            sleep(1)
            self.cart_page.input_number1(self.shuliang, i)
        sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        sleep(1)
        self.public_page.click_tckLeft()  # 结算后的提示框点击
        sleep(1)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(1)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_03(self):
        """在精品专区中选择商品进行下单"""
        sleep(2)
        self.categories_page.click_jpzq()  # 点击精品专区进入精品列表
        for i in range(3):
            sleep(2)
            self.jpzq_page.click_addcart(i)  # 输入第一个商品加入购物车
        sleep(1)
        self.home_page.click_gwc()  # 进入购物车界面
        sleep(2)
        for i in range(3):
            sleep(1)
            self.cart_page.input_number1(self.shuliang, i)
        sleep(0.5)
        self.cart_page.click_jiage()
        sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_04(self):
        """在中药专区选择商品进行下单"""
        sleep(1)
        self.categories_page.click_zyzq()  # 点击进入中药专区
        sleep(1)
        self.zhongyao_page.click_ljqg(0)  # 点击第一个商品立即抢购
        sleep(1)
        self.public_page.switch_secendPage()  # 句柄切换到第二页中
        sleep(1)
        self.goodsDetail_Page.click_jrgwc()  # 点击加入购物车
        sleep(1)
        self.driver.close()  # 退出商品详情页面
        sleep(1)
        self.public_page.switch_home()  # 句柄切换到首页
        sleep(1)
        self.zhongyao_page.click_ljqg(1)  # 点击第二个商品立即抢购
        sleep(1)
        self.public_page.switch_secendPage()  # 句柄切换到第二页
        sleep(1)
        self.goodsDetail_Page.click_jrgwc()  # 点击加入购物车
        sleep(1)
        self.goodsDetail_Page.click_gwc()  # 点击购物车按钮
        for i in range(2):
            sleep(1)
            self.cart_page.input_number1(self.shuliang, i)  # 输入第一个商品的数量
        sleep(1)
        self.cart_page.click_jiage()
        sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_05(self):
        """呼吸系统用药商品下单"""
        sleep(2)
        self.categories_page.click_qbspfl(0)  # 点击进入呼吸系统分类选择
        sleep(0.5)
        self.categories_page.click_list1_1()  # 点击进入抗感冒类界面
        sleep(1)
        self.public_page.switch_secendPage()  # 句柄切换到第二页上
        for i in range(2):
            sleep(0.5)
            self.puyao_page.click_addcart(i)  # 商品1加入购物车
        sleep(2)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(0.5)
        self.cart_page.input_number1(self.shuliang, 0)  # 输入第一个商品的数量
        sleep(2)
        self.cart_page.input_number1(self.shuliang, 1)  # 输入第二个商品的数量
        sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_06(self):
        """清热消炎商品下单"""
        sleep(0.5)
        self.categories_page.click_qbspfl(1)  # 点击进入呼吸系统分类选择
        sleep(0.5)
        self.categories_page.click_list2_1()  # 点击进入抗感冒类界面
        sleep(0.5)
        self.public_page.switch_secendPage()  # 句柄切换到第二页上
        for i in range(3):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 商品1加入购物车
        sleep(5)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        for i in range(3):
            sleep(1)
            self.cart_page.input_number1(self.shuliang, i)  # 给一二三个商品添加数量
        sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_07(self):
        """五官皮肤及外用商品下单"""
        sleep(0.5)
        self.categories_page.click_qbspfl(2)  # 点击进入呼吸系统分类选择
        sleep(0.5)
        self.categories_page.click_list3_1()  # 点击进入抗感冒类界面
        sleep(0.5)
        self.public_page.switch_secendPage()  # 句柄切换到第二页上
        for i in range(3):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 商品1加入购物车
        sleep(2)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(1)
        for i in range(2):
            self.cart_page.input_number1(self.shuliang, 0)  # 调用给第一个商品输入数量
            sleep(2)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_08(self):
        """补益安神及维矿类商品下单"""
        sleep(0.5)
        self.categories_page.click_qbspfl(4)  # 点击进入呼吸系统分类选择
        sleep(0.5)
        self.categories_page.click_list5_1()  # 点击进入抗感冒类界面
        sleep(0.5)
        self.public_page.switch_secendPage()  # 句柄切换到第二页上
        for i in range(3):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 商品1加入购物车
        sleep(2)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(1)
        for i in range(3):
            self.cart_page.input_number1(self.shuliang, i)  # 输入第一个商品的数量
            sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_09(self):
        """商品分类——妇、儿科列表"""
        sleep(0.5)
        self.categories_page.click_qbspfl(5)  # 点击进入呼吸系统分类选择
        sleep(0.5)
        self.categories_page.click_list6_1()  # 点击进入抗感冒类界面
        sleep(0.5)
        self.public_page.switch_secendPage()  # 句柄切换到第二页上
        sleep(1)
        for i in range(3):
            self.puyao_page.click_addcart(i)  # 商品1加入购物车
            sleep(1)
        sleep(1)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(1)
        for i in range(3):
            self.cart_page.input_number1(self.shuliang, i)  # 输入第N个商品的数量
            sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_10(self):
        """商品分类——心脑血管及神经类用药列表"""
        sleep(0.5)
        self.categories_page.click_qbspfl(6)  # 点击进入呼吸系统分类选择
        sleep(0.5)
        self.categories_page.click_list7_1()  # 点击进入抗感冒类界面
        sleep(0.5)
        self.public_page.switch_secendPage()  # 句柄切换到第二页上
        for i in range(2):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 商品2加入购物车
        sleep(5)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(1)
        for i in range(3):
            self.cart_page.input_number1(self.shuliang, i)  # 输入第一个商品的数量
            sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_11(self):
        """商品分类——风湿骨伤及其他药品列表"""
        sleep(0.5)
        self.categories_page.click_qbspfl(8)  # 点击进入呼吸系统分类选择
        sleep(0.5)
        self.categories_page.click_list9_1()  # 点击进入抗感冒类界面
        sleep(0.5)
        self.public_page.switch_secendPage()  # 句柄切换到第二页上
        for i in range(2):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 商品2加入购物车
        sleep(2)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(1)
        for i in range(3):
            self.cart_page.input_number1(self.shuliang, i)  # 输入第一个商品的数量
            sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_12(self):
        """商品分类——非药品列表"""
        sleep(0.5)
        self.categories_page.click_qbspfl(11)  # 点击进入呼吸系统分类选择
        sleep(0.5)
        self.categories_page.click_list12_1()  # 点击进入抗感冒类界面
        sleep(0.5)
        self.public_page.switch_secendPage()  # 句柄切换到第二页上
        for i in range(2):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 商品2加入购物车
        sleep(2)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(0.5)
        for i in range(3):
            self.cart_page.input_number1(self.shuliang, i)  # 输入第一个商品的数量
            sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_13(self):
        """搜索内容进行下单"""
        sleep(1)
        self.search_page.input_ssk("阿胶")  # 搜索框中输入内容
        sleep(1)
        self.search_page.click_ssButton()  # 点击搜索按钮
        sleep(1)
        for i in range(2):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 商品2加入购物车
            sleep(2)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(0.5)
        for i in range(2):
            self.cart_page.input_number1(self.shuliang, i)  # 输入第一个商品的数量
            sleep(1)
        sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
        # sleep(0.5)
        # self.settle_page.click_tjdd()  # 点击提交订单
        # sleep(0.5)
        # self.assertEqual(self.order_page.text_cgts(), "感谢您在本网站购买商品,您的订单已成功提交!")

    def test_OrderProcess_14(self):
        """搜索框联想的内容进行下单"""
        sleep(2)
        self.search_page.input_ssk("阿胶")  # 搜索框中输入内容
        sleep(2)
        self.search_page.click_ssList1(0)  # 点击搜索列表第一个
        sleep(2)
        for i in range(2):
            sleep(1)
            self.puyao_page.click_addcart(i)  # 商品2加入购物车
            sleep(2)
        self.home_page.click_gwc()  # 调用进入购物车界面按钮
        sleep(0.5)
        for i in range(2):
            self.cart_page.input_number1(self.shuliang, i)  # 输入第一个商品的数量
            sleep(1)
        sleep(1)
        self.cart_page.click_jiesuan()  # 点击结算按钮
예제 #16
0
 def test_result_found(self):
     home_page = HomePage(self.driver)
     home_page.set_search_query("Design patterns")
     home_page.search()
     result = SearchPage(self.driver)
     assert result.heading_text() == "Design pattern"
예제 #17
0
 def prepare_classes(context):
     context.search_page = SearchPage(context.driver)
     context.results_page = ResultsPage(context.driver)