def test_search_ad_after_release_ns_video_ad_3(self, testdata): ad_name = testdata.get("广告片名称") ad_duration = testdata.get("视频时长") filepath = testdata.get("视频文件路径") auto_create_name = testdata.get("是否自动生成广告片名称(Y|N)", "N") fn_name = helper.get_caller_name() if auto_create_name.upper() == 'Y'.upper(): ad_name = settings.AD_NAME_PREFIX + SerialNumbersGenerator().serial_numbers ipage = IndexPage(settings.URLS['首页']) ipage.actions.click_tabbar().sleep(1).click_home_tab().sleep(1) ipage.actions.click_make_ad_btn().sleep(1).click_notice_dialog_close_btn().sleep(1).screenshot('{}_选项页面_'.format(fn_name)) ipage.actions.click_select_upload_video_btn().sleep(2).input_upload_video_path(filepath).sleep(3) # 需要等待回到剪切界面 clip_page = ClipPage() clip_page.actions.preview().sleep(2).screenshot('{}_预览界面_'.format(fn_name)).sleep(3) ppage = PreviewPage() ppage.actions.input_title(ad_name).release().sleep(3).screenshot('{}_发布界面_'.format(fn_name)).sleep(3).confirm().sleep(10) home_page = HomePage() home_page.actions.sleep(1).data().sleep(1).adlist().sleep(2) al_page = ADListPage() rowinfo = { "ad_name": ad_name, "ad_duration": ad_duration, } al_page.actions.ad_name(ad_name).sleep(1).search().sleep(3).check_adlist_table(rowinfo)
def test_search_ad_with_special_chart(self, testdata): ad_number = testdata.get("广告编号查询输入框") home_page = HomePage() home_page.actions.sleep(1).data().sleep(1).adlist().sleep(2) al_page = ADListPage() al_page.actions.ad_number(ad_number).sleep(1).search().sleep(3).is_empty_table()
def test_search_with_parttext_ad_number(self, testdata): ad_number = testdata.get("广告编号(查询)") home_page = HomePage() home_page.actions.sleep(1).data().sleep(1).adlist().sleep(2) al_page = ADListPage() al_page.actions.ad_number(ad_number).sleep(1).search().sleep(3).is_empty_table()
def test_search_with_wrong_userid(self, testdata): userid = testdata.get("用户ID") home_page = HomePage() home_page.actions.sleep(1).data().sleep(1).adlist().sleep(2) al_page = ADListPage() al_page.actions.user_id(userid).sleep(1).search().sleep(3).is_empty_table()
def test_search_with_wrong_ad_name(self, testdata): s_name = testdata.get("广告名称(查询)") home_page = HomePage() home_page.actions.sleep(2).page.switch_current_window() home_page.actions.sleep(1).data().sleep(1).adlist().sleep(2) al_page = ADListPage() al_page.actions.ad_name(s_name).sleep(1).search().sleep(3).is_empty_table()
def test_search_with_right_ad_number(self, testdata): ad_number = testdata.get("广告编号") ad_name = testdata.get("广告名称") userid = testdata.get("用户ID") save_status = testdata.get("存储状态") home_page = HomePage() home_page.actions.sleep(20).page.switch_current_window() home_page.actions.sleep(1).data().sleep(1).adlist().sleep(2) al_page = ADListPage() rowinfo = { "ad_number": ad_number, "ad_name": ad_name, "user_id": userid, "save_status": save_status, } al_page.actions.ad_number(ad_number).sleep(1).search().sleep(3).check_adlist_table(rowinfo)
def test_search_with_right_ad_name(self, testdata): s_name = testdata.get("广告名称(查询)") suffix_regex = r"\(\d+\)$" home_page = HomePage() home_page.actions.sleep(2).page.switch_current_window() home_page.actions.sleep(1).data().sleep(1).adlist().sleep(2) expected_ads = helper.group_by_suffix_regex(testdata, suffix_regex, True, helper.digital_suffix_cmp_wrapper(lambda suffix: suffix.lstrip("(").rstrip(")"))) al_page = ADListPage() all_rowinfo = [] for expected_ad in expected_ads: all_rowinfo.append({ "ad_number": expected_ad.get("广告编号"), "ad_name": expected_ad.get("广告名称"), "user_id": expected_ad.get("用户ID"), "save_status": expected_ad.get("存储状态"), }) al_page.actions.ad_name(s_name).sleep(1).search().sleep(3).check_adlist_table(*all_rowinfo, check_total=True)