Exemplo n.º 1
0
    def test_login_error(self):
        logging.info('======test_login_error=====')
        l = LoginView(self.driver)
        data = get_csv_data(3, csv_file=self.csv_file)

        login_fail = l.login_action(data[0], data[1], self.l_devices['udid'])
        self.assertFalse(login_fail, msg='login fail!')
Exemplo n.º 2
0
    def export_pdf(self, file_name, save_path):  # 导出pdf
        logging.info('==========export_pdf==========')
        self.group_button_click('文件')
        self.driver.find_element(
            By.ID,
            'com.yozo.office:id/yozo_ui_wp_option_id_export_pdf').click()
        self.driver.find_element(
            By.ID, 'com.yozo.office:id/yozo_ui_select_save_folder').click()
        logging.info('choose save path %s' % save_path)
        self.driver.find_element(
            By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_%s' %
            save_path).click()

        if self.get_toast_message('您尚未登录,请登录'):
            l = LoginView(self.driver)
            l.login_action('13915575564', 'zhang199412')
            self.driver.find_element(
                By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_%s' %
                save_path).click()

        logging.info('file named %s' % file_name)
        self.driver.find_element(
            By.ID,
            'com.yozo.office:id/yozo_ui_select_save_path_file_name').set_text(
                file_name)

        self.driver.find_element(
            By.ID,
            'com.yozo.office:id/yozo_ui_select_save_path_file_type').click()
        self.driver.find_element(
            By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_save_btn'
        ).click()  # save
Exemplo n.º 3
0
    def test_login_137(self):
        logging.info('======test_login_137=====')
        l = LoginView(self.driver)
        data = get_csv_data(1, csv_file=self.csv_file)

        l.login_action(data[0], data[1], self.l_devices['udid'])
        self.assertTrue(l.check_loginStatus())
Exemplo n.º 4
0
    def save_action(
            self,
            file_name,
            save_path,
            item=1):  # 文件名,本地还是云端save_path=['local','cloud'],文件类型item=[1,2]
        logging.info('==========save_action_%s==========' % file_name)
        logging.info('choose save path %s' % save_path)
        self.driver.find_element(
            By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_%s' %
            save_path).click()

        logging.info('whether need login')
        if self.get_toast_message('您尚未登录,请登录'):
            l = LoginView(self.driver)
            l.login_action('13915575564', 'zhang199412')
            self.driver.find_element(
                By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_%s' %
                save_path).click()

        logging.info('file named %s' % file_name)
        self.driver.find_element(
            By.ID,
            'com.yozo.office:id/yozo_ui_select_save_path_file_name').set_text(
                file_name)

        logging.info('choose file type %s' % item)
        self.driver.find_element(
            By.ID,
            'com.yozo.office:id/yozo_ui_select_save_path_file_type').click()
        self.driver.find_element(By.ID, 'com.yozo.office:id/file_type_item%s' %
                                 item).click()

        self.driver.find_element(
            By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_save_btn'
        ).click()  # save
Exemplo n.º 5
0
def appium_desired(udid, port=4723):
    with open('../config/app_caps.yaml', 'r', encoding='utf-8') as file:
        data = yaml.load(file)

    desired_caps = {}
    desired_caps['platformName'] = data['platformName']
    desired_caps['platformVersion'] = data['platformVersion']
    desired_caps['deviceName'] = data['deviceName']
    desired_caps['udid'] = udid

    base_dir = os.path.dirname(os.path.dirname(__file__))
    app_path = os.path.join(base_dir, 'app', data['appname'])
    desired_caps['app'] = app_path

    desired_caps['appPackage'] = data['appPackage']
    desired_caps['appActivity'] = data['appActivity']
    desired_caps['noReset'] = data['noReset']

    logging.info('appium port:%s start run %s' % (port, udid))
    desired_caps['unicodeKeyboard'] = data['unicodeKeyboard']
    desired_caps['resetKeyboard'] = data['resetKeyboard']
    # toast location setting
    # desired_caps['automationName'] = 'uiautomator2'

    logging.info('start app...')
    driver = webdriver.Remote(
        'http://' + str(data['ip']) + ':' + str(port) + '/wd/hub',
        desired_caps)
    driver.implicitly_wait(8)
    l = LoginView(driver)
    l.login_action('13545', 'zmjj')
    return driver
Exemplo n.º 6
0
    def test_phone_login(self):
        logging.info('===start login====')
        r = LoginView(self.driver)

        username = '******' + str(random.randint(00, 99))

        self.assertTrue(r.login_action(username))
Exemplo n.º 7
0
    def test_register_by_username_password(self):
        u'''Register by username and password'''
        self.loginView = LoginView(self.driver)
        self.loginView.click_register_button()
        self.registerView = RegisterView(self.driver)

        user_name = 'Terry' + 'FLY' + str(random.randint(100, 500))
        self.registerView.input_username(user_name)

        user_pwd = 'Terry' + str(random.randint(500, 800))
        self.registerView.input_password(user_pwd)

        email = 'Terry' + str(random.randint(1000, 9000)) + '@163.com'
        self.registerView.input_email(email)

        self.registerView.click_register_button()
        informationView = InformationView(self.driver)

        informationView.select_time_by_text('2016')

        informationView.select_school_by_name(u'河北', u'保定学院')

        informationView.select_major_by_text(u'工学', u'计算机科学与技术', u'计算机科学与技术')

        informationView.click_go_kyb_button()

        homeView = HomeView(self.driver)

        self.assertTrue(homeView.home_view_is_loaded,
                        "my self button not display.")

        homeView.add_task_by_template_name()
        homeView.update_start_and_end_time()
        homeView.click_right_button()
Exemplo n.º 8
0
 def setUp(self):
     self.driver = appium_desired()
     commonView = Common(self.driver)
     commonView.always_allow()
     time.sleep(1)
     commonView.check_cancel_button()
     commonView = Common(self.driver)
     commonView.check_skip_button()
     self.loginView = LoginView(self.driver)
Exemplo n.º 9
0
    def testlogin(self):
        self.logger.info('start test login')
        login=LoginView(self.driver)
        login.login_action()
        self.assertTrue(login.check_login())

#pass
# if __name__ == '__main__':
#     unittest.main()
Exemplo n.º 10
0
    def test_login_by_username_password(self):
        u'''Login in by correct username and password'''
        self.loginView = LoginView(self.driver)
        self.loginView.input_username("TerryFLY300")
        self.loginView.input_password("Terry300")
        self.loginView.click_login_button()

        self.homeView = HomeView(self.driver)
        self.homeView.add_task_by_template_name()
        self.homeView.update_start_and_end_time()
        self.homeView.click_right_button()
        self.assertEqual('听音乐放松', self.homeView.check_my_task())
Exemplo n.º 11
0
 def test_mmlogin_goodsshopping(self, phone, passwd):
     """
     测试密码登录严选专区页面下单用例
     :param phone: 手机号码
     :param passwd: 密码
     :return:
     """
     logging.info('开始测试密码登录严选专区页面下单')
     l = LoginView(self.driver)
     g = GoodsView(self.driver)
     l.enterindex()
     e = l.check_logined()
     if not e:
         l.mmlogin_action(phone, passwd)
     r = l.check_logined()
     self.assertTrue(r)
     r = g.goods_check()
     self.assertTrue(r)
     if r:
         name = g.content_detail()
         logging.info('goodname:%s' % name)
     self.assertTrue(g.paystatus_check())
     self.assertTrue(g.orderstatus_check(name))
     # 不报错截图保存结果
     self.GetScreen('严选专区下单结果')
Exemplo n.º 12
0
 def test_login(self):
     logging.info('**********test_login**********')
     l = LoginView(self.driver)
     data = l.get_csv_data(self.csv_file, 3)
     l.login(data[0], data[1])
     l.getScreenShot('test_login')
     self.assertTrue(l.is_login_success())
Exemplo n.º 13
0
 def test_mmlogin_indexshopping(self, phone, passwd, goodname):
     """
     测试密码登录主页搜索下单用例
     :param phone:手机号码
     :param passwd: 密码
     :param goodname:商品名称
     :return:
     """
     logging.info('开始测试密码登录主页搜索下单')
     l = LoginView(self.driver)
     i = IndexView(self.driver)
     l.enterindex()
     e = l.check_logined()
     if not e:
         l.mmlogin_action(phone, passwd)
     r = l.check_logined()
     self.assertTrue(r)
     i.enter_searchindex()
     i.search_action(goodname)
     r = i.check_search()
     self.assertTrue(r)
     if r:
         name = i.goods_detail()
         logging.info('goodname:%s' % name)
     self.assertTrue(i.paystatus_check())
     self.assertTrue(i.orderstatus_check(name))
     # 不报错截图保存结果
     self.GetScreen('主页搜索下单结果')
Exemplo n.º 14
0
    def test_login_zxw2017(self):
        logging.info("====start=====")
        l = LoginView(self.driver)

        data = l.get_csv_data(self.csv_file, 1)
        l.login_action(data[0], data[1])
        l.check_agree_alert()
        self.assertTrue(l.check_login_staus())
Exemplo n.º 15
0
class Register(unittest.TestCase):
    def setUp(self):
        self.driver = appium_desired()
        common = Common(self.driver)
        common.check_cancel_button()
        common.check_skip_button()
        self.loginView = LoginView(self.driver)

    def tearDown(self):
        self.loginView.get_screenshot()
        self.driver.quit()

    #@unittest.skip("skip test")
    def test_register_by_username_password(self):
        u'''Register by username and password'''

        self.loginView.click_register_button()
        self.registerView = RegisterView(self.driver)

        user_name = 'Chao' + 'FLX' + str(random.randint(100, 500))
        self.registerView.input_username(user_name)

        user_pwd = 'ChaoT' + str(random.randint(500, 800))
        self.registerView.input_password(user_pwd)

        email = 'ChaoT' + str(random.randint(1000, 9000)) + '@163.com'
        self.registerView.input_email(email)

        self.registerView.click_register_button()
        informationView = InformationView(self.driver)

        informationView.select_time_by_text('2016')

        informationView.select_school_by_name(u'河北', u'保定学院')

        informationView.select_major_by_text(u'工学', u'计算机科学与技术', u'计算机科学与技术')

        informationView.click_go_kyb_button()

        homeView = HomeView(self.driver)

        self.assertTrue(homeView.home_view_is_loaded,
                        "my self button not display.")

        homeView.add_task_by_template_name()
        homeView.update_start_and_end_time()
        homeView.click_right_button()
Exemplo n.º 16
0
class DemoTest(ParametrizedTestCase):
    @classmethod
    def setUpClass(cls):
        super(DemoTest, cls).setUpClass()

    @classmethod
    def tearDownClass(cls):
        super(DemoTest, cls).tearDownClass()

    def tearDown(self):
        self.loginView.get_screenshot()

    def testFirstOpen(self):
        u'''Login in by correct username and password'''
        self.loginView = LoginView(self.driver)
        self.loginView.input_username("TerryFLY300")
        self.loginView.input_password("Terry300")
Exemplo n.º 17
0
    def upload(self):  # 上传云文档
        logging.info('==========upload==========')
        slv = SelectView(self.driver)
        l = LoginView(self.driver)

        slv.select_index('alldoc')
        ele = self.driver.find_elements(By.ID,
                                        'com.yozo.office:id/file_item')[0]
        ele.find_element(By.ID, 'com.yozo.office:id/lay_more').click()
        self.driver.find_element(
            By.ID,
            'com.yozo.office:id/ll_filework_pop_upcloud').click()  # 点击上传
        logging.info('checking having already logined in')
        getele = self.get_toast_message('请先登录账号')
        if getele == True:
            slv.select_index('my')
            # self.find_element(By.ID, 'com.yozo.office:id/ll_bottommenu_my').click()
            logging.info('try login in')
            data = l.get_csv_data(self.csv_file, 4)
            l.login_action(data[0], data[1])
            if l.check_login_status():
                logging.info('login success in upload')
                slv.select_index('alldoc')
                ele = self.driver.find_elements(
                    By.ID, 'com.yozo.office:id/file_item')[0]
                ele.find_element(By.ID, 'com.yozo.office:id/lay_more').click()
                self.driver.find_element(
                    By.ID, 'com.yozo.office:id/ll_filework_pop_upcloud').click(
                    )  # 点击上传
                # self.driver.find_element(By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_save_btn').click()
                # try:
                #     btn = self.driver.find_element(By.ID, 'android:id/button1')
                # except NoSuchElementException:
                #     pass
                # else:
                #     btn.click()
            else:
                logging.error('login fail in upload')
                self.getScreenShot('login fail in upload')
                raise
        self.driver.find_element(
            By.ID,
            'com.yozo.office:id/yozo_ui_select_save_path_save_btn').click()
        try:
            btn = self.driver.find_element(By.ID, 'android:id/button1')
        except NoSuchElementException:
            pass
        else:
            btn.click()
        slv.select_index('my')
        l.logout_action()
Exemplo n.º 18
0
 def login(self):
     lo = LoginView(self.driver)
     data = lo.get_csv_data(self.csv_file,1)
     try:
         self.driver.find_element_by_id("com.chan.iamabuyer:id/layoutMy")
     except NoSuchElementException:
         lo.login_action(data[0], data[1])
         logging.info('开始登录账号%s,密码%s', data[0], data[1])
     else:
         lo.login_action(data[0], data[1])
Exemplo n.º 19
0
    def test_login_error(self):
        logging.info('======测试密码错误登录======')
        lg = LoginView(self.driver)
        data = lg.get_csv_data(self.csv_file, 1)

        lg.login_action(data[0], data[1])
        self.assertFalse(lg.check_login_status())
Exemplo n.º 20
0
    def test_login_right(self):
        logging.info('======测试正常登录======')
        lg = LoginView(self.driver)
        data = lg.get_csv_data(self.csv_file, 2)

        lg.login_action(data[0], data[1])
        self.assertTrue(lg.check_login_status())
Exemplo n.º 21
0
 def test_login_normal(self):
     logging.info('====test_login_normal====')
     lv=LoginView(self.driver)
     data=lv.get_csv_data(self.csv_file,1)
     lv.login_action(data[0],data[1])
     bool=lv.check_loginStatus()
     self.assertTrue(bool)
Exemplo n.º 22
0
    def test_login_error(self):
        logging.info('======test_login_error======')
        l = LoginView(self.driver)
        data = l.get_csv_data(self.csv_file, 3)

        l.login_action(data[0], data[1])
        self.assertTrue(l.check_loginStatus(), msg='login fail!')
Exemplo n.º 23
0
    def test_login_success_one(self):
        logging.info('test_login_one')
        lo = LoginView(self.driver)

        user = lo.do_get_csv_data(self.csv_file, 1)
        lo.login_action(user[0], user[1])
        self.assertTrue(lo.assert_login_status())
Exemplo n.º 24
0
    def test_correct_user_and_pass(self):
        logging.info('======test_correct_user_and_pass======')
        l=LoginView(self.driver)
        data=l.get_csv_data(self.csv_file, 1)

        l.login_action(data[0],data[1])
        self.assertTrue(l.check_loginStatus())
Exemplo n.º 25
0
    def test_wrong_user_wrong_pass(self):
        logging.info('======test_wrong_user_wrong_pass======')
        l=LoginView(self.driver)
        data=l.get_csv_data(self.csv_file, 3)

        l.login_action(data[0],data[1])
        self.assertFalse(l.check_loginStatus(),msg='login fail!')
Exemplo n.º 26
0
    def test_login_zxw2017(self):
        logging.info('======test_login_zxw2017======')
        l = LoginView(self.driver)
        data = l.get_csv_data(self.csv_file, 1)

        l.login_action(data[0], data[1])
        self.assertTrue(l.check_loginStatus())
Exemplo n.º 27
0
    def test_login_failure(self):
        logging.info('test_login_failure')
        lo = LoginView(self.driver)

        user = lo.do_get_csv_data(self.csv_file, 2)
        lo.login_action(user[0], user[1])
        self.assertFalse(lo.assert_login_status(), msg='expect failure')
Exemplo n.º 28
0
 def test_login_1(self):
     logging.info('测试登录第一个账户')
     # 调用登录业务模块
     login = LoginView(self.driver)
     # 读取csv数据
     data = login.get_csv_data(self.csv_file, 1)
     # 执行登录业务动作
     login.login_action(data[0], data[1])
     # 断言执行是否成功
     self.assertTrue(login.check_login_status())
Exemplo n.º 29
0
    def test_login_error(self):
        logging.info('=======test login error======')
        l = LoginView(self.driver)
        data = l.get_csv_data(self.csv_file, 3)

        l.login_action(data[0], data[1])
        self.assertTrue(l.check_loginStatus())


# if __name__=='__main__':
# unittest.main()
Exemplo n.º 30
0
 def test_user_head_pic(self, phone, passwd):
     """
     测试密码登录验证用户头像变化用例
     :param phone:
     :param passwd:
     :return:
     """
     logging.info('开始测试用户头像')
     m = MyView(self.driver)
     l = LoginView(self.driver)
     l.enterindex()
     e = l.check_logined()
     if not e:
         l.mmlogin_action(phone, passwd)
     r = l.check_logined()
     self.assertTrue(r)
     # 保存最新我的页面截图
     self.GetScreen('我的页面截图')
     pass