def test_01(self): """ 步骤: 1、美购首页 2、品类聚合 3、搜索框 4、点击热词 :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(begin_date) testbuild = TodolistBuild(self.driver) testbuild. click_alert() testbuild.click_meigou() time.sleep(5) testbuild.click_czsl() testbuild.click_search() time.sleep(2) testbuild.click_hot_search() time.sleep(5) self.driver.background_app(5) time.sleep(5) # 美购搜索 埋点 result = mysql_test.query(action='search_result_open', event_time=begin_date) assert result != ' ', 'search_result_open事件为空!'
def test_01(self): """ 步骤: 1、美购首页 2、刷新 3、美购首页浏览事件记一次 :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') testbuild = TodolistBuild(self.driver) testbuild.click_alert() # 点击美购首页 testbuild.click_meigou() testbuild.switch_android_up() time.sleep(2) self.driver.background_app(5) # 将app置于后台5秒钟,再唤起到前台 result = mysql_test.query(action='page_view', event_time=begin_date, page_name='welfare_home') print(result) end_page_view2 = result[0]['params'] referrer3 = end_page_view2['referrer'] referrer_page_name = end_page_view2['page_name'] assert referrer3 == 'home', 'referrer获取错误!' assert referrer_page_name == 'welfare_home', 'page_name获取错误!' assert len(result) == 1, f'埋点数量错误,预期为1个,实际为{len(result)}'
def test_01(self): """ 美购首页->品类聚合除皱廋脸 美购列表pv事件 :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') testbuild = TodolistBuild(self.driver) testbuild.click_alert() testbuild.click_meigou() testbuild.click_czsl() time.sleep(10) self.driver.background_app(5) time.sleep(10) result = mysql_test.query(action='page_view', event_time=begin_date, page_name='welfare_list') print(result) end_page_view2 = result[0]['params'] referrer = end_page_view2['referrer'] page_name = end_page_view2['page_name'] assert referrer == 'welfare_home', 'referrer获取错误!' assert page_name == 'welfare_list', 'page_name获取错误!' assert len(result) == 1, f'埋点数量错误,预期为1个,实际为{len(result)}'
def test_01(self): """ 首页, 退出 :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') testbuild = TodolistBuild(self.driver) testbuild.click_alert() time.sleep(10) result = mysql_test.query(action='device_opened', event_time=begin_date) print(result) end_page_view = result[0]['app'] serial_id = end_page_view['serial_id'] assert serial_id != ' ', 'serial_id为空!' assert len(result) == 1, f'埋点数量错误,预期为1个,实际为{len(result)}'
def test_01(self): """ 首页----点击日记 :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(begin_date) testbuild = TodolistBuild(self.driver) testbuild.click_alert() time.sleep(10) testbuild.click_home_diary() time.sleep(10) self.driver.background_app(5) time.sleep(10) result = mysql_test.query(action='page_view', event_time=begin_date, page_name='diary_detail') print(result) end_page_view2 = result[0]['params'] referrer2 = end_page_view2['referrer'] referrer_tab_name2 = end_page_view2['referrer_tab_name'] assert referrer2 == 'home', 'referrer获取错误!' assert referrer_tab_name2 == '精选', 'referrer_tab_name获取错误!' assert len(result) == 1, f'埋点数量错误,预期为1个,实际为{len(result)}' print("page_view: %s" % end_page_view2)
def test_01(self): """ 首页, 刷新 :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(begin_date) testbuild = TodolistBuild(self.driver) testbuild.click_alert() time.sleep(3) testbuild.switch_android_up() time.sleep(2) self.driver.background_app(5) time.sleep(10) result = mysql_test.query(action='page_view', event_time=begin_date, page_name='home') print(result) end_page_view2 = result[0]['params'] referrer2 = end_page_view2['page_name'] assert referrer2 == 'home', 'page_name获取错误!' assert len(result) == 1, f'埋点数量错误,预期为1个,实际为{len(result)}'
def test_01(self): """ 步骤: 1、打开搜索结果页 2、下拉刷新一次,退出搜索结果页 3、首页浏览事件记一次 :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(begin_date) testbuild = TodolistBuild(self.driver) testbuild.click_alert() testbuild.click_meigou() time.sleep(5) testbuild.click_search() time.sleep(2) testbuild.switch_android_up() time.sleep(5) self.driver.background_app(5) time.sleep(5)
def test_01(self): """ 美购首页->品类聚合除皱廋脸 美购首页点击事件 此埋点丢失 :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') testbuild = TodolistBuild(self.driver) testbuild.click_alert() testbuild.click_meigou() testbuild.click_czsl() time.sleep(10) self.driver.background_app(5) time.sleep(10) result = mysql_test.query(action='welfare_home_click_section', event_time=begin_date) print(result) assert len(result) == 1, f'埋点数量错误,预期为1个,实际为{len(result)}'
def test_01(self): """ 点击首页搜索 :return: """ testbuild = TodolistBuild(self.driver) testbuild.click_alert() time.sleep(10) begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') time.sleep(5) testbuild.home_search() self.driver.background_app(5) result = mysql_test.query(action='on_click_navbar_search', event_time=begin_date) print(result) assert len(result) == 1, f'埋点数量错误,预期为1个,实际为{len(result)}'
def test_01(self): """ 首页品类聚合->点击玻尿酸 打开首页进入任意二级页面,首页的浏览事件记一次 """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(begin_date) testbuild = TodolistBuild(self.driver) testbuild.click_alert() time.sleep(10) testbuild.click_bns() time.sleep(3) self.driver.background_app(5) time.sleep(10) result = mysql_test.query(action='page_view', event_time=begin_date, page_name='home') print(result) end_page_view2 = result[0]['params'] referrer_page_name = end_page_view2['page_name'] assert referrer_page_name == 'home', 'page_name获取错误!' assert len(result) == 1, f'埋点数量错误,预期为1个,实际为{len(result)}'
def testbuild(self): """ 步骤: 1、美购首页 2、搜索框 4、点击热词 5、切换医生tab :return: """ begin_date = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') testbuild = TodolistBuild(self.driver) testbuild.click_alert() testbuild.click_meigou() testbuild.click_welfare_home_search() # 偶现失败 testbuild.click_doctor() testbuild.click_hot_search() # 偶现失败 time.sleep(5) self.driver.background_app(5) time.sleep(5) # 搜索框 埋点 result = mysql_test.query(action='search_result_open', event_time=begin_date) assert result != ' ', 'search_result_open事件为空!'