示例#1
0
	def setUp(self):
		#初始化浏览器(谷歌)
		self.driver = TestDriver(executable_path= DriverInfo.executable_path)
		self.driver.maximize_window()
		self.driver.implicitly_wait(10)
		self.driver.get(KuaiXiaoV6.loginUrl)
		
		#登陆
		Login = LoginForm(self.driver)
		Login.login(username= KuaiXiaoV6.username, password= KuaiXiaoV6.password, validateCode= KuaiXiaoV6.validateCode)
		
		#判断登陆是否成功
		self.common_page = CommonPage(self.driver)
		self.common_page.check_isLogin(KuaiXiaoV6.checkUrl)
		self.common_page.wait_for_loading()

		#切换模块
		self.common_page.switch_module_by_name('促销活动管理')

		#切换页签
		self.common_page.wait_for_loading()
		self.common_page.swith_to_index('btn_activity_all')

		#获取数据驱动
		self.data_driver = DataDriver('salepromotion')
示例#2
0
    def setUp(self):
        # 初始化浏览器(谷歌)
        self.driver = TestDriver(executable_path=DriverInfo.executable_path)
        self.driver.maximize_window()
        self.driver.implicitly_wait(10)
        self.driver.get(KuaiXiaoV6.loginUrl)

        # 登陆
        Login = LoginForm(self.driver)
        Login.login(username=KuaiXiaoV6.username, password=KuaiXiaoV6.password, validateCode=KuaiXiaoV6.validateCode)

        # 判断登陆是否成功
        self.common_page = CommonPage(self.driver)
        self.common_page.check_isLogin(KuaiXiaoV6.checkUrl)
        self.common_page.wait_for_loading()

        # 切换人员管理模块
        self.common_page.switch_module_by_name("人员管理")

        # 获取数据驱动
        self.data_driver = DataDriver("user")
示例#3
0
class GiftTestCase(unittest.TestCase):

	def setUp(self):
		#初始化浏览器(谷歌)
		self.driver = TestDriver(executable_path= DriverInfo.executable_path)
		self.driver.maximize_window()
		self.driver.implicitly_wait(10)
		self.driver.get(KuaiXiaoV6.loginUrl)
		
		#登陆
		Login = LoginForm(self.driver)
		Login.login(username= KuaiXiaoV6.username, password= KuaiXiaoV6.password, validateCode= KuaiXiaoV6.validateCode)
		
		#判断登陆是否成功
		self.common_page = CommonPage(self.driver)
		self.common_page.check_isLogin(KuaiXiaoV6.checkUrl)
		self.common_page.wait_for_loading()

		#切换模块
		self.common_page.switch_module_by_name('赠品管理')

		#获取数据驱动
		self.data_driver = DataDriver('gift')

		
	def test_A_add(self):
		#获取数据
		addSrcData, addDestData = self.data_driver.get_data_from_xls('addData')

		#新增数据
		self.common_page.wait_for_loading()
		add_user = AddForm(self.driver)
		add_user.add(addDestData)

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(addDestData)

		#判断数据是否正确
		self.common_page.wait_for_loading()
		user_table = TableForm(self.driver)
		user_table.compare_from_table(addDestData)


	def test_B_disable(self):
		#获取数据
		disableSrcData, disableDestData = self.data_driver.get_data_from_xls('disable')

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(disableSrcData)

		#选中数据
		self.common_page.wait_for_loading()
		user_table = TableForm(self.driver)
		user_table.choose_from_table(0)

		#停用数据
		self.common_page.wait_for_loading()
		self.common_page.disable_()

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(disableDestData)

		#判断数据是否正确
		self.common_page.wait_for_loading()
		user_table.compare_from_table(disableDestData)


	def test_C_enable(self):
		#获取数据
		enableSrcData, enableDestData = self.data_driver.get_data_from_xls('enable')

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(enableSrcData)

		#选中数据
		self.common_page.wait_for_loading()
		user_table = TableForm(self.driver)
		user_table.choose_from_table(0)

		#停用数据
		self.common_page.wait_for_loading()
		self.common_page.enable_()

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(enableDestData)

		#判断数据是否正确
		self.common_page.wait_for_loading()
		user_table.compare_from_table(enableDestData)


	def test_D_delete(self):
		#获取数据
		delSrcData, delDestData = self.data_driver.get_data_from_xls('delete')

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(delSrcData)

		#选中数据
		self.common_page.wait_for_loading()
		user_table = TableForm(self.driver)
		user_table.choose_from_table(0)

		#删除数据
		self.common_page.wait_for_loading()
		self.common_page.delete_()


	def tearDown(self):
		self.driver.quit()
示例#4
0
class BindTestCase(unittest.TestCase):

	def setUp(self):
		#初始化浏览器(谷歌)
		self.driver = TestDriver(executable_path= DriverInfo.executable_path)
		self.driver.maximize_window()
		self.driver.implicitly_wait(10)
		self.driver.get(KuaiXiaoV6.loginUrl)
		
		#登陆
		Login = LoginForm(self.driver)
		Login.login(username= KuaiXiaoV6.username, password= KuaiXiaoV6.password, validateCode= KuaiXiaoV6.validateCode)
		
		#判断登陆是否成功
		self.common_page = CommonPage(self.driver)
		self.common_page.check_isLogin(KuaiXiaoV6.checkUrl)
		self.common_page.wait_for_loading()

		#切换模块
		self.common_page.switch_module_by_name('人员设备绑定')

		#获取数据驱动
		self.data_driver = DataDriver('bind')

		
	def test_A_bind(self):
		#获取数据
		bindSrcData, bindDestData = self.data_driver.get_data_from_xls('bind')

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(bindSrcData)

		#选中数据
		self.common_page.wait_for_loading()
		user_table = TableForm(self.driver)
		user_table.choose_from_table(0)

		#绑定数据
		self.common_page.wait_for_loading()
		bind(self.driver)

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(bindDestData)

		#判断数据是否正确
		self.common_page.wait_for_loading()
		user_table.compare_from_table(bindDestData)		


	def test_B_unbind(self):
		#获取数据
		unbindSrcData, unbindDestData = self.data_driver.get_data_from_xls('unbind')

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(unbindSrcData)

		#选中数据
		self.common_page.wait_for_loading()
		user_table = TableForm(self.driver)
		user_table.choose_from_table(0)

		#解绑数据
		self.common_page.wait_for_loading()
		unbind(self.driver)

		#高级查询筛选数据
		self.common_page.wait_for_loading()
		user_search = SearchForm(self.driver)
		user_search.advance_search(unbindDestData)

		#判断数据是否正确
		self.common_page.wait_for_loading()
		user_table.compare_from_table(unbindDestData)		


	def tearDown(self):
		self.driver.quit()
示例#5
0
class UserTestCase(unittest.TestCase):
    def setUp(self):
        # 初始化浏览器(谷歌)
        self.driver = TestDriver(executable_path=DriverInfo.executable_path)
        self.driver.maximize_window()
        self.driver.implicitly_wait(10)
        self.driver.get(KuaiXiaoV6.loginUrl)

        # 登陆
        Login = LoginForm(self.driver)
        Login.login(username=KuaiXiaoV6.username, password=KuaiXiaoV6.password, validateCode=KuaiXiaoV6.validateCode)

        # 判断登陆是否成功
        self.common_page = CommonPage(self.driver)
        self.common_page.check_isLogin(KuaiXiaoV6.checkUrl)
        self.common_page.wait_for_loading()

        # 切换人员管理模块
        self.common_page.switch_module_by_name("人员管理")

        # 获取数据驱动
        self.data_driver = DataDriver("user")

    def test_A_add(self):
        # 获取数据
        addSrcData, addDestData = self.data_driver.get_data_from_xls("addData")

        # 新增数据
        self.common_page.wait_for_loading()
        add_user = AddForm(self.driver)
        add_user.add(addDestData)

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(addDestData)

        # 判断数据是否正确
        self.common_page.wait_for_loading()
        user_table = TableForm(self.driver)
        user_table.compare_from_table(addDestData)

    def test_B_disable(self):
        # 获取数据
        disableSrcData, disableDestData = self.data_driver.get_data_from_xls("disable")

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(disableSrcData)

        # 选中数据
        self.common_page.wait_for_loading()
        user_table = TableForm(self.driver)
        user_table.choose_from_table(0)

        # 停用数据
        self.common_page.wait_for_loading()
        self.common_page.disable_()

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(disableDestData)

        # 判断数据是否正确
        self.common_page.wait_for_loading()
        user_table.compare_from_table(disableDestData)

    def test_C_enable(self):
        # 获取数据
        enableSrcData, enableDestData = self.data_driver.get_data_from_xls("enable")

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(enableSrcData)

        # 选中数据
        self.common_page.wait_for_loading()
        user_table = TableForm(self.driver)
        user_table.choose_from_table(0)

        # 停用数据
        self.common_page.wait_for_loading()
        self.common_page.enable_()

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(enableDestData)

        # 判断数据是否正确
        self.common_page.wait_for_loading()
        user_table.compare_from_table(enableDestData)

    def test_D_changeManager(self):
        # 获取数据
        changeMangerSrcData, changeMangerDestData = self.data_driver.get_data_from_xls("changeManagerData")

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(changeMangerSrcData)

        # 选中数据
        self.common_page.wait_for_loading()
        user_table = TableForm(self.driver)
        user_table.choose_from_table(0)

        # 更换负责人
        bind_manager(self.driver, changeMangerDestData.get("managerName"))

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(changeMangerDestData)

        # 判断数据是否正确
        self.common_page.wait_for_loading()
        user_table.compare_from_table(changeMangerDestData)

    def test_E_changeDepartment(self):
        # 获取数据
        changeDepartmentSrcData, changeDepartmentDestData = self.data_driver.get_data_from_xls("changeDepartmentData")

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(changeDepartmentSrcData)

        # 选中数据
        self.common_page.wait_for_loading()
        user_table = TableForm(self.driver)
        user_table.choose_from_table(0)

        # 更换营销区域
        change_department(self.driver, changeDepartmentDestData.get("saleAreaName"))

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(changeDepartmentDestData)

        # 判断数据是否正确
        self.common_page.wait_for_loading()
        user_table.compare_from_table(changeDepartmentDestData)

    def test_F_handover(self):
        # 获取数据
        handoverSrcData, handoverDestData = self.data_driver.get_data_from_xls("handoverData")

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(handoverSrcData)

        # 选中数据
        self.common_page.wait_for_loading()
        user_table = TableForm(self.driver)
        user_table.choose_from_table(0)

        # 人员交接
        user_handover = HandoverForm(self.driver)
        user_handover.handover(handoverDestData)

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(handoverDestData)

        # 判断数据是否正确
        self.common_page.wait_for_loading()
        user_table.compare_from_table(handoverDestData)

    def test_G_delete(self):
        # 获取数据
        delSrcData, delDestData = self.data_driver.get_data_from_xls("delete")

        # 高级查询筛选数据
        self.common_page.wait_for_loading()
        user_search = SearchForm(self.driver)
        user_search.advance_search(delSrcData)

        # 选中数据
        self.common_page.wait_for_loading()
        user_table = TableForm(self.driver)
        user_table.choose_from_table(0)

        # 删除数据
        self.common_page.wait_for_loading()
        self.common_page.delete_()

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