コード例 #1
0
 def setUpClass(cls):
     cls.driver = Driver().android_driver(0)
     cls.login = LoginBusiness(cls.driver)
     cls.homepage = HomePage(cls.driver)
     cls.txt = WriteTxt()
     cls.driver.implicitly_wait(15)
     cls.login.username_login_pass()
コード例 #2
0
class FillData(unittest.TestCase):
    def setUp(self):
        self.driver = Driver().android_driver(0)
        self.txt = WriteTxt()
        self.driver.implicitly_wait(20)
        self.fill_data_bussiness = FillDataBusiness(self.driver)

    def tearDown(self):
        pass
        # driver = self.driver
        # driver.quit()

    def test_fill_data_success(self):
        '''
        :condition:用户已经注册demo成功
        :step:点击完善资料并开立真实账户,进入完善资料页面
        :except:用户能够完成资料且成功提交
        '''
        self.fill_data_bussiness.fill_data_pass()
コード例 #3
0
class TestRegisterDemo(unittest.TestCase):
    def setUp(self):
        self.driver = Driver().android_driver(0)
        self.register = RegisterBusiness(self.driver)
        self.txt = WriteTxt()
        self.driver.implicitly_wait(20)

    def tearDown(self):
        pass
        # driver = self.driver
        # driver.quit()

    def test_register_demo_success(self):
        '''
        :condition:用户正在注册页面
        :step:用户完成注册demo用户信息填写
        :except:能够完成demo账户且生成demo账户
        '''
        self.register.register_demo_pass()
コード例 #4
0
        self.confirm_pwd = self.ini.get_value('confirm_pwd',
                                              'register_input_value')
        self.introducer = self.ini.get_value('introducer',
                                             'register_input_value')
        self.driver.implicitly_wait(20)

    def register_demo_pass(self):
        '''
        成功注册demo用户
        '''
        self.login_handle.click_register()
        self.register_handle.click_register_au_btn()
        self.register_handle.switch_context()
        self.register_handle.send_phone(self.phone)
        self.register_handle.send_verification_code(self.verification_code)
        self.register_handle.click_next_step()
        self.register_handle.send_mail(self.mail)
        self.register_handle.send_call(self.call)
        self.register_handle.send_password(self.pwd)
        self.register_handle.send_confirm_password(self.confirm_pwd)
        self.register_handle.send_introducer(self.introducer)
        self.register_handle.click_accept_term()
        self.register_handle.click_accept_ad()
        self.register_handle.click_complete()
        time.sleep(20)
        # self.register_handle.screen_shot('reg_demo_success')


if __name__ == '__main__':
    driver = Driver().android_driver(0)
    bu = RegisterBusiness(driver)
コード例 #5
0
ファイル: test_login_func.py プロジェクト: 1067947122/Aetos
class LoginApp(unittest.TestCase):
    def setUp(self):
        self.driver = Driver().android_driver(0)
        self.login = LoginBusiness(self.driver)
        self.txt = WriteTxt()
        self.homepage = HomePage(self.driver)
        self.driver.implicitly_wait(15)

    def tearDown(self):
        driver = self.driver
        driver.quit()

    def test_login_success(self):
        '''
        :condition:用户用户登陆页面
        :step:输入正确的用户名和密码登陆
        :except:用户能够登陆成功
        '''
        self.login.username_login_pass()
        market = self.homepage.get_market_tab_element().text
        print(market)
        try:
            self.assertEqual(market, '行情', msg='登陆成功')
        except:
            self.txt.write_data('fail')
            raise
        else:
            self.txt.write_data('pass')

    def test_login_username_error(self):
        '''
        :condition:用户在登陆页面
        :step:用户名输入错误,密码输入正确
        :except:用户不能够登陆成功
        '''
        self.login.username_login_username_error()
        market = self.homepage.get_market_tab_element()

        try:
            self.assertIsNone(market, msg='登陆失败')
        except:
            self.txt.write_data('fail')
            raise
        else:
            self.txt.write_data('pass')

    def test_login_password_error(self):
        '''
        :condition:用户在登陆页面
        :step:用户名输入正确,密码输入错误
        :except:用户不能够登陆成功
        '''
        self.login.username_login_password_error()
        market = self.homepage.get_market_tab_element()
        try:
            self.assertIsNone(market, msg='登陆失败')
        except:
            self.txt.write_data('fail')
            raise
        else:
            self.txt.write_data('pass')

    def test_mt4_login_pass(self):
        '''
        :condition:用户在MT4登陆页面
        :step:mt4输入正确,密码输入正确
        :except:用户能够登陆成功
        '''
        self.login.mt4_login_pass('AETOS-LIVE')
        market = self.homepage.get_market_tab_element().text
        print(market)
        try:
            self.assertEqual(market, u'行情', msg='登陆成功')
        except:
            self.txt.write_data('fail')
            raise
        else:
            self.txt.write_data('pass')

    def test_mt4_login_mt4_error(self):
        '''
        :condition:用户在MT4登陆页面
        :step:mt4输入错误,密码输入正确
        :except:用户登陆不成功
        '''
        self.login.mt4_login_mt4_error('AETOS-LIVE')
        market = self.homepage.get_market_tab_element()
        try:
            self.assertIsNone(market, msg='登陆失败')
        except:
            self.txt.write_data('fail')
            raise
        else:
            self.txt.write_data('pass')

    def test_mt4_login_pwd_error(self):
        '''
        :condition:用户在MT4登陆页面
        :step:mt4输入正确,密码输入错误
        :except:用户登陆不成功
        '''
        self.login.mt4_login_pwd_error('AETOS-LIVE')
        market = self.homepage.get_market_tab_element()
        try:
            self.assertIsNone(market, msg='登陆失败')
        except:
            self.txt.write_data('fail')
            raise
        else:
            self.txt.write_data('pass')
