Ejemplo n.º 1
0
    def setUpClass(cls):
        cls.driver = webdriver.Chrome()
        cls.driver.get("http://120.78.128.25:8765/index/login.html")
        cls.driver.implicitly_wait(30)
        cls.login_page = LoginPage(cls.driver)
        cls.invest_page = InvestPage(cls.driver)
        cls.index_page = IndexPage(cls.driver)

        cls.login_page.send_phone_element(invest.user_currect_info['phone'])
        cls.login_page.send_password_element(
            invest.user_currect_info['password'])
        cls.login_page.submit_element()

        IndexPage(cls.driver).bid()
Ejemplo n.º 2
0
    def test_bid_sucess(self, class_web2, founction_web):

        self.driver, self.bid_page = class_web2
        #在首页选择标的 choose_bid(),点击投标
        IndexPage(self.driver).choose_bid()

        #定位投资输入框元素 get_bid_input_element()
        e = self.bid_page.get_bid_input_element()

        #投资前金额
        expect = float(e.get_attribute('data-amount'))
        print(expect)

        #发送投资金额
        e.send_keys(invest_money)

        #点击投标按钮
        self.bid_page.click_bid_submit()
        # print("当前时间: ",time.strftime('%Y.%m.%d %H:%M ',time.localtime(time.time())))

        #激活并查看
        self.bid_page.click_alert()

        #用户余额
        actual_money_str = UserPage(self.driver).get_user_money()
        actual_money = float(actual_money_str)

        #调试
        print(int(expect * 100))
        print(int(invest_money * 100))
        print(actual_money * 100)

        assert (int(expect * 100) - invest_money * 100 == actual_money * 100)
Ejemplo n.º 3
0
    def test_bid_success(self, data, init_web):
        """首页选择标,点击投标"""
        self.driver, self.login_page = init_web
        self.bid_page = BidPage(self.driver)
        self.login_page.login(data['user'], data['pwd'])
        IndexPage(self.driver).choose_bid()

        # 定位投资输入框元素
        ele = self.bid_page.get_bid_input()
        data = float(ele.get_attribute("data-amount"))
        # print(data)

        # 输入投资金额
        ele.send_keys(invest_money)

        # 点击投资
        self.bid_page.click_bid_submit()
        # 激活并查看
        self.bid_page.click_alert()

        actual_money_str = UserPage(self.driver).get_user_money()
        actual_money = float(actual_money_str)

        # 调试步骤
        print(int(data * 100))
        print(int(invest_money * 100))
        print(int(actual_money * 100))

        # 断言相关操作
        assert (int(data * 100) - invest_money * 100 == int(actual_money *
                                                            100))
Ejemplo n.º 4
0
    def switch_to_language(self, lang):
        from pages.index import IndexPage

        self.selenium.find_element(By.CSS_SELECTOR,
                                   'a[lang="' + lang + '"]').click()
        index_pg = IndexPage(self.testsetup)
        return index_pg
Ejemplo n.º 5
0
    def test_english_to_spanish(self, mozwebqa):
        index_pg = IndexPage(mozwebqa)

        index_pg.go_to_page()

        # Assert we're looking at English
        assert index_pg.current_language.lower() == 'english'

        # Go to picker page
        picker_pg = index_pg.go_to_picker_page()

        # Switch to Spanish
        picker_pg.switch_to_language('es')

        # Assert we're looking at Spansih
        assert index_pg.current_page_url.endswith('/es/')
        assert index_pg.current_language.lower() == u'español'
 def test_login_sucess(self, data, init_driver):
     #从conftest里面取出来,init_driver代表的yield出来的两个值
     driver, login_page = init_driver
     login_page.submit_userinfo(data['phone'], data['password'])
     # 找到账户的元素
     user_ele = IndexPage(driver).get_user()
     print(user_ele.text)
     assert (data['expected'] == user_ele.text)
