Пример #1
0
    def test_commit_trans(self):
        session = Utility.login()
        #事务登记
        data_commit = Utility.get_excell_data("../../testdata/test_data.xlsx",
                                              "regis", "REGIS", 2, 3, 4)

        data_commit[0][0]["data"]["__VIEWSTATE"] = self.__VIEWSTATE
        data_commit[0][0]["data"][
            "__VIEWSTATEGENERATOR"] = self.__VIEWSTATEGENERATOR
        data_commit[0][0]["data"]["__EVENTVALIDATION"] = self.__EVENTVALIDATION

        # data={"__VIEWSTATE":__VIEWSTATE,"__VIEWSTATEGENERATOR":__VIEWSTATEGENERATOR,"__EVENTVALIDATION":__EVENTVALIDATION,
        #       "tbxCustName":"欧阳娜娜"}
        resp1 = session.post(url=self.url_open, data=data_commit)
        print(resp1.text)
Пример #2
0
class regis(unittest.TestCase):

    #打开事务登记页面
    data_openpage = Utility.get_excell_data("../../testdata/test_data.xlsx",
                                            "regis", "OPEN", 2, 3, 4)

    @parameterized.expand(data_openpage)
    def test_open_regis(self, data):

        session = requests.session()

        #使用坐席账号登录
        session.post(data_cookie[0][0]["url"], data_cookie[0][0]["data"])

        resp = session.get(data["url"])

        if "紧急转接" in resp.text:

            actual = "pass"
        else:
            actual = "fail"

        self.assertEqual(actual, data["expect"])
        session.close()

    #坐席账号提交登记
    data_commit = Utility.get_excell_data("../../testdata/test_data.xlsx",
                                          "regis", "REGIS", 2, 3, 4)

    print(data_commit)

    @parameterized.expand(data_commit)
    def test_regis(self, data):

        #登录
        session = Utility.login()
        resp = session.post(data["url"], data["data"])

        #断言
        if "判断是否点击的是咨询" in resp.text:

            actual = "pass"
        else:
            actual = "fail"

        self.assertEqual(actual, data["expect"])
        session.close()
Пример #3
0
    def test_open_trans(self):

        #登录
        session = Utility.login()

        #打开事务登记页面
        self.url_open = "http://117.34.110.92:8991/Modules/Order/OrderALLEdit.aspx?vvcf=1"
        resp = session.get(self.url_open)

        self.__VIEWSTATE = resp.text.split('id="__VIEWSTATE"')[1].split(
            "=", 1)[1].split(" />", 1)[0]
        self.__VIEWSTATEGENERATOR = "A19B93C9"
        self.__EVENTVALIDATION = resp.text.split(
            'id="__EVENTVALIDATION"')[1].split("=", 1)[1].split(" />", 1)[0]
        session.close()
Пример #4
0
    def test_regis(self, data):

        #登录
        session = Utility.login()
        resp = session.post(data["url"], data["data"])

        #断言
        if "判断是否点击的是咨询" in resp.text:

            actual = "pass"
        else:
            actual = "fail"

        self.assertEqual(actual, data["expect"])
        session.close()
Пример #5
0
class OpenPage(unittest.TestCase):
    data_open = Utility.get_excell_data("../../testdata/test_data.xlsx",
                                        "login", "OPEN", 2, 3, 4)

    @parameterized.expand(data_open)
    def test_open_page(self, data):

        session = requests.session()
        resp = session.get(data["url"])
        if 'id="__VIEWSTATE"' in resp.text:
            actual = "pass"

        else:
            actual = "fail"
        self.assertEqual(actual, data["expect"])
Пример #6
0
    def test_search_trans(self):
        # 登录
        session = Utility.login()

        #打开暂存事务界面
        resp = session.get(data_temp[0][0]["url"])

        #获取参数
        # print(resp.text)
        # r = re.compile(r'id="__VIEWSTATE" value="([\w+=/]+)" />')
        # print("#########################",r.findall(resp.text))

        data_search[0][0]["data"]["__VIEWSTATE"] = Service.get_view(
            resp.text, "VIEWSTATE")
        data_search[0][0]["data"]["__VIEWSTATEGENERATOR"] = Service.get_view(
            resp.text, "VIEWSTATEGENERATOR")
        data_search[0][0]["data"]["__EVENTVALIDATION"] = Service.get_view(
            resp.text, "EVENTVALIDATION")
        print(data_search[0][0]["data"]["__EVENTVALIDATION"])

        resp1 = session.post(data_search[0][0]["url"],
                             data_search[0][0]["data"])
        # print(resp1.text)
        # print(data_search[0][0]["url"])
        # print(data_search[0][0]["data"])
        print("响应是:", resp1.text)

        # if data_search[0][0]["data"]["__VIEWSTATEGENERATOR"] in resp1.text:
        #
        #     print("pass")
        #
        # else:
        #     print("not pass")

        # print(resp1.text)
        session.close()
Пример #7
0
from parameterized import parameterized

from interface.utilty.Utility import Utility

import requests, unittest
data_cookie = Utility.get_excell_data("../../testdata/test_data.xlsx", "login",
                                      "LOGIN", 2, 3, 4)


class regis(unittest.TestCase):

    #打开事务登记页面
    data_openpage = Utility.get_excell_data("../../testdata/test_data.xlsx",
                                            "regis", "OPEN", 2, 3, 4)

    @parameterized.expand(data_openpage)
    def test_open_regis(self, data):

        session = requests.session()

        #使用坐席账号登录
        session.post(data_cookie[0][0]["url"], data_cookie[0][0]["data"])

        resp = session.get(data["url"])

        if "紧急转接" in resp.text:

            actual = "pass"
        else:
            actual = "fail"
Пример #8
0
import unittest, requests, re
from parameterized import parameterized

from interface.utilty.Service import Service
from interface.utilty.Utility import Utility

data_temp = Utility.get_excell_data("../../testdata/test_data.xlsx", "regis",
                                    "TEMP", 2, 3, 4)
data_search = Utility.get_excell_data("../../testdata/test_data.xlsx", "regis",
                                      "SEARCH", 2, 3, 4)


class Temp_Trans(unittest.TestCase):

    # 打开暂存事务页面
    # def test_temptrans(self):
    #
    #     #登录
    #     session=Utility.login()
    #
    #     #打开暂存事务页面
    #
    #     resp=session.get(data_temp[0][0]["url"])
    #     __VIEWSTATE = resp.text.split('id="__VIEWSTATE"')[1].split("=", 1)[1].split(" />", 1)[0]
    #     __VIEWSTATEGENERATOR = resp.text.split('id="__VIEWSTATEGENERATOR"')[1].split("=", 1)[1].split(" />", 1)[0]
    #     __EVENTVALIDATION = resp.text.split('id="__EVENTVALIDATION"')[1].split("=", 1)[1].split(" />", 1)[0]
    #
    #     #断言
    #     if "暂存事务" in resp.text:
    #         actual="pass"
    #     else: