예제 #1
0
    def test02_NameError(self):
        """用户名错误,密码正确"""

        loginPage = login.loginPage()
        case_row = self.open_sheet.get_row_num(2)
        """进入登录页面,登录"""
        loginMsg = json.loads(self.open_sheet.get_cell_data(case_row + 1, 4))
        loginPage.login(loginMsg["user"], loginMsg["pd"])
        error = loginPage.getTest("#login_error")
        self.assertEqual(error, self.open_sheet.get_cell_data(case_row + 2, 4))
        """登录"""
        loginMsg = json.loads(self.open_sheet.get_cell_data(case_row + 3, 4))
        loginPage.login(loginMsg["user"], loginMsg["pd"])
        error = loginPage.getTest("#login_error")
        self.assertEqual(error, self.open_sheet.get_cell_data(case_row + 4, 4))
        """登录"""
        loginMsg = json.loads(self.open_sheet.get_cell_data(case_row + 5, 4))
        loginPage.login(loginMsg["user"], loginMsg["pd"])
        error = loginPage.getTest("#login_error")
        self.assertEqual(error, self.open_sheet.get_cell_data(case_row + 6, 4))
        """登录"""
        loginMsg = json.loads(self.open_sheet.get_cell_data(case_row + 7, 4))
        loginPage.login(loginMsg["user"], loginMsg["pd"])
        error = loginPage.getTest("#login_error")
        self.assertEqual(error, self.open_sheet.get_cell_data(case_row + 8, 4))
        """登录"""
        loginMsg = json.loads(self.open_sheet.get_cell_data(case_row + 9, 4))
        loginPage.login(loginMsg["user"], loginMsg["pd"])
        error = loginPage.getTest("#login_error")
        self.assertEqual(error,
                         self.open_sheet.get_cell_data(case_row + 10, 4))
예제 #2
0
def test2():
    Browser().setDriver()
    print(Browser().driver)
    loginPage = login.loginPage()
    """登录"""
    loginPage.login("18502827849", "123456")
    loginPage.close()
    loginPage.quit()
예제 #3
0
    def test04_NamePdError(self):
        """用户名、密码错误"""

        loginPage = login.loginPage()
        case_row = self.open_sheet.get_row_num(4)
        """进入登录页面,登录"""
        loginMsg = json.loads(self.open_sheet.get_cell_data(case_row + 1, 4))
        loginPage.login(loginMsg["user"], loginMsg["pd"])
        error = loginPage.getTest("#login_error")
        self.assertEqual(error, self.open_sheet.get_cell_data(case_row + 2, 4))
예제 #4
0
    def test01_Success(self):
        """正确登录"""

        loginPage = login.loginPage()
        case_row = self.open_sheet.get_row_num(1)
        """进入登录页面,登录"""
        loginMsg = json.loads(self.open_sheet.get_cell_data(case_row + 1, 4))
        loginPage.login(loginMsg["user"], loginMsg["pd"])
        """进入首页,显示首页的信息"""
        msg = loginPage.findElementByJQuery(
            f"li:contains('{self.open_sheet.get_cell_data(case_row+2,4)}')")
        self.assertIsNotNone(msg, "登录失败,未找到【首页】标题")
예제 #5
0
def test1():
    Browser().setDriver()
    print(Browser().driver)
    loginPage = login.loginPage()

    # print("窗口标题为:",loginPage.getTitle())
    # print("页面url为:",loginPage.getUrl())
    # print("按钮坐标为:",loginPage.Location(ok_str))
    # print("按钮大小为:",loginPage.Size(ok_str))
    # print("按钮是否可见:",loginPage.isDisplayed(ok_str))
    # print("按钮是否选中:",loginPage.isSelected(ok_str))
    # print("按钮文本为:",loginPage.getTest("span.labelTip"))
    # print("按钮value属性值为:",loginPage.getAttribute(ok_str,"value"))
    # loginPage.setAttribute(name_str,"style","background: red; border: 2px solid red")
    # print("按钮value属性值为:",loginPage.getAttribute(name_str,"style"))
    """登录"""
    # loginPage.loginUrl("https://pro.formtalk.net/login.do")
    loginPage.login("17111111111", "123456")
    # loginPage.click("div[title='自动化应用准备1_新版']")
    # loginPage.switchToFrame(["#iframeUseApp"])
    # loginPage.click("i.menu-info:contains('表单准备1')")
    # loginPage.switchToFrame(["#iframeUseApp","#app-main-iframe"])
    # loginPage.click("button:contains('添加')")
    # loginPage.switchToWindowByName("表单准备1")
    # loginPage.type("label:contains('单行文本')+div>input[type=text]","测试一下")

    # loginPage.click("div[title='表单中心']")
    # loginPage.switchToFrame(["#mainFrame"])
    # loginPage.click("span:contains('新的表单_测试')")
    # loginPage.click("button.form-udata-add-span")
    # loginPage.switchToWindowByName("新的表单_测试")

    # loginPage.type("label:contains(单行文本)+div>input","姓名")
    # loginPage.selectByIndex("select",1)
    # loginPage.selectByValue("select","2")
    # loginPage.selectByText("select","选项1")

    # loginPage.move(loginPage.findElementByJQuery("div[title='社会化招聘2.0']"))
    # loginPage.move("i[title='简历获取']")
    # loginPage.move("i[title='投递简历']")
    # loginPage.click("i[title='投递简历']")
    # time.sleep(5)

    loginPage.close()
    loginPage.quit()
예제 #6
0
 def test01_Success(self):
     """获取用例数据"""
     loginPage = login.loginPage()
     FormDataPage = FormData.FormDataPage()
     case_row = self.open_sheet.get_row_num(1)
     """进入登录页面,登录"""
     loginMsg = json.loads(self.open_sheet.get_cell_data(case_row + 1, 4))
     loginPage.login(loginMsg["user"], loginMsg["pd"])
     """进入表单数据列表"""
     formMsg = json.loads(self.open_sheet.get_cell_data(case_row + 2, 4))
     FormDataPage.intoDataList(formMsg["应用名称"], formMsg["表单菜单"])
     FormDataPage.clickAdd(formMsg["表单菜单"])
     """填写表单数据"""
     dataMsg = json.loads(self.open_sheet.get_cell_data(case_row + 4, 4))
     FormDataPage.logger.debug(dataMsg)
     FormDataPage.type("label:contains(单行文本)+div>input[type=text]",
                       dataMsg["单行文本"])
     FormDataPage.clickByJs("button:contains('保存')")