コード例 #6
0
ファイル: test_login_func.py プロジェクト: 1067947122/Aetos
 def setUp(self):
     self.driver = Driver().android_driver(0)
     self.login = LoginBusiness(self.driver)
     self.txt = WriteTxt()
     self.homepage = HomePage(self.driver)
     self.driver.implicitly_wait(15)
コード例 #7
0
 def setUp(self):
     self.driver = Driver().android_driver(0)
     self.txt = WriteTxt()
     self.driver.implicitly_wait(20)
     self.fill_data_bussiness = FillDataBusiness(self.driver)
コード例 #8
0
ファイル: qq_login_page.py プロジェクト: zwnong/Python
 def __init__(self, i):
     base_driver = Driver()
     self.driver = base_driver.android_driver(i)
     self.get_element_by_ini = GetElementByIni(self.driver)
コード例 #9
0
ファイル: login_page.py プロジェクト: 1067947122/Aetos
    def get_mt4_login_btn_element(self):
        '''
        获取交易账号登陆元素
        '''
        return self.get_by_local.get_element('mt4_login_btn','trade_account_login_element')

    def get_other_area_btn_element(self):
        '''
        获取其它地区登陆元素
        '''
        return self.get_by_local.get_element('other_area_btn','other_area_login_element')

    def get_toast_element(self,message):
        '''
        获取toast_element
        '''
        time.sleep(2)
        toast_element = ('xpath','.//*[contains(@text,'+message+')]')
        try:
            element = WebDriverWait(self.driver,10,0.1).until(EC.presence_of_element_located(toast_element))
            print(element)
            return True
        except:
            return False

if __name__ == '__main__':
    driver = Driver()
    page = LoginPage(driver)


コード例 #10
0
 def __init__(self):
     base_driver = Driver()
     self.driver = base_driver.android_driver(0)
     self.get_by_local = GetByLocal(self.driver)
コード例 #11
0
 def setUp(self):
     self.driver = Driver().android_driver(0)
     self.register = RegisterBusiness(self.driver)
     self.txt = WriteTxt()
     self.driver.implicitly_wait(20)
コード例 #12
0
 def tearDownClass(cls):
     base_driver = Driver()
     base_driver.quit_driver(parames)
     print('this is teardowmclass')
コード例 #13
0
ファイル: startAppium.py プロジェクト: zwnong/Python
def get_driver():
    driver = Driver()
    return driver.android_driver(0)
コード例 #14
0
# coding = utf-8
from appium import webdriver
from base.base_driver import Driver

file_path = './text.txt'
with open(file_path, 'r+') as f:
    line = f.readlines()
    it = iter(line)
    driver = Driver.android_driver()
    while True:
        try:
            x = next(it)
            if x == '/n':
                driver.find_element_by_android_uiautomator(
                    'new UiSelector().resourceId("com.smile.gifmaker:id/comment")'
                    '.text("说点什么...")').send_keys(x)
        except StopIteration:
            # 如果迭代器找不到元素则推出循环
            break

# def doubleClick():
#     driver = Driver.android_driver()
#     driver.find_element_by_android_uiautomator('new UiSelector().resourceId("com.smile.gifmaker:id/comment")'
#                                                '.text("说点什么...")').send_keys()