def test_input(self):
        # Enable flash
        BestTestCase.navigate_to_page(self, TT_Constants["Flash_URL"])
        MainPage._allow_flash(self)

        # Open file
        f = open("../word.txt", "r")
        word = f.read()

        # Go to Chinese input website
        BestTestCase.navigate_to_page(self, TT_Constants["Base_URL"])
        input_word = word
        input_ls = MainPage._handle_input(self, input_word)

        for i in range(len(input_ls)):
            MainPage._input_new_word(self, input_ls[i])
            MainPage._customize_click(self)
            MainPage._input_line_no(self)

            #TODO: Download files automatically (Flash content)
            # filename = "screenshot/image_" + BasePage.timestamp(self) + ".png"
            # BasePage.screenshot(self, filename)
            # MainPage._save_to_pdf(self)

            # # Go back to previous main page TODO:判斷是否有page2
            BasePage.goback_to_previous_window(self)

            # Clear inputted words
            MainPage._clear_inputted_words(self)

        # Download Manually
        time.sleep(2000)
예제 #2
0
 def setUp(self):
     self.logging_util = LoggingUtil()
     self.logging_util.setup_logging()
     self.logger = logging.getLogger()
     desired_caps = {
         'platformName': 'Android',
         'deviceName': '127.0.0.1:5554',  # 手机设备名称,通过adb devices查看
         'platformVersion': '5.1.1',  # android系统的版本号
         'appPackage': 'com.aiosign.dzonesign',  # apk包名
         'appActivity': 'com.aiosign.dzonesign.view.AppStartActivity',
         # apk的launcherActivity
     }
     self.logger.info('启动app')
     self.driver = webdriver.Remote('http://localhost:4723/wd/hub',
                                    desired_caps)
     time.sleep(3)
     self.base_page = BasePage(self.driver)
     self.welcome_page = WelcomePage(self.base_page)
     self.login_page = LoginPage(self.base_page)
     self.main_page = MainPage(self.base_page)
예제 #3
0
def log_in(context):
    loginPage = LoginPage(context)
    wait_for_element_show(context.browser, FIND_ELEMENT_METHOD.ID,
                          loginPage.username_input_id)
    loginPage.set_base_element()
    loginPage.usernameInput.send_keys(
        BASE_CONFIG["SYSTEM_INFO"]["MERCHANT_ACCOUNT"])
    loginPage.passwordInput.send_keys(BASE_CONFIG["SYSTEM_INFO"]["PASSWORD"])
    loginPage.loginBtn.click()
    wait_ajax_finish(context.browser)
    context.current_page = BasePage(context)
    wait_for_element_show(context.browser, FIND_ELEMENT_METHOD.XPATH,
                          context.current_page.user_info_xpath)
예제 #4
0
def test_SearchWithFilters():
    LandingPage().setUp()
    LandingPage().inputCityName(city='Lake Forest, CA')
    LandingPage().submitSearchCityName(
        XPATH_var='//a[@href="/city/10039/CA/Lake-Forest"]')
    time.sleep(3)
    SearchPage().clickFilter()
    SearchPage().selectHouseFilter()
    SearchPage().selectBathFilter()
    SearchPage().selectOpenHouseFilter()
    SearchPage().clickApplyFilters()
    SearchPage().verifyFiltersHouseBathOpenHouse()
    BasePage().teardown()
예제 #5
0
class TestLogin(unittest.TestCase):
    def setUp(self):
        self.logging_util = LoggingUtil()
        self.logging_util.setup_logging()
        self.logger = logging.getLogger()
        desired_caps = {
            'platformName': 'Android',
            'deviceName': '127.0.0.1:5554',  # 手机设备名称,通过adb devices查看
            'platformVersion': '5.1.1',  # android系统的版本号
            'appPackage': 'com.aiosign.dzonesign',  # apk包名
            'appActivity': 'com.aiosign.dzonesign.view.AppStartActivity',
            # apk的launcherActivity
        }
        self.logger.info('启动app')
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub',
                                       desired_caps)
        time.sleep(3)
        self.base_page = BasePage(self.driver)
        self.welcome_page = WelcomePage(self.base_page)
        self.login_page = LoginPage(self.base_page)
        self.main_page = MainPage(self.base_page)

    # def test_right(self):
    #     self.logger.info('开始测试test_right=====================================')
    #     self.base_page.swipe_to_left()
    #     self.base_page.swipe_to_left()
    #     self.welcome_page.click_tiyan_button()
    #     self.welcome_page.click_login_button()
    #     self.login_page.input_username('15628811989')
    #     self.login_page.input_passwd('12345678')
    #     self.login_page.click_signin_button()
    #     # res = self.main_page.is_personal_center_button_exist()
    #     self.main_page.click_personal_center_button()
    #     self.logger.info('测试完成')
    #     # self.assertEqual(res, True)

    def test_login_1(self):
        self.logger.info('开始测试test_login_1==================================')
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('15628811988')
        self.login_page.input_passwd('12345678')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('用户不存在')
        self.assertEqual(res, True)
        self.logger.info('测试结束=====================================')

    def test_login_2(self):
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('15628811989')
        self.login_page.input_passwd('123456789')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('账号或密码错误')
        self.assertEqual(res, True)

    '''
    def test_login_3(self):
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('15628811989')
        # self.login_page.input_passwd('')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('请输入密码!')
        self.assertEqual(res, True)

    def test_login_4(self):
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('156288119')
        self.login_page.input_passwd('12345678')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('账号格式不正确(邮箱、信用代码、手机)')
        self.assertEqual(res, True)

    def test_login_5(self):
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        # self.login_page.input_username('')
        self.login_page.input_passwd('12345678')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('请输入账号!')
        self.assertEqual(res, True)
    '''

    def tearDown(self):
        return super().tearDown()
 def __init(self, driver):
     BasePage.__init__(self, driver)