Ejemplo n.º 7
0
def my_class_invest():
    print('Start Test Only Once')
    url = "http://120.78.128.25:8765/Index/login.html"
    driver = webdriver.Chrome()
    driver.get(url)
    driver.implicitly_wait(30)

    login_page = LoginPage(driver)
    invest_page = InvestPage(driver)
    index_page = IndexPage(driver)

    login_page.send_phone_element(invest.user_currect_info['phone'])
    login_page.send_password_element(invest.user_currect_info['password'])
    login_page.submit_element()
    index_page.bid()

    yield (driver, login_page, invest_page)

    print('End Test Only Once ')
    driver.quit()
Ejemplo n.º 8
0
def test_add_department_smoke(login_by_cookie):
    """
    冒烟测试:添加部门
    1、首页点击通讯录  2、点击添加部门  3、输入部门名称  4、选择所属部门公司之下的著部门
    断言:提示新建部门成功 、  通讯录页面存在该部门的文件夹
    """
    driver = login_by_cookie
    IndexPage(driver).click_tab_address_book().click_add_department().input_department_info("12223")
    address_book = AddressBookPage(driver)
    assert address_book.get_element_by_text("新建部门成功")
    assert "12223" in address_book.get_department_text_list
Ejemplo n.º 9
0
    def test_login_success(self, data, init_web):
        with allure.step("获取返回的登录页面"):
            self.driver, self.login_page = init_web

        with allure.step("输入正确的用户名与密码,点击登录"):
            self.login_page.login(data["username"], data["pwd"])

        with allure.step("获取登录成功页面的用户信息"):
            user_name = IndexPage(self.driver).get_user_info()

        with allure.step("断言"):
            assert (data["expected"] == user_name.text)
Ejemplo n.º 10
0
    def test_login_3_success(self, class_web, founction_web):
        #登录login
        self.driver, self.login_page = class_web
        my_log.info('测试数据;{}'.format(user_info_success))
        self.login_page.login(user_info_success["username"],
                              user_info_success["pwd"])

        #5.断言
        #获取用户信息 get_user_info
        user_ele = IndexPage(self.driver).get_user_info()
        assert (user_info_success["expected"] in user_ele.text)
        self.driver.quit()
Ejemplo n.º 11
0
 def test_bid_success(self,bid_init_driver):
     driver, login_page,bid_page = bid_init_driver
     #首页点击投标
     IndexPage(driver).bid()
     # 投标页面输入投标
     # data_amout=self.bid_page.data_amout()
     # print(type(data_amout))
     bid_page.bid(bid.bid_correct['money'])
     bid_page.click_bid_submit()
     #断言
     assert (bid_page.popup_text()==bid.bid_correct['expected'])
     #比对金额
     assert (int(bid_page.data_amout)-100.00==int(bid_page.data_amout))
Ejemplo n.º 12
0
def test_add_member_smoke(login_by_cookie):
    """
    添加成员:
    1、首页点击通讯录页签  2、点击添加成员按钮  3、输入信息
    断言:提示保存成功  通讯录有该邮箱的信息
    """
    driver = login_by_cookie
    IndexPage(driver).click_tab_address_book().click_add_member_btn().\
        add_member_by_email("test","8e898","*****@*****.**")

    address_book = AddressBookPage(driver)
    assert address_book.get_element_by_text("保存成功")
    assert "*****@*****.**" in address_book.get_member_email_list
Ejemplo n.º 13
0
 def test_login_2_success(self):
     #登陆 login
     # self.driver = Chrome()
     # self.login_page = LoginPage(self.driver)
     self.driver, self.login_page = init_web()
     self.login_page.login("18684720553", "python")
     #5、断言,首页的元素
     #先获取用户信息  get_user_info
     user_ele = IndexPage(self.driver).get_user_info()
     #self.assertTrue("小蜜蜂96027921" in user_ele.text)
     assert ("小蜜蜂96027921" in user_ele.text)
     time.sleep(2)
     self.driver.quit()
Ejemplo n.º 14
0
def init_driver():
    print('begin driver')
    driver = webdriver.Chrome()
    driver.get("http://120.78.128.25:8765/Index/login.html")
    driver.maximize_window()
    login_page = LoginPage(driver)
    login_page.submit_userinfo(login_message.user_corrent[0]["phone"],
                               login_message.user_corrent[0]["password"])
    index_page = IndexPage(driver)
    bid_page = BidPage(driver)

    yield (driver, index_page, bid_page)
    #在执行yield地时候会执行测试用例,执行完测试用例在执行quit driver(生成器)
    #yield 后面可以return一些东西,生成器的概念
    print('quit driver')
    driver.quit()
