Exemplo n.º 1
0
 def test_Index_CommodityRetail(cls):
     '''验证首页商品零售'''
     basepage = BassPage(cls.driver)
     driver = IndexPage(cls)
     wait = WebDriverWait(cls.driver, 20)
     wait.until(lambda d: d.find_element_by_xpath('/html/body/div[2]/div[1]/header/div/div[1]/span/img'))
     basepage.click(driver.IndexClick)
     basepage.click(driver.Indexmerchant_all)
     projectreceipt = basepage.find_element(driver.RevenueData[2]).text
     projectreceipt_text = projectreceipt
     try:
         assert '商品零售' in projectreceipt_text
         print ('Test pass')
     except Exception as e:
         print ('Test fail', e)
     token = Get_Login()
     data = {}
     headers = {
         'Authorization': token.get_test_token()
     }
     r = requests.post('https://saas.ydm01.cn/api/home_page/index_revenue_data', data=data, headers=headers)
     project_receipt = r.json()
     try:
         assert str(project_receipt['dataGoodsRetail'][-1]['value']) in projectreceipt_text.replace(',', '')
         print ('Test pass')
     except Exception as e:
         print ('Test fail', e)
Exemplo n.º 2
0
 def test_AddCustomer(self):
     AddCustomers = AddCustomer()
     driver = Customer_page(self)
     Index = IndexPage(self)
     basepage = BassPage(self.driver)
     wait = WebDriverWait(self.driver, 20)
     wait.until(
         lambda d: d.find_element_by_xpath(Index.Customer.split('=>')[1]))
     basepage.click(Index.Customer)
     basepage.click(driver.NewAddCustomer)
     # js = 'document.querySelectorAll("form")[0].style.display="block";'
     # self.driver.execute_script(js)
     print(type(AddCustomers.CustomerName.split('=>')[1]))
     basepage.type(AddCustomers.CustomerName, u'测试姓名')
     basepage.type(AddCustomers.CustomerNames, u'测试昵称')
     time.sleep(3)
     s = random.randint(15900000000, 15910000000)
     r = requests.get(
         'https://saas.ydm01.cn/api/setting/addWhiteList?phone=%s' %
         (str(s)),
         params=None)
     basepage.type(AddCustomers.CustomerTelphone, str(s))
     basepage.click(AddCustomers.Preservation)
     Prompt = ''
     if basepage.find_element(AddCustomers.Prompt):
         Prompt = basepage.find_element(AddCustomers.Prompt).text.json()
     try:
         assert '请选择所属顾问门店' in Prompt
         print('Test pass')
     except Exception as e:
         print('Test fail', e)