Exemplo n.º 1
0
 def test_page_login_1(self):
     login = PageLogin(self.driver)
     login_user1 = login_data().get_login_data()
     num1 = login_user1[0]["编号"]
     username1 = login_user1[0]["用户名"]
     password1 = login_user1[0]["密码"]
     # print(type(password1))
     login.LoginOn(num1, username1, int(password1))
     time.sleep(2)
     self.assertEqual(login.Title(), "管理中心", msg="测试通过")
     login_result = login_data().write_result(1, "pass")
Exemplo n.º 2
0
 def test_page_login_6(self):
     login = PageLogin(self.driver)
     login_user1 = login_data().get_login_data()
     num1 = login_user1[0]["编号"]
     username1 = login_user1[0]["用户名"]
     password1 = login_user1[0]["密码"]
     login.LoginOn(num1, username1, int(password1))
     time.sleep(2)
     login.Back()
     time.sleep(2)
     self.assertEqual(
         login.Get_att(r'//input[@class="layui-input"]', 'value'), '007')
Exemplo n.º 3
0
 def test_page_login_5(self):
     login = PageLogin(self.driver)
     login_user1 = login_data().get_login_data()
     # login_result = login_data().write_result(5, "pass")
     num5 = login_user1[4]["编号"]
     username5 = login_user1[4]["用户名"]
     password5 = login_user1[4]["密码"]
     login.LoginOn(num5, username5, password5)
     time.sleep(2)
     login_result = login_data().write_result(5, "fail")
     self.assertEqual(login.Text_1(r'//div[@class="layui-layer-content"]'),
                      "账号或者密码错误! ",
                      msg="测试不通过")
     print("-" * 50)
Exemplo n.º 4
0
 def test_page_login_4(self):
     login = PageLogin(self.driver)
     login_user1 = login_data().get_login_data()
     # login_result = login_data().write_result(4, "pass")
     num4 = login_user1[3]["编号"]
     username4 = login_user1[3]["用户名"]
     password4 = login_user1[3]["密码"]
     login.LoginOn(num4, username4, password4)
     time.sleep(2)
     self.assertEqual(login.Text_1(r'//div[@class="layui-layer-content"]'),
                      "账号或者密码错误!",
                      msg="测试通过")
     # self.assertEqual(login.Title(),"管理中心",msg="不测试通过")
     login_result = login_data().write_result(4, "pass")
Exemplo n.º 5
0
 def test_page_login_2(self):
     login = PageLogin(self.driver)
     login_user1 = login_data().get_login_data()
     # login_result = login_data().write_result(2, "pass")
     num2 = login_user1[1]["编号"]
     username2 = login_user1[1]["用户名"]
     password2 = login_user1[1]["密码"]
     login.LoginOn(num2, username2, password2)
     time.sleep(2)
     self.assertEqual(login.Text_1(
         r'//div[@class="layui-layer-content layui-layer-padding"]'),
                      "必填项不能为空",
                      msg="测试通过")
     # self.assertEqual(login.Title(),"管理中心",msg="不测试通过")
     login_result = login_data().write_result(2, "pass")
Exemplo n.º 6
0
 def __init__(self, driver):
     self.pagelogin = PageLogin(driver)
     self.pageindex = PageIndex(driver)
     self.pagepersonal = PagePersonal(driver)
     self.pageaddaddress = PageAddAddress(driver)
     self.pagegoods = PageGoods(driver)
     self.pageorder = PageOrder(driver)
     self.pagecart = PageCart(driver)
Exemplo n.º 7
0
    def test_page_login_1(self):

        i = 1
        while i > 6:

            for j in range(0, 6):
                login = PageLogin(self.driver)
                login_user1 = login_data().get_login_data()
                num1 = login_user1[j]["编号"]
                username1 = login_user1[j]["用户名"]
                password1 = login_user1[j]["密码"]
                # print(type(password1))
                login.LoginOn(num1, username1, int(password1))
                time.sleep(2)
                self.assertEqual(login.Title(), "管理中心", msg="测试通过")

            i += 1
            print("testend......")
Exemplo n.º 8
0
 def __init__(self, driver):
     '''
     实例化所有的页面对象,无论多少页面,统一进行实例化,然后业务层继承ActionsManager
     这样业务层无论用到哪个页面,都可以直接拿实例化好的页面对象去用。
     :param driver:
     '''
     self.pageIndex = PageIndex(driver)
     self.pageLogin = PageLogin(driver)
     self.pageCart = PageCart(driver)
     self.pageOrder = PageOrder(driver)
     self.pageGoods = PageGoods(driver)
     self.pageMyAddress = PageMyAddress(driver)
     self.pagePersonCenter = PagePersonCenter(driver)
     self.pageSearch = PageSearch(driver)
Exemplo n.º 9
0
 def __init__(self, driver):
     self.pageindex = PageIndex(driver)
     self.pagelogin = PageLogin(driver)
     self.pagepersonaldata = PagePersonalData(driver)
     self.pagepersonalhome = PagePersonalHome(driver)
Exemplo n.º 10
0
 def __init__(self, driver):
     self.pagecover = PageCover(driver)
     self.pageindex=PageIndex(driver)
     self.pagelogin = PageLogin(driver)
Exemplo n.º 11
0
'''
购物车页面
'''


class PageCart(Base):

    # 点击删除按钮
    def page_click_delete_button(self):
        self.base_click(pageObject.cart_delete_button)

    # 点击确定删除
    def page_confirm_delete(self):
        self.base_click(pageObject.cart_confirm_delete)


if __name__ == '__main__':

    from selenium import webdriver
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get('http://121.42.15.146:9090/mtx/')
    from pageObject.page_login import PageLogin

    login = PageLogin(driver)
    login.page_login_success()
    cart = PageCart(driver)
    cart.page_add_cart()
    time.sleep(2)
    assert '加入成功' in driver.page_source