Ejemplo n.º 15
0
    def test_login_2_success(self, data, my_class_login):
        driver, login_page = my_class_login
        # self.login_page.submit_userinfo("18684720553", "python")

        login_page.send_phone_element(data['phone'])
        login_page.send_password_element(data['password'])
        login_page.submit_element()

        try:
            # self.assertTrue("小小蜜蜂" in user_ele.text)
            # self.assertTrue(data['expected'] in IndexPage(self.driver).get_user().text)
            assert data['expected'] in IndexPage(driver).get_user().text
            print('Test Pass!')
        except AssertionError as e:
            print('Test Failed!!! AssertionError:{}'.format(e))
            raise e
Ejemplo n.º 16
0
class App:

    wd = driver
    product_page = ProductPage()
    checkout_page = CheckoutPage()
    cart_page = CartPage()
    category_page = CategoryPage()
    index_page = IndexPage()
    search_page = SearchPage()
    screenshooter = Screenshooter()

    def __init__(self):
        self.wd.maximize_window()
      #  self.wd.implicitly_wait(60)
       # self.wd.set_page_load_timeout(60)


    def order(self, billing_equal_shipping = True):
        get(product)

        self.product_page.add_to_cart()
        Wait.visible(self.product_page.minicart_popup_lo)
        self.product_page.minicart_popup.view_cart_link.click()

        # *****************************on cart page
        Wait.invisible(self.cart_page.full_page_loader_lo)

        self.cart_page.enter_zip(10001)

        Wait.invisible(self.cart_page.full_page_loader_lo)

        self.cart_page.checkout_button.click()

        Wait.invisible(self.cart_page.full_page_loader_lo)

        self.checkout_page.fill_shipping_form()

        Wait.invisible(self.cart_page.full_page_loader_lo)
        #sleep(5)
        self.checkout_page.fill_billing_form(billing_equal_shipping)
        self.checkout_page.fill_cc_form()

        self.checkout_page.billing.place_order_button.click()


    def destroy(self):
        self.wd.quit()
Ejemplo n.º 17
0
    def test_login_2_success(self, data):
        """
        phone: 18819340103
        pwd: 123456
        :return:
        """
        # self.login_page.submit_userinfo("18684720553", "python")
        self.login_page.send_phone_element(data['phone'])
        self.login_page.send_password_element(data['password'])
        self.login_page.submit_element()

        try:
            # self.assertTrue("小小蜜蜂" in user_ele.text)
            self.assertTrue(
                data['expected'] in IndexPage(self.driver).get_user().text)
            print('Test Pass!')
        except AssertionError as e:
            print('Test Failed!!! AssertionError:{}'.format(e))
            raise e
Ejemplo n.º 18
0
    def test_bid_success(self):
        #在首页选择标的 choice_bid() ,点击投标
        IndexPage(self.driver).choice_bid()

        #定位投资输入框元素
        e = self.bid_page.get_bid_input_element()

        expect = e.get_attribute('data-amount')
        print(expect)

        #发送投资金额
        e.send_keys(invest_money)
        #点击投标
        self.bid_page.click_bid_submit()
        #获取可用余额
        actual_money_str = UserPage(self.driver).get_user_money()
        actual_money = float(actual_money_str)
        #断言相关操作
        self.assertTrue(int(expect*100)-invest_money == int(actual_money))
Ejemplo n.º 19
0
 def login_success(self, username, pwd):
     self.browser.find_element(*self.username_locat).send_keys(username)
     self.browser.find_element(*self.pwd_locat).send_keys(pwd)
     self.browser.find_element(*self.button_locat).click()
     return IndexPage(self.browser)
Ejemplo n.º 20
0
def test_sign_in_page_displayed(base_url, selenium):
    page = IndexPage(base_url, selenium).open()
    page.click_sign_in()
    assert "SurveyMonkey - Log in" == selenium.title
 def index_page(self, browser):
     index_page = IndexPage(browser)
     index_page.load()
     return index_page