예제 #7
0
def go_through_menu(context, main_menu, sub_menu, bread_crumb):
    basePage = BasePage(context)
    walk_through_menu_to_page(context, main_menu, sub_menu,
                              basePage.page_breadcrumb_xpath, bread_crumb)
 def __init__(self, driver):
     BasePage.__init__(self, driver)
예제 #9
0
def open_fsecure_web_page(context):
    page = BasePage(context)
    page.open("https://www.f-secure.com/en/welcome")
    context.windows = [context.browser.window_handles[0]]
예제 #10
0
def base_page(browser):
    page = BasePage(browser)
    page.go_to(url="https://spb.hh.ru/")
    return page
예제 #11
0
class Test_login(object):
    '''类注释
    详细描述

    Attributes:
        属性说明
    '''
    def setup_method(self, method):
        self.logging_util = LoggingUtil()
        self.logging_util.setup_logging()
        self.logger = logging.getLogger()
        desired_caps = {
            'platformName': 'Android',
            # 'deviceName': '127.0.0.1:5554',  # 手机设备名称,通过adb devices查看
            'deviceName': '127.0.0.1:62001',  # 手机设备名称,通过adb devices查看
            'platformVersion': '5.1.1',  # android系统的版本号
            'appPackage': 'com.aiosign.dzonesign',  # apk包名
            # apk的launcherActivity
            'appActivity': 'com.aiosign.dzonesign.view.AppStartActivity',
        }
        self.logger.info('启动app')
        try:
            self.driver = webdriver.Remote('http://*****:*****@allure.story('登录-用户不存在')
    def test_login_1(self):
        self.logger.info('开始测试test_login_1==================================')
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('15628811988')
        self.login_page.input_passwd('12345678')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('用户不存在')
        assert res
        self.logger.info('测试结束=====================================')

    @allure.story('登录-账号或密码错误')
    def test_login_2(self):
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('15628811989')
        self.login_page.input_passwd('123456789')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('账号或密码错误')
        assert res

    @allure.story('登录-正常')
    def test_right(self):
        self.logger.info('开始测试test_right=====================================')
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('15628811989')
        self.login_page.input_passwd('12345678')
        self.login_page.click_signin_button()
        res = self.main_page.is_personal_center_button_exist()
        assert res
        # self.main_page.click_personal_center_button()
        # self.logger.info('测试完成')

    @allure.story('登录-未输入密码')
    def test_login_3(self):
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('15628811989')
        # self.login_page.input_passwd('')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('请输入密码!')
        assert res

    @allure.story('登录-账号格式不正确')
    def test_login_4(self):
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_username('156288119')
        self.login_page.input_passwd('12345678')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('账号格式不正确(邮箱、信用代码、手机)')
        assert res

    @allure.story('登录-未输入账号')
    def test_login_5(self):
        self.base_page.swipe_to_left()
        self.base_page.swipe_to_left()
        self.welcome_page.click_tiyan_button()
        self.welcome_page.click_login_button()
        self.login_page.input_passwd('12345678')
        self.login_page.click_signin_button()
        res = self.base_page.is_toast_exist('请输入账号!')
        assert res
예제 #12
0
 def __init__(self, context):
     BasePage.__init__(self, context)
예제 #13
0
 def __init__(self, context):
     BasePage.__init__(self, context)
     WebDriverWait(self.browser, self.timeout).until(expected_conditions.visibility_of_element_located(self.locators['page_main_object']))