コード例 #1
0
class TestContact:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

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

    @pytest.mark.parametrize(("name", "phone"),
                             analyze_file("contact_data", "test_add_contact"))
    def test_add_contact(self, name, phone):
        self.page.contact_list.click_add_contact()
        self.page.add_contact.input_name(name)
        self.page.add_contact.input_phone(phone)
        # 截图添加到报告
        self.driver.get_screenshot_as_file("./screen/xx.png")
        # 添加到报告上
        with open("./screen/xx.png", 'rb') as f:
            allure.attach('描述', f.read(), allure.attach_type.PNG)
        # allure.attach('描述', self.driver.get_screenshot_as_png(), allure.attach_type.PNG)

    @pytest.mark.parametrize(("nickname", "phone"),
                             analyze_file("contact_data", "test_add_nickname"))
    def test_add_nickname(self, nickname, phone):
        self.page.contact_list.click_add_contact()
        self.page.add_contact.input_nickname(nickname)
        self.page.add_contact.input_phone(phone)
コード例 #2
0
class TestLogin:
    def setup(self):
        self.driver = init_driver(False)
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(5)
        self.driver.quit()

    # def test_login_if_not(self):
    #     self.page.home.login_is_not(self.page)

    @pytest.mark.parametrize("args",
                             analyze_file("login_data.yaml", "test_login"))
    def test_login(self, args):
        username = args["username"]
        password = args["password"]
        toast = args["toast"]
        self.page.home.click_me()
        self.page.register.click_register()
        self.page.login.input_username(username)
        self.page.login.input_password(password)
        self.page.login.click_login_btn()

        # 断言
        if toast is None:
            assert self.page.me.get_nick_name_text_view() == username
        else:
            assert self.page.login.is_toast_exist(toast)
コード例 #3
0
class TestLogin:
    """
    登录没的可说的
    """
    def setup(self):
        self.driver = init_driver(no_reset=False)
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(2)
        self.driver.quit()

    # def test_hello(self):
    #     self.page.home.login_if_not(self.page)
    @pytest.mark.parametrize("args",
                             analyze_file("login_data.yaml", "test_login"))
    def test_login(self, args):
        username = args["username"]
        password = args["password"]
        toast = args["toast"]
        # self.page.img.click_img()
        self.page.home.click_me()
        self.page.register.click_login()
        self.page.login.input_username(username)
        self.page.login.input_password(password)
        self.page.login.click_login()
        if toast is None:
            assert self.page.me.get_nick_name_text() == username, "登录的和输入的不一致"
        else:
            self.page.login.is_toast_exist(toast)
コード例 #4
0
class TestLogin:
    def setup(self):
        #重置             不充值么  不 --> 充值
        self.driver = init_driver(no_reset=False)

        # self.driver = init_driver(no_reset=True)
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(3)
        self.driver.quit()

    @pytest.mark.parametrize("args",analyze_file("login_data.yaml","test_login"))
    def test_login(self,args):
        #yaml数据
        username = args["username"]
        password  =args["password"]
        toast = args["toast"]
        #脚本流程
        self.page.home.click_me()
        self.page.register.go_register()
        self.page.login.login_upc(username,password)
        #toast
        if toast is None:
            assert self.page.me.get_nick_name_text() == username,"登录后的用户名和输入的用户民不一致"
        else:
            assert self.page.login.is_toast_exist(toast)
コード例 #5
0
ファイル: test_massage.py プロジェクト: chenst0120/poapp
class TestMassage:
    def setup(self):
        self.driver = driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(3)
        self.driver.quit()

    # 严重级别
    @pytest.allure.severity(pytest.allure.severity_level.CRITICAL)
    # @pytest.mark.parametrize(("reps", "cont"),[("110","0"),("120","1")])
    @pytest.mark.parametrize("arge",
                             analyze_file("massage_data.yaml", "test_massage"))
    def test_send_massage(self, arge):
        reps = arge["reps"]
        cont = arge["cont"]
        print(reps)
        print(cont)

        # 点击新建短信
        self.page.massage.click_new_massage()

        # 输入 接收人
        self.page.new_massage.input_recipients(reps)

        # 输入 内容
        self.page.new_massage.input_content(cont)

        # 点击发送
        self.page.new_massage.click_send()

        # 断言
        assert cont == self.page.new_massage.get_content_efit_text()
コード例 #6
0
class TestVip:

    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(2)
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("vip_data.yaml", "test_vip"))
    def test_vip(self, args):

        keyword = args["keyword"]
        expect = args["expect"]

        # 如果没有登录 去登陆
        self.page.home.login_if_not(self.page)
        # 我 点击 加入vip
        self.page.me.click_be_vip()
        # 切换 web环境
        self.driver.switch_to.context("WEBVIEW_com.yunmall.lc")
        # vip 输入 邀请码
        self.page.vip.input_invite(keyword)
        # vip 点击 加入会员
        self.page.vip.click_be_vip()

        # 断言,"邀请码输入不正确" 是否在 page_source 中
        assert self.page.vip.is_keyword_in_page_source(expect), "%s不在page_source中" % expect

        # 切换 原生环境
        self.driver.switch_to.context("NATIVE_APP")
コード例 #7
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):  #  后置处理方法,用例执行结束自动执行此处的方法,如:用例执行完毕后自动退出
        time.sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("login_data.yaml", "test_login")) # 此处是引用了参数化,调用data数据
    def test_login(self,args):

        phone_num = args["phone"]
        pwd = args["pwd"]
        # toast = args["toast"]

        #进入登陆页面
        #1.点击快递员登录
        self.page.home.click_courier_login_btn()
        time.sleep(3)
        #点击账号登录
        self.page.login.click_acc_login_btn()
        #输入手机号
        self.page.login_info.input_phone(phone_num)
        #输入密码
        self.page.login_info.input_pwd(pwd)
        #点击登录
        self.page.login_info.click_login_btn()
        time.sleep(2)
        #判断当前页面是否有关键字【角色选择】,有则点击【快递员】
        self.page.cour_menu.if_role_exist()
コード例 #8
0
class TestLogin:
    def setup(self):
        self.driver = init_driver(no_reset=False)
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("login_data.yaml", "test_login"))
    def test_login(self, args):

        # 解析 yaml 的数据
        username = args["username"]
        password = args["password"]
        toast = args["toast"]

        # 脚本流程
        self.page.home.click_me()
        self.page.register.click_login()
        self.page.login.input_username(username)
        self.page.login.input_password(password)
        self.page.login.click_login()

        if toast is None:
            assert self.page.me.get_nick_name_text(
            ) == username, "登录后的用户名和输入的用户民不一致"
        else:
            # 找toast提示,找args中的toast提示是否能找到,如果能则通过,如果不能则不通过
            assert self.page.login.is_toast_exist(toast)
コード例 #9
0
ファイル: test_to_be_member.py プロジェクト: xiaoxiaceshi/-
class TestToBeMember:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(3)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("vip_data.yaml",
                                          "test_to_be_member"))
    def test_to_be_member(self, args):
        keyword = args['keyword']
        expect = args['expect']

        self.page.home.login_if_not(self.page)
        self.page.me.click_vip()
        time.sleep(5)
        # 切换到webview
        self.driver.switch_to.context("WEBVIEW_com.yunmall.lc")
        self.page.vip.input_invitecode(keyword)
        self.page.vip.click_to_be_member()
        assert self.page.vip.is_keyword_in_page_source(
            expect), "%s不在page_source中" % expect
        # 切换到到原生
        self.driver.switch_to.context("NATIVE_APP")
コード例 #10
0
class TestSearch:
    def setup(self):
        self.driver = init_driver(no_reset=True)
        self.page = Page(self.driver)

    def teardown(self):
        sleep(2)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("search_data.yaml", "test_search"))
    def test_search(self, args):
        keyword = args["keyword"]
        self.page.get_home_page_instance.login_if_not(self.page)
        self.page.get_home_page_instance.page_click_home_button()
        self.page.get_home_page_instance.page_click_search_button()
        self.page.get_search_page_instance.page_input_search_keyword(keyword)
        self.page.get_search_page_instance.page_click_search_button()
        time.sleep(2)
        self.page.get_search_page_instance.page_click_back_button()
        assert self.page.get_search_page_instance.page_is_search_keyword_exist(
            keyword)

    def test_delete_history(self):
        self.page.get_home_page_instance.login_if_not(self.page)
        self.page.get_home_page_instance.page_click_home_button()
        self.page.get_home_page_instance.page_click_search_button()
        self.page.get_search_page_instance.page_input_search_keyword("面膜")
        self.page.get_search_page_instance.page_click_search_button()
        time.sleep(2)
        self.page.get_search_page_instance.page_click_back_button()
        self.page.get_search_page_instance.page_click_delete_history_button()
        assert self.page.get_search_page_instance.page_is_feature_exist()
コード例 #11
0
class TestLogin:
    def setup(self):
        # 确认应用是否需要刷新,TRUE=不刷新,FALSE=刷新
        self.driver = init_driver(False)
        self.page = Page(self.driver)

    def teardown(self):
        sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("login_data.yaml", "test_login"))
    def test_login(self, args):
        username = args["username"]
        password = args["password"]
        toast = args["toast"]
        self.page.home.page_home_click_me()
        self.page.register.page_go_login()
        self.page.login.page_login_input_username(username)
        self.page.login.page_login_input_password(password)
        self.page.login.page_login()
        if toast is None:
            assert self.page.me.get_nick_name_text_view() == username, "登录用户名不一致"
        else:
            self.page.login.page_login_find_toast(toast)
            self.page.login.page_login_get_toast(toast)
コード例 #12
0
ファイル: test_login.py プロジェクト: liuzhaowen/aolai2019
class TestLogin:

    def setup(self):
        self.driver = init_driver(no_reset=False)
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("login_data.yaml", "test_login"))
    def test_login(self, args):

        username = args["username"]
        password = args["password"]
        toast = args["toast"]

        # home - 点击我
        self.page.home.click_me()
        # register - 点击去登录
        self.page.register.click_to_login()
        # login - 输入用户名
        self.page.login.input_username(username)
        # login - 输入密码
        self.page.login.input_password(password)
        # login - 点击登录
        self.page.login.click_login_btn()

        # 断言操作
        if not toast:
            assert self.page.me.get_nick_name() == "itheima_test"
        else:
            assert self.page.login.is_toast_exist(toast)
コード例 #13
0
ファイル: test_login.py プロジェクト: lhdtesting/bainianaolai
class TestLogin:

    def setup(self):
        self.driver = init_driver(no_reset=False)
        self.page = Page(self.driver)

    def teardown(self):
        sleep(2)
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("login_data.yaml", "test_login"))
    def test_login(self, args):
        username = args["username"]
        password = args["password"]
        toast = args["toast"]
        self.page.get_home_page_instance.page_click_me_button()
        self.page.get_register_page_instance.page_click_login_btn()
        self.page.get_login_page_instance.page_input_username(username)
        self.page.get_login_page_instance.page_input_password(password)
        self.page.get_login_page_instance.page_click_login_btn()

        if toast is None:
            assert username == self.page.get_person_center_page_instance.page_get_nickname()
        else:
            assert self.page.get_login_page_instance.is_toast_exist(toast)
コード例 #14
0
class TestVip:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(3)
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("all_data.yaml", "test_vip"))
    def test_vip(self, args):
        # 如果没有登录 去登陆
        self.page.home.login_if_not(self.page)
        # 我 点击 加入vip
        self.page.me.click_vip()
        # print(self.driver.contexts)
        # # 切换 web环境
        # self.driver.switch_to.context("WEBVIEW_com.yunmall.lc")
        # # vip 输入 邀请码
        # self.page.vip.input_invite(args["keyword"])
        # # vip 点击 加入会员
        # self.page.vip.click_bevip()
        time.sleep(5)
        self.page.vip.input_invite2(args["keyword"])
        time.sleep(5)
        self.page.vip.click_bevip2()
        # 断言
        assert self.page.vip.is_keyword_inpage(
            args["expect"]), "你输入的邀请码不在page_source中"
コード例 #15
0
class TestLogin:
    def setup(self):
        # 确认应用是否需要刷新,TRUE=不刷新,FALSE=刷新
        self.driver = init_driver(True)
        self.page = Page(self.driver)

    def teardown(self):
        sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("version_update_data.yaml",
                                          "test_login"))
    def test_login(self, args, page, my_current_activity):
        username = args["username"]
        password = args["password"]
        toast = args["toast"]
        # 没登录登录
        self.page.home.page_login_if_not(page, my_current_activity, username,
                                         password)
        # 点击设置
        self.page.me.click_setting_button()
        # 找到关于奥莱并点击
        self.page.setting.page_setting_scroll_find_click()
        # 点击最新版本
        self.page.setting.click_new_version()
        # 判断提示存在
        self.page.setting.find_toast()
        # 获得提示内容
        self.page.setting.get_toast()
コード例 #16
0
class TestLogin:
    def setup(self):
        self.driver = init_driver(no_reset=False)
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize('args',
                             analyze_file("login_data.yaml", 'test_login'))
    def test_login(self, args):

        username = args['username']
        password = args['password']
        toast = args['toast']

        self.page.homepage.click_me_btn()

        self.page.zhucepage.click_btn_ok_me()

        self.page.loginpage.input_username(username)
        self.page.loginpage.input_password(password)
        self.page.loginpage.click_button()

        if toast is None:
            assert self.page.mepage.get_me_page_me() == username
        else:
            assert self.page.loginpage.is_toast_exist(toast)
コード例 #17
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(3)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("login_data.yaml", "test_login"))
    def test_login(self, args):
        # 解析
        username = args["username"]
        password = args["password"]
        toast = args["toast"]

        # 点击我的
        self.page.first.click_me()
        # 点击已有账户去登陆
        self.page.to_login.click_to_login()
        # 输入用户名
        self.page.login.input_username(username)
        # 输入密码
        self.page.login.input_password(password)
        # 点击登录
        self.page.login.click_login_button()
        #断言
        if toast is None:
            assert self.page.me.get_nick_name() == username, "登录后用户名和输入用户名不一致"
        else:
            assert self.page.login.is_toast_exist(toast)
コード例 #18
0
class TestLogin:
    def setup(self):
        self.driver = init_driver(False)
        self.page_login = Page(self.driver)

    def teardown(self):
        sleep(2)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("login_data.yaml", "test_login"))
    def test_login(self, args):
        username = args["username"]
        password = args["password"]
        toast = args["toast"]
        # 关闭 更新
        self.page_login.page_home.page_home_click_close()
        # 点击 我
        self.page_login.page_home.page_home_click_me()
        # 点击 已有账号,去登陆
        self.page_login.page_register.page_register_go_login()
        # 输入 用户名
        self.page_login.page_login.page_login_input_username(username)
        # 输入 密码
        self.page_login.page_login.page_login_input_password(password)
        # 点击 登录 按钮
        self.page_login.page_login.page_login_click_login()

        # 判断登录是否正确
        if toast is None:
            # 断言
            assert self.page_login.page_my.page_my_get_nick_name(
            ) == "itheima_test", "登录后的用户名与输入的用户名不一致"
        else:
            assert self.page_login.page_login.base_is_toast_exist(toast)
コード例 #19
0
class TestSearch:
    def setup(self):
        self.driver=init_driver()
        self.page=Page(self.driver)
    def teardown(self):
        time.sleep(1)
        self.driver.quit()

    @pytest.mark.parametrize("args",analyze_file("seatch_data.yaml","test_search"))
    def test_search(self,args):
        ketword=args["keyword"]
        self.page.home.login_if_not(self.page)
        self.page.home.click_home()
        self.page.home.click_search()
        self.page.search.input_keyword(ketword)
        self.page.search.click_search()
        time.sleep(1)
        self.page.search.press_back()
        time.sleep(1)
        assert self.page.search.is_keyword_exist(ketword)
    def test_search_del(self):
        self.page.home.login_if_not(self.page)
        self.page.home.click_home()
        self.page.home.click_search()
        self.page.search.input_keyword()
        self.page.search.click_search()
        time.sleep(1)
        self.page.search.press_back()
        self.page.search.click_search_del()
        assert self.page.search.is_search_record_empty()
コード例 #20
0
ファイル: test_post.py プロジェクト: dorazhouzhou/post_test
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):  #  后置处理方法,用例执行结束自动执行此处的方法,如:用例执行完毕后自动退出
        time.sleep(7)
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("exp_id_data.yaml", "test_post")) # 此处是引用了参数化,调用data数据
    def test_post(self,args):

        phone_num = args["phone"]
        pwd = args["pwd"]
        express_id = args["express_id"]
        rcp_phone = args["rcp_phone"]
        rcp_phone_confirm = args["rcp_phone_confirm"]

        # toast = args["toast"]

        # 进入首页
        # 1.快递员登录
        self.page.home.click_courier_login_btn()
        time.sleep(3)
        # 点击账号登录
        self.page.login.click_acc_login_btn()
        # 输入手机号
        self.page.login_info.input_phone(phone_num)
        # 输入密码
        self.page.login_info.input_pwd(pwd)
        # 点击登录
        self.page.login_info.click_login_btn()
        time.sleep(2)
        self.page.cour_menu.if_role_exist()

        # 2.快递员派件
        self.page.cour_menu.if_role_exist()
        #点击派件按钮
        self.page.cour_menu.click_post_btn()
        #选择格口
        self.page.post_choose_position.click_room_position_btn()
        #请输入快递运单号
        self.page.post_scan_exp_id.post_input_exp_id(express_id)
        time.sleep(3)
        #点击完成
        self.page.post_scan_exp_id.click_finish_btn()
        time.sleep(3)
        #输入收件人手机号
        self.page.post_input_phone.post_input_rcp_phone(rcp_phone)
        #再次输入收件人手机号
        self.page.post_input_phone.post_input_rcp_phone_again(rcp_phone_confirm)
        #点击下一步
        self.page.post_input_phone.click_next_step_btn()
        time.sleep(2)
        #点击已投递
        self.page.post_confirm.click_hv_post_btn()
コード例 #21
0
class TestContact:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(2)
        self.driver.quit()

    @pytest.mark.parametrize(("name", "phone"),
                             analyze_file("contact_data", "test_add_contact"))
    def test_add_contact(self, name, phone):
        self.page.contact_list.click_add_contact()
        self.page.add_contact.input_name(name)
        self.page.add_contact.input_phone(phone)

    @pytest.mark.parametrize(("nickname", "phone"),
                             analyze_file("contact_data", "test_add_nickname"))
    def test_add_nickname(self, nickname, phone):
        self.page.contact_list.click_add_contact()
        self.page.add_contact.input_nickname(nickname)
        self.page.add_contact.input_phone(phone)
コード例 #22
0
class TestSearch:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(3)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("search_data.yaml", "test_search"))
    def test_search(self, args):
        keyword = args["keyword"]
        # 登录判断
        self.page.home.login_if_not(self.page)
        # 点击首页
        self.page.home.click_home()
        # 点击放大镜
        self.page.home.click_search()

        # 输入内容
        self.page.search.input_keyword(keyword)
        # 点击搜索
        self.page.search.click_search()
        time.sleep(3)
        # 返回
        self.page.search.press_back()
        time.sleep(3)
        # 断言 搜索的关键字,是不是存在在搜索的页面
        assert self.page.search.is_keyword_exist(keyword)

    def test_del_search(self):
        # 登录判断
        self.page.home.login_if_not(self.page)
        # 点击首页
        self.page.home.click_home()
        # 点击放大镜
        self.page.home.click_search()
        # 输入内容
        self.page.search.input_keyword("男鞋")
        # 点击搜索
        self.page.search.click_search()
        time.sleep(3)
        # 返回
        self.page.search.press_back()

        # 删除搜索记录
        self.page.search.click_del_search()

        # 断言 是否还有搜索历史
        assert self.page.search.is_search_empty()
コード例 #23
0
class TestSearch:

    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    # def teardown(self):
    #     time.sleep(2)
    #     self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("search_data.yaml", "test_search"))
    def test_search(self, args):
        keyword = args["keyword"]

        #   首页 如果没有登录就登录
        self.page.home.login_if_not(self.page)
        #   我 - 点击首页
        self.page.home.click_home()
        #   首页 - 点击放大镜
        self.page.home.click_search()
        #   搜索 - 输入文字
        self.page.search.input_keyword(keyword)
        #   搜索 - 点击搜索按钮
        self.page.search.click_search()
        #   搜索界面之后正在加载网络,等待2秒再执行返回
        #   搜索 - 返回
        self.page.search.press_back()

        #   断言 搜索的关键字,是不是存在在搜索的页面
        assert self.page.search.is_keyword_exist(keyword)

    def test_search_del(self):
        #   添加搜索记录
        #   首页 如果没有登录就登录
        self.page.home.login_if_not(self.page)
        #   我 - 点击首页
        self.page.home.click_home()
        #   首页 - 点击放大镜
        self.page.home.click_search()
        #   搜索 - 输入文字
        self.page.search.input_keyword("MK")
        #   搜索 - 点击搜索按钮
        self.page.search.click_search()
        #   搜索界面之后正在加载网络,等待2秒再执行返回
        #   搜索 - 返回
        self.page.search.press_back()

        #   删除操作
        self.page.search.click_search_del()
        #   断言 搜索记录是否为空
        assert self.page.search.is_search_record_empty()
コード例 #24
0
class TestShopCart:

    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(3)
        self.driver.quit()

    @pytest.mark.parametrize("args",analyze_file("search_data.yaml","test_search"))
    def test_search(self,args):
        keyword = args["keyword"]
        # 首页,如果没有登录就登录
        self.page.first.is_not_login(self.page)
        # 我 - 点击首页
        self.page.first.click_home()
        # 首页 - 点击放大镜
        self.page.first.click_search()
        # 搜索 - 输入文字
        self.page.search.input_keyword(keyword)
        # 搜索 - 点击搜索按钮
        self.page.search.click_search()
        # 搜索 - 返回
        self.page.search.press_back()

        # 断言 搜索的关键字,是不是存在在搜索的页面
        assert self.page.search.is_keyword_exist(keyword)

    def test_search_del(self):
        # 添加搜索记录
        # 首页,如果没有登录就登录
        self.page.first.is_not_login(self.page)
        # 我 - 点击首页
        self.page.first.click_home()
        # 首页 - 点击放大镜
        self.page.first.click_search()
        # 搜索 - 输入文字
        self.page.search.input_keyword("nike")
        # 搜索 - 点击搜索按钮
        self.page.search.click_search()
        # 搜索 - 返回
        self.page.search.press_back()

        # 删除操作
        self.page.search.click_search_del()
        # 断言 搜索记录是否为空
        assert self.page.search.is_search_record_empty()
コード例 #25
0
class TestSearch:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    # def teardown(self):
    #     time.sleep(2)
    #     self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("search_data.yaml", "test_search"))
    def test_search(self, args):
        keyword = args["keyword"]

        # 首页,如果没有登录就登录
        self.page.home.login_if_not(self.page)
        # 我 - 点击首页
        self.page.home.click_home()
        # 首页 - 点击放大镜
        self.page.home.click_search()
        # 搜索 - 输入文字
        self.page.search.input_keyword(keyword)
        # 搜索 - 点击搜索按钮
        self.page.search.click_search()
        # 点击 返回
        self.page.search.press_back()
        # 断言
        assert self.page.search.is_keyword_exist(keyword)

    def test_search_del(self):
        # 首页,如果没有登录就登录
        self.page.home.login_if_not(self.page)
        # 我 - 点击首页
        self.page.home.click_home()
        # 首页 - 点击放大镜
        self.page.home.click_search()
        # 搜索 - 输入文字
        self.page.search.input_keyword("面膜")
        # 搜索 - 点击搜索按钮
        self.page.search.click_search()
        # 点击 返回
        self.page.search.press_back()
        # 删除操作
        self.page.search.click_search_del()
コード例 #26
0
class TestContact:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

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

    @pytest.mark.parametrize('args',
                             analyze_file("contact_data.yaml", "test_contact"))
    def test_contact(self, args):
        name = args["name"]
        tel = args["tel"]
        self.page.contactpage.click_add_contact()
        self.page.newcontactpage.input_name_text(name)
        self.page.newcontactpage.input_phone_text(tel)
        self.page.newcontactpage.click_back_button()

        assert name == self.page.savedcontactpage.get_phone_name_text()
コード例 #27
0
ファイル: test_login.py プロジェクト: shon-xwy/demo_test
class TestLogin:
    def setup(self):
        self.driver = init_driver(False)
        self.page = Page(self.driver)

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

    @allure.step('登录成功的用例')
    @pytest.mark.parametrize("args",
                             analyze_file('login_data.yaml', 'test_login'))
    def test_login_success(self, args):
        username = args['username']
        password = args['password']
        self.page.home.click_login_button()
        self.page.login.input_name(username)
        self.page.login.input_pwd(password)
        self.page.login.click_login_button()
        # self.page.login.click_yihouzaishuo()
        assert self.page.home.find_login_button() == False
コード例 #28
0
class TestNewContacts:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("test_new_contacts.yaml",
                                          "test_new_contacts"))
    def test_new_contacts(self, args):
        name = args["name"]
        mobile = args["mobile"]
        self.page.address_book.add_contacts()
        self.page.new_contacts.name(name)
        self.page.new_contacts.mobile(mobile)
        self.page.new_contacts.back()
        assert name == self.page.new_success.name()
コード例 #29
0
class TestVip:
    def setup(self):
        self.driver = init_driver(False)
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_file("vip_data.yaml", "test_vip"))
    def test_vip(self, args):
        code = args["code"]
        expect = args["expect"]
        self.page.home.login_is_not(self.page)
        time.sleep(3)
        self.page.me.click_be_vip_btn()
        self.driver.switch_to.context("WEBVIEW_com.yunmall.lc")
        self.page.vip.input_invite_code(code)
        self.page.vip.click_invite_vip_btn()
        assert self.page.vip.is_keyword_in_page_source(expect)
        self.driver.switch_to.context("NATIVE_APP")
コード例 #30
0
class TestContact:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        time.sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("args",
                             analyze_file("contact_data.yml",
                                          "test_add_contact"))
    def test_add_contact(self, args):
        name = args["name"]
        phone = args["phone"]

        self.page.contact.click_add_contact()
        self.page.new_contact.input_name(name)
        self.page.new_contact.input_phone(phone)
        self.page.new_contact.click_back()
        assert name == self.page.saved_contect.get_name_title_text()