def step_impl(context, webapp_user_name, webapp_owner_name, integral_count):
    home_page = WAHomePage(context.webapp_driver)
    home_page.load()

    user_center_page = home_page.enter_user_center_page()
    actual = user_center_page.get_integral()

    expected = integral_count

    context.tc.assertEquals(expected, actual)
def step_impl(context, webapp_user_name, webapp_owner_name):
    home_page = WAHomePage(context.webapp_driver)
    home_page.load()

    user_center_page = home_page.enter_user_center_page()
    integral_log_page = user_center_page.enter_integral_log_page()
    actual = integral_log_page.get_logs()

    expected = json.loads(context.text)

    context.tc.assertEquals(expected, actual)
Example #3
0
	def not_test_webapp_04_ship_info(self):
		main_window = self.__start_preview_webapp()

		home_page = WAHomePage(self.driver)
		user_center_page = home_page.enter_user_center_page()
		ship_info_page = user_center_page.enter_ship_info_page()

		#验证收货人信息
		expected_ship_info = {
			'name': u'',
			'province': u'-1',
			'city': u'-1',
			'district': '-1',
			'address': u'',
			'tel': u''
		}
		actual_ship_info = ship_info_page.get_ship_info()
		self.assert_dict(expected_ship_info, actual_ship_info)

		#输入收货人信息
		expected_ship_info_huangrong = {
			'name': u'黄蓉',
			'province': u'江苏省',
			'city': u'无锡市',
			'district': u'滨湖区',
			'address': u'大街',
			'tel': u'13844332211'
		}
		ship_info_page.input_ship_info(expected_ship_info_huangrong)
		user_center_page = ship_info_page.submit()		
		
		#重新进入收货人页面
		ship_info_page = user_center_page.enter_ship_info_page()
		actual_ship_info = ship_info_page.get_ship_info()
		self.assert_dict(expected_ship_info_huangrong, actual_ship_info)

		'''
		开始购物
		'''
		#清空收货人信息
		ship_info = ShipInfo.objects.all().order_by('-id')[0]
		ship_info.ship_name = ''
		ship_info.ship_tel = ''
		ship_info.ship_address = ''
		ship_info.area = ''
		ship_info.save()
		#开始购物
		def hook_pay_order_page_1(pay_order_page, options):
			return True
		options = {
			'product': u'东坡肘子',
			'purchase_count': 1,
			'hook_pay_order_page': hook_pay_order_page_1
		}
		ship_info_page.return_to_webapp_home_page()
		home_page = self.__buy(options)

		'''
		进入收货人信息页面,验证收货人信息被修改
		'''
		user_center_page = home_page.enter_user_center_page()
		ship_info_page = user_center_page.enter_ship_info_page()
		expected_ship_info_guojing = {
			'name': u'郭靖',
			'province': u'北京市',
			'city': u'北京市',
			'district': u'东城区',
			'address': u'长安大街',
			'tel': u'13811223344'
		}
		actual_ship_info = ship_info_page.get_ship_info()
		self.assert_dict(expected_ship_info_guojing, actual_ship_info)
		#将收货人修改为"黄蓉"
		ship_info_page.input_ship_info(expected_ship_info_huangrong)
		user_center_page = ship_info_page.submit()

		'''
		再次购物
		'''
		#开始购物
		def hook_edit_order_page(edit_order_page, options):
			actual_ship_info = ship_info_page.get_ship_info()
			self.assert_dict(expected_ship_info_huangrong, actual_ship_info)
			return False
		def hook_pay_order_page_2(pay_order_page, options):
			return True
		options = {
			'product': u'武昌鱼',
			'purchase_count': 1,
			'ignore_default_ship_info': True,
			'hook_pay_order_page': hook_pay_order_page_2
		}
		ship_info_page.goto_webapp_home_page()
		home_page = self.__buy(options)

		'''
		进入订单页面,验证两个订单的收货人不一样
		'''
		#验证第一个订单
		user_center_page = home_page.enter_user_center_page()
		order_list_page = user_center_page.enter_all_order_list_page()
		pay_order_page = order_list_page.enter_order_page_by_index(1)
		order_info = pay_order_page.get_order_info()
		self.assertEquals(u'黄蓉 13844332211 江苏省 无锡市 滨湖区 大街', order_info['ship_info'])
		self.assertEquals(u'武昌鱼', order_info['products'][0]['name'])
		#验证第二个订单
		home_page = pay_order_page.goto_webapp_home_page()
		user_center_page = home_page.enter_user_center_page()
		order_list_page = user_center_page.enter_all_order_list_page()
		pay_order_page = order_list_page.enter_order_page_by_index(2)
		order_info = pay_order_page.get_order_info()
		self.assertEquals(u'郭靖 13811223344 北京市 北京市 东城区 长安大街', order_info['ship_info'])
		self.assertEquals(u'东坡肘子', order_info['products'][0]['name'])

		#结束测试
		self.__finish_preview_webapp(main_window)