Пример #1
0
 def setup(self):
     self.main = MainPage()
     ran_util = RandomUtil()
     self.str_name = ran_util.get_random_str_num(4, 2)
     self.acct_num = ran_util.get_random_num(9)
     self.mail = ran_util.get_random_num(9)
     self.path = GetPath().get_path('../test.xls')
Пример #2
0
class TestCase:
    def setup(self):
        self.main = MainPage()
        ran_util = RandomUtil()
        self.str_name = ran_util.get_random_str_num(4, 2)
        self.acct_num = ran_util.get_random_num(9)
        self.mail = ran_util.get_random_num(9)
        self.path = GetPath().get_path('../test.xls')

    def test_add_member(self):
        assert self.str_name in self.main.goto_add_member([
            '添加成员'
        ]).add_memeber(['姓名', '帐号', '邮箱', '保存'],
                       [self.str_name, self.acct_num, f'{self.mail}@qq.com'
                        ]).get_member(['姓名'], ['title'])

    def test_upload_file(self):
        assert 'test.xls' == self.main.goto_import_contact(
            ['导入通讯录']).upload_file(['上传文件', '获取文件名'], [self.path])

    def test_delete_member(self):
        before_names = self.main.goto_contacts(['通讯录']).get_member(['姓名'],
                                                                   ['title'])
        before_names.pop()  # 去除微信的本人,避免删除失败
        after_names = self.main.goto_contacts(['通讯录']).delete_member(
            ['勾选框', '删除', '删除确认'],
            [choice(before_names)]).get_member(['姓名'], ['title'])
        assert 0 == len([i for i in [after_names] if i in before_names])
Пример #3
0
class TestMember:
    def setup_class(self):
        self.main = MainPage()

    def test_import_member(self):
        assert "通讯录批量导入模板.xlsx" == self.main.goto_import_contact().upload(
        ).file_display()

    def test_delete_member(self):
        assert "李四" not in self.main.goto_contact().delete_member().get_member(
        )
Пример #4
0
    def start(cls):
        desired_caps = {}
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = '5.1.1'
        desired_caps['deviceName'] = '127.0.0.1:62001'
        desired_caps['appPackage'] = 'com.intretech.readerx'
        desired_caps[
            'appActivity'] = 'com.intretech.readerx.ui.WelcomeActivity'
        desired_caps['automationName'] = 'uiautomator2'
        desired_caps['newCommandTimeout'] = "2000"
        desired_caps["unicodeKeyboard"] = True  # 使用unicode编码方式发送字符串
        desired_caps["resetKeyboard"] = True  # 隐藏键盘

        cls.driver = webdriver.Remote('http://localhost:4723/wd/hub',
                                      desired_caps)
        cls.driver.implicitly_wait(10)

        cls.driver.find_element_by_id(
            "com.intretech.readerx:id/tv_dialog_agreement_confirm").click(
            )  # 点击“同意”按钮
        cls.driver.find_element_by_id(
            "com.intretech.readerx:id/tv_welcome_look").click(
            )  # 点击“我先看看”com.intretech.readerx:id/tv_welcome_look

        return MainPage(cls.driver)
Пример #5
0
 def start(self):
     self.driver = webdriver.Chrome(
         r'D:\software\python36\chromedriver.exe')
     self.driver.get("http://www.10jqka.com.cn/")
     self.driver.maximize_window()
     self.driver.implicitly_wait(6)
     return MainPage(self.driver)
Пример #6
0
    def setUp(self):
        """"
        For webdriver
        if self.browser == 'CHROME': self.driver = webdriver.Chrome()
        else: self.driver = webdriver.Firefox()
        """
        """
        This is for grid
        """
        self.driver = Remote(
            command_executor='http://localhost:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, self.browser).copy()
        )

        main_page = MainPage(self.driver)
        main_page.open()
        main_page.login_mail(self.login, self.password)
        self.open();
Пример #7
0
class TestAddMember:
    def setup(self):
        self.main = MainPage()

    def test_add_member(self):
        result = self.main.goto_add_member().add_member(
            'Usopu', '*****@*****.**', '15900000004').get_tips()
        assert "保存成功" == result

    def test_add_member_fail(self):
        """
        不能用username是否在列表里断言,username是可以重复的
        :return:
        """
        result = self.main.goto_add_member().add_member_fail(
            'Nami', '*****@*****.**', '15900000003').get_input_with_tips()
        print(result)
        assert result > 0
Пример #8
0
 def start(cls):
     caps = {}
     caps["platformName"] = "android"
     caps["deviceName"] = "sssss"
     caps["appPackage"] = "com.lxlg.spend.yw.user"
     caps["appActivity"] = "ui.main.MainActivity"
     caps["autoGrantPermissions"] = "true"
     caps["automationName"] = "UiAutomator2"
     cls.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
     cls.driver.implicitly_wait(5)
     return MainPage(cls.driver)
Пример #9
0
class TestAddMember:
    def setup_class(self):
        self.main_page = MainPage()

    # 测试数据和页面对象分离
    @pytest.mark.parametrize("username,accid,phone",
                             [("Tesla", "00001", "13513935688")])
    def test_add_member(self, username, accid, phone):
        # 1.跳转到添加成员页面 2.添加成员 3.获取成员列表
        name_list = self.main_page.goto_add_member().add_member(
            username, accid, phone).get_contact_list()
        assert username in name_list

    @pytest.mark.parametrize("username,accid,phone",
                             [("Tesla", "00002", "13513935687")])
    def test_add_member_fail(self, username, accid, phone):
        # 1.跳转到添加成员页面 2.添加成员 3.获取成员列表
        data_list = self.main_page.goto_add_member().add_member_fail(
            username, accid, phone)
        err = [i for i in data_list if i != " "]
        assert "Tesla" in err[0]
Пример #10
0
    def start(cls):
        ''''
        caps = {}
        caps["platformName"] = "android"
        caps["deviceName"] = "seveniruby"
        caps["appPackage"] = "com.xueqiu.android"
        caps["appActivity"] = ".view.WelcomeActivityAlias"
        caps["autoGrantPermissions"] = "true"
        #caps["udid"] = "emulator-5556"
        caps["chromedriverExecutable"]="/Users/seveniruby/projects/chromedriver/2.20/chromedriver"
        caps["showChromedriverLog"]=True
        '''
        caps = {}
        caps["platformName"] = "iOS"
        caps["automationName"] = "xcuitest"
        caps["platformVersion"] = "14"
        caps["deviceName"] = "Memobird’s iPhone X"
        caps["udid"] = "9455a847b82870755a5c0626f9d8e2d8af7d74eb"
        # caps["bundleId"] = "com.example.apple-testUICatalog"
        caps["bundleId"] = "cn.memobird.study"
        caps["xcodeOrgId"] = "*****@*****.**"
        caps["xcodeSigningId"] = "iPhone Developer"

        cls.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
        cls.driver.implicitly_wait(10)

        # sleep(20)
        # if len(self.driver.find_elements_by_id("image_cancel")) >=1:
        #     self.driver.find_element_by_id("image_cancel").click()
        #
        #

        # WebDriverWait(self.driver, 15).until(
        #     expected_conditions.visibility_of_element_located((By.ID, "image_cancel"))
        # )

        # def loaded(driver):
        #     print(datetime.datetime.now())
        #     if len(cls.driver.find_elements_by_id("image_cancel")) >=1:
        #         cls.driver.find_element_by_id("image_cancel").click()
        #         return True
        #     else:
        #         return False
        #
        # try:
        #     WebDriverWait(cls.driver, 20).until(loaded)
        # except:
        #     print("no update")
        return MainPage(cls.driver)
Пример #11
0
    def start(cls):
        caps = {}
        caps["platformName"] = "android"
        caps["deviceName"] = "seveniruby"
        caps["appPackage"] = "com.xueqiu.android"
        caps["appActivity"] = ".view.WelcomeActivityAlias"
        caps["autoGrantPermissions"] = "true"
        # caps["udid"] = "emulator-5556"
        caps['udid'] = os.getenv("udid", None)
        caps['systemPort'] = utils.free_port()
        caps['chromedriverPort'] = utils.free_port()



        caps["chromedriverExecutable"] = "/Users/seveniruby/projects/chromedriver/2.20/chromedriver"
        caps["showChromedriverLog"] = True

        print(caps)

        cls.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
        cls.driver.implicitly_wait(5)

        # sleep(20)
        # if len(self.tilte.find_elements_by_id("image_cancel")) >=1:
        #     self.tilte.find_element_by_id("image_cancel").click()
        #
        #

        # WebDriverWait(self.tilte, 15).until(
        #     expected_conditions.visibility_of_element_located((By.ID, "image_cancel"))
        # )

        # def loaded(tilte):
        #     print(datetime.datetime.now())
        #     if len(cls.tilte.find_elements_by_id("image_cancel")) >=1:
        #         cls.tilte.find_element_by_id("image_cancel").click()
        #         return True
        #     else:
        #         return False
        #
        # try:
        #     WebDriverWait(cls.tilte, 20).until(loaded)
        # except:
        #     print("no update")

        return MainPage(cls.driver)
Пример #12
0
 def test_vim_plugin_link(self):
     main = MainPage(self.driver)
     assert main.click_vim_plugins_in_nav().get_section_height() == self.get_current_height()
     assert main.active_item_is('vim-plugin')
Пример #13
0
 def test_desktop_app_link(self):
     main = MainPage(self.driver)
     assert main.click_desktop_apps_in_nav().get_section_height() == self.get_current_height()
     assert main.active_item_is('desktop-app')
Пример #14
0
 def test_language_link(self):
     main = MainPage(self.driver)
     height = main.click_languages_in_nav().get_section_height()
     assert abs(height - self.get_current_height()) < 3
     assert main.active_item_is('language')
Пример #15
0
 def test_about_me_link(self):
     main = MainPage(self.driver)
     assert main.click_about_me_in_nav().get_section_height() == self.get_current_height()
     assert main.active_item_is('top')