示例#1
0
 def __init__(self, mozwebqa, open_url=True):
     """
     Gets the base_url
     """
     Base.__init__(self, mozwebqa)
     if open_url:
         self.selenium.get(self.base_url)
示例#2
0
    def escolher_estado_municipio(self, estado, municipio):
        """
        Esse método escolhe o estado e municipio de votação
        :param estado: estado value
        :param municipio: municipio value
        :return: None
        """
        btn_estado = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.DROP_DOWN_ESTADO)
        btn_estado.click()
        os.system('adb shell input swipe 500 1000 500 0')
        drop_seleciona_estado = Base.encontrar_elemento(self.drive, estado)
        drop_seleciona_estado.click()

        btn_confirma = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.BTN_CONFIRMAR_LOCAL)
        btn_confirma.click()

        drop_seleciona_municipio = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.DROP_DOWN_MUNICIPIO)
        drop_seleciona_municipio.click()

        btn_municipio = Base.encontrar_elemento(self.drive, municipio)
        btn_municipio.click()

        btn_confirma.click()
        btn_confirma.click()
示例#3
0
 def __init__(self, mozwebqa, open_url=True):
     ''' 
     Gets page ready for testing 
     '''
     Base.__init__(self, mozwebqa)
     if open_url:
         self.selenium.get(self.base_url)
示例#4
0
 def __init__(self, base_url, selenium, open_url=True):
     Base.__init__(self, base_url, selenium)
     if open_url:
         self.selenium.get(self.base_url)
     self._sign_in_button = (By.CSS_SELECTOR,
                             'a[href="{}"]'.format(self.base_url))
     self._logout_button_locator = (By.CSS_SELECTOR,
                                    '#main-content a[href="/logout"]')
示例#5
0
 def __init__(self, testsetup, addon_name=None):
     #formats name for url
     Base.__init__(self, testsetup)
     if (addon_name != None):
         self.addon_name = addon_name.replace(" ", "-")
         self.addon_name = re.sub(r'[^A-Za-z0-9\-]', '', self.addon_name).lower()
         self.addon_name = self.addon_name[:27]
         self.selenium.open("%s/addon/%s" % (self.site_version, self.addon_name))
         self.wait_for_element_present(self._reviews_locator)
示例#6
0
 def escolher_local(self):
     """
     Esse método clica na escolha de um local de votação
     :return: None
     """
     Base.encontrar_elemento(self.drive, ResultadosSeletores.BTN_2_TURNO)
     btn_escolher_local = Base.encontrar_elemento(
         self.drive, ResultadosSeletores.BTN_ESCOLHER_LOCAL)
     btn_escolher_local.click()
    def __init__(self, testsetup):
        Base.__init__(self, testsetup)

        if self.selenium.title != self._page_title:
            for handle in self.selenium.window_handles:
                self.selenium.switch_to_window(handle)
                WebDriverWait(self.selenium, self.timeout).until(lambda s: s.title)
        else:
            raise Exception("Page has not loaded")
示例#8
0
 def goto_login_page(self):
     """
     This method performs the path to reach Login activity
     :return: None
     """
     btn_menu = Base.find_element(self.drive,
                                  LoginPageLocators.HAMBURGUER_MENU)
     btn_menu.click()
     btn_sign = Base.find_element(self.drive, LoginPageLocators.LOGIN)
     btn_sign.click()
示例#9
0
 def buscar_2_turno(self):
     """
     Esse método seleciona o segundo turno no menu principal
     :return: None
     """
     drop_down_eleicoes = Base.encontrar_elemento(
         self.drive, ResultadosSeletores.DROP_DOWN_ELEICOES)
     drop_down_eleicoes.click()
     btn_2_turno = Base.encontrar_elemento(self.drive,
                                           ResultadosSeletores.BTN_2_TURNO)
     btn_2_turno.click()
示例#10
0
 def realizar_fluxo_inicial(self):
     btn_prox = Base.find_element(self.drive, ResultadosLocators.BTN_PROX)
     btn_prox.click()
     btn_entendi = Base.find_element(self.drive,
                                     ResultadosLocators.BTN_ENTENDI)
     btn_entendi.click()
     TouchAction(self.drive).press(x=487, y=1538).move_to(
         x=497, y=515).release().perform()
     btn_li_aceito = Base.find_element(self.drive,
                                       ResultadosLocators.BTN_LI_ACEITO)
     btn_li_aceito.click()
示例#11
0
    def favoritar_candidato(self):
        """
        Esse método favorita um candidato
        :return: None
        """
        os.system('adb shell input swipe 500 1000 500 0')

        texto_marilia = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.CANDIDATO_TEXTO_MARILIA)
        texto_marilia.click()

        btn_favoritar = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.BTN_FAVORITAR)
        btn_favoritar.click()
示例#12
0
 def realizar_fluxo_inicial(self):
     """
     Esse método realiza o fluxo inicial do app
     :return: None
     """
     btn_prox = Base.encontrar_elemento(self.drive,
                                        PrincipalSeletores.BTN_PROX)
     btn_prox.click()
     btn_entendi = Base.encontrar_elemento(self.drive,
                                           PrincipalSeletores.BTN_ENTENDI)
     btn_entendi.click()
     os.system('adb shell input swipe 500 1000 500 0')
     btn_li_aceito = Base.encontrar_elemento(
         self.drive, PrincipalSeletores.BTN_LI_ACEITO)
     btn_li_aceito.click()
示例#13
0
 def reach_(self):
     btn_dsl = Base.find_element(self.drive, GeneralLocators.button_dsl)
     btn_dsl.click()
     area_code_field = Base.find_element(self.drive, GeneralLocators.area_code_field)
     area_code_field.click()
     area_code_field.send_keys('030')
     time.sleep(30)
     # Base.handle_cookie(self.drive)
     cookie = Base.find_element(self.drive, GeneralLocators.button_cookie)
     cookie.click()
     time.sleep(10)
     mbit_value = Base.find_element(self.drive, GeneralLocators.mbit_100)
     mbit_value.click()
     button_vergleichen = Base.find_element(self.drive, GeneralLocators.button_vergleichen)
     button_vergleichen.click()
示例#14
0
 def realizar_fluxo_inicial(self):
     """
    Este método executa o fluxo inicial (bem-vindo) do aplicativo
    :return: None
     """
     btn_prox = Base.encontra_elemento(self.drive,
                                       ResultadosSeletores.BTN_PROX)
     btn_prox.click()
     btn_entendi = Base.encontra_elemento(self.drive,
                                          ResultadosSeletores.BTN_ENTENDI)
     btn_entendi.click()
     os.system('adb shell input swipe 500 1000 500 0')
     btn_li = Base.encontra_elemento(self.drive,
                                     ResultadosSeletores.BTN_LI_ACEITO)
     btn_li.click()
     time.sleep(5)
示例#15
0
def before_all(context):
    setup_config(context)
    setup_logger(context)

    if context.browser == 'Sauce':
        context.logger.info("Using Sauce Labs")
        desired_capabilities = {
            'name': os.getenv('SELENIUM_NAME',
                              'OAH browser tests ') + str(datetime.now()),
            'platform': os.getenv('SELENIUM_PLATFORM', 'WINDOWS 7'),
            'browserName': os.getenv('SELENIUM_BROWSER', 'chrome'),
            'version': int(os.getenv('SELENIUM_VERSION', 33)),
            'max-duration': 7200,
            'record-video': os.getenv('SELENIUM_VIDEO', True),
            'video-upload-on-pass': os.getenv('SELENIUM_VIDEO_UPLOAD_ON_PASS',
                                              True),
            'record-screenshots': os.getenv('SELENIUM_SCREENSHOTS', False),
            'command-timeout': int(os.getenv('SELENIUM_CMD_TIMEOUT', 30)),
            'idle-timeout': int(os.getenv('SELENIUM_IDLE_TIMEOUT', 10)),
            'tunnel-identifier': os.getenv('SELENIUM_TUNNEL'),
        }

        context.logger.info("Running Sauce with capabilities: %s" %
                            desired_capabilities)

        sauce_config = {"username": os.getenv('SAUCE_USER'),
                        "access-key": os.getenv("SAUCE_KEY")}
        context.sauce_config = sauce_config

        driver = webdriver.Remote(
            desired_capabilities=desired_capabilities,
            command_executor="http://%s:%[email protected]:80/wd/hub" %
            (sauce_config['username'], sauce_config['access-key'])
        )

    else:
        driver = webdriver.Chrome(context.chromedriver_path)

    context.base = Base(context.logger, context.directory,
                        context.base_url, driver, 10, context.delay_secs)
    context.home = Home(context.logger, context.directory,
                        context.base_url, driver, 10, context.delay_secs)
    context.loan_comparison = LoanComparison(context.logger, context.directory,
                                             context.base_url, driver, 10,
                                             context.delay_secs)
    context.loan_options = LoanOptions(context.logger, context.directory,
                                       context.base_url, driver, 10,
                                       context.delay_secs)
    context.rate_checker = RateChecker(context.logger, context.directory,
                                       context.base_url,
                                       driver, 10, context.delay_secs)
    context.navigation = Navigation(context.logger, context.directory,
                                    context.base_url,
                                    driver, 10, context.delay_secs)
    context.screenshot = Screenshot(context.base, context.take_screenshots)

    context.utils = Utils(context.base)

    context.logger.info('TEST ENVIRONMENT = %s' % context.base_url)
示例#16
0
 def is_is_home_screen(self):
     resultados = Base.find_element(self.drive,
                                    ResultadosLocators.BTN_RESULTADOS)
     try:
         resultados
     except NoSuchElementException:
         return False
     return True
示例#17
0
 def valida_favorito_tab(self):
     """
     Esse método valida se o candidato favoritado foi exibido na tab de favoritos
     :return: boolean
     """
     try:
         btn_fechar = Base.encontrar_elemento(
             self.drive, ResultadosSeletores.BTN_FECHAR)
         btn_fechar.click()
         tab_favoritos = Base.encontrar_elemento(
             self.drive, ResultadosSeletores.BTN_FAVORITOS_TAB)
         tab_favoritos.click()
         wait = WebDriverWait(self.drive, 15)
         wait.until(
             EC.presence_of_element_located(
                 ResultadosSeletores.CANDIDATO_TEXTO_MARILIA))
     except NoSuchElementException:
         return False
     return True
示例#18
0
    def busca_1_turno(self):
        """
        Esse método realiza a busca de um candidato do primeiro turno
        :return: None
        """

        btn_resultados = Base.encontrar_elemento(self.drive,
                                                 ResultadosSeletores.BTN_RESUL)
        btn_resultados.click()

        btn_escolhe_turno = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.BTN_ESCOLHE_TURNO_TOP)
        btn_escolhe_turno.click()

        dialog_turno = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.DIALOG_1_TURNO)
        dialog_turno.click()

        btn_confirma = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.BTN_CONFIRMAR_TURNO)
        btn_confirma.click()

        btn_pesquisar_candidato = Base.encontrar_elemento(
            self.drive, ResultadosSeletores.BTN_PESQUISAR_CANDIDATO)
        btn_pesquisar_candidato.click()

        barra_busca = Base.encontrar_elemento(self.drive,
                                              ResultadosSeletores.BARRA_BUSCA)
        barra_busca.send_keys("dani")
示例#19
0
 def __init__(self, testsetup, open_url=True):
     ''' Creates a new instance of the class and gets the page ready for testing '''
     Base.__init__(self, testsetup)
     if open_url:
         self.selenium.get("https://www.diresworb.org/")
示例#20
0
def test_subscribed_experiments_page_loads(base_url, selenium):
    """Test Subscribed Experiments link opens correct page."""
    selenium.get(base_url)
    page = Base(selenium, base_url)
    experiments = page.header.click_subscribed_experiments()
    assert f"{experiments.count} subscribed Experiments" in experiments.title
示例#21
0
 def flash(self):
     '''Flash Message Region'''
     return Base.FlashRegion(self.testsetup)
示例#22
0
 def __init__(self, testsetup):
     Base.__init__(self, testsetup)
     self.wait_for_element_visible(*self._user_avatar_locator)
 def __init__(self, base_url, selenium, open_url=True):
     """Creates a new instance of the class and gets the page ready for testing."""
     Base.__init__(self, base_url, selenium, open_url)
示例#24
0
 def __init__(self, testsetup):
     Base.__init__(self, testsetup)
     # Wait for the page to be populated
     WebDriverWait(self.selenium, self.timeout).until(
             lambda s: len(s.find_elements(*self._people_list_locator)))
示例#25
0
 def __init__(self, testsetup, index):
     Base.__init__(self, testsetup)
     self.index = index
示例#26
0
 def __init__(self, testsetup, open_url=True):
     Base.__init__(self, testsetup)
     if open_url:
         self.open('/')
示例#27
0
 def __init__(self, testsetup, open_url=True):
     Base.__init__(self, testsetup)
     if open_url:
         self.selenium.get(self.base_url)
         self.maximize_window()
示例#28
0
 def __init__(self, testsetup):
     Base.__init__(self, testsetup)
示例#29
0
 def __init__(self, testsetup, open_url=True):
     Base.__init__(self, testsetup)
     if open_url:
         self.selenium.get(self.base_url)
示例#30
0
 def __init__(self, testsetup, open_url=True):
     ''' Creates a new instance of the class and gets the page ready for testing '''
     Base.__init__(self, testsetup)
     if open_url:
         self.selenium.get("https://www.diresworb.org/")
示例#31
0
 def __init__(self, testsetup, open_url=True):
     Base.__init__(self, testsetup)
     if open_url:
         self.open('/')
     WebDriverWait(self.selenium, self.timeout).until(lambda s: s.find_element(*self._promo_box_locator))
示例#32
0
 def click_login_browser_id(self):
     self.selenium.find_element(*self._login_browser_id_locator).click()
     from pages.base import Base
     return Base(self.testsetup)
示例#33
0
 def __init__(self, testsetup, path):
     Base.__init__(self, testsetup)
     self.selenium.open("%s/%s" % (self.site_version, path))
     #resizing this page for elements that disappear when the window is < 1000
     self.selenium.get_eval("window.resizeTo(10000,10000); window.moveTo(0,0)")
示例#34
0
 def __init__(self, testsetup):
     Base.__init__(self, testsetup)
     # Wait for the page to be populated
     WebDriverWait(self.selenium, self.timeout).until(
         lambda s: len(s.find_elements(*self._people_list_locator)))
示例#35
0
 def __init__(self, testsetup, open_url=True):
     """ Creates a new instance of the class and gets the page ready for testing """
     Base.__init__(self, testsetup)
     if open_url:
         self.selenium.get(self.base_url)
def test_mail_login():
    """测试用例"""
    driver = webdriver.Firefox()
    base = Base(driver)
    base.open_url()
    login_action = LoginAction(driver)
    add_contact = NewAction(driver)
    # 是否执行列数据
    is_execute = do_excel.get_column_value(sheetName[0], accountIsExecute)
    data_book = do_excel.get_column_value(sheetName[0], accountDataBook)
    for idx, value in enumerate(is_execute[:]):
        # print(idx, value) # 获取是否执行列数据列表的索引和数据
        if value.lower() == 'y':
            user_row_value = do_excel.get_row_value(sheetName[0], idx + 2)  # 获取执行状态为y所在行的数据
            user_name = user_row_value[accountUserName - 2]
            pass_word = user_row_value[accountPassWord - 2]
            # 登录
            login_action.click_password_login()
            login_action.login(user_name, pass_word)
            time.sleep(10)  # 足够的时间加载登录成功的页面
            try:
                assert '通讯录' in driver.page_source
            except Exception:
                base.save_screen_shot(user_name + '-' + pass_word + '失败')
                log.logger.info('登录失败,输出信息如下:{}'.format(traceback.format_exc()))
                do_excel.write_cell(sheetName[0], idx + 2, accountTestResult, 'failed')
                base.delete_cookies()
                base.open_url()
            else:
                log.logger.info('账号:{}登录成功, 测试通过'.format(user_name))
                do_excel.write_cell(sheetName[0], idx + 2, accountTestResult, 'pass')
                # 获取联系人数据表中是否执行列的数据
                if data_book[idx] == sheetName[1]:
                    is_execute = do_excel.get_column_value(sheetName[1], contactIsExecute)
                    for index, data in enumerate(is_execute):
                        if data.lower() == 'y':
                            # 获取y表示行的数据
                            contact_person_value = \
                                do_excel.get_row_value(sheetName[1], index + 2)
                            # 获取添加联系人所需的数据
                            # 联系人姓名
                            contact_person_name = \
                                contact_person_value[contactName - 2]
                            # 联系人邮箱
                            contact_person_mail = \
                                contact_person_value[contactMail - 2]
                            # 是否为星级联系人
                            contact_person_star = \
                                contact_person_value[contactStar - 2]
                            # 联系人手机号
                            contact_person_phone = \
                                contact_person_value[contactPhone - 2]
                            # 联系人备注
                            contact_person_comment = \
                                contact_person_value[contactComment - 2]
                            # 验证页面包含的关键字
                            contact_assert = \
                                contact_person_value[contactKeyWords - 2]
                            add_contact.address_link()
                            add_contact.add_contact(
                                contact_person_name,
                                contact_person_mail,
                                contact_person_star,
                                contact_person_phone,
                                contact_person_comment
                            )
                            try:
                                assert contact_assert in driver.page_source
                            except Exception:
                                base.save_screen_shot('添加联系人失败')
                                do_excel.write_cell(sheetName[1], index + 2, contactTestResult, 'fail')
                            else:
                                do_excel.write_cell(sheetName[1], index + 2, contactTestResult, 'pass')
                            # 设置足够长的时间 让添加联系人成功后的提示框自动消失,当然可以自己写代码关闭
                            time.sleep(10)
                    base.delete_cookies()
                    base.open_url()
                else:
                    base.delete_cookies()
                    base.open_url()
    base.quit()
 def __init__(self, base_url, selenium, open_url=True):
     Base.__init__(self, base_url, selenium)
     if open_url:
         self.selenium.get("https://sso.mozilla.com")
示例#38
0
def before_all(context):
    fast_fail = os.getenv('FAST_FAIL', False)

    setup_config(context)
    setup_logger(context)

    if (fast_fail):
        connection = httplib.HTTPConnection("fake.ghe.domain", timeout=10)
        connection.request("GET", "/")
        page_response = connection.getresponse()

        if page_response.status != 200:
            eMessage = str(page_response.status) + " " + page_response.reason
            raise Exception(eMessage)

    if context.browser == 'Sauce':
        context.logger.info("Using Sauce Labs")
        desired_capabilities = {
            'name':
            os.getenv('SELENIUM_NAME', 'CKAN browser tests') +
            str(datetime.now()),
            'platform':
            os.getenv('SELENIUM_PLATFORM', 'WINDOWS 7'),
            'browserName':
            os.getenv('SELENIUM_BROWSER', 'chrome'),
            'version':
            int(os.getenv('SELENIUM_VERSION', 33)),
            'max-duration':
            7200,
            'record-video':
            os.getenv('SELENIUM_VIDEO', True),
            'video-upload-on-pass':
            os.getenv('SELENIUM_VIDEO_UPLOAD_ON_PASS', True),
            'record-screenshots':
            os.getenv('SELENIUM_SCREENSHOTS', False),
            'command-timeout':
            int(os.getenv('SELENIUM_CMD_TIMEOUT', 30)),
            'idle-timeout':
            int(os.getenv('SELENIUM_IDLE_TIMEOUT', 10)),
            'tunnel-identifier':
            os.getenv('SELENIUM_TUNNEL'),
            'selenium-version':
            os.getenv('SELENIUM_LIB', '2.45.0'),
            'screen-resolution':
            os.getenv('SELENIUM_RESOLUTION', '1024x768')
        }

        context.logger.info("Running Sauce with capabilities: %s" %
                            desired_capabilities)

        sauce_config = {
            "username": os.getenv('SAUCE_USER'),
            "access-key": os.getenv("SAUCE_KEY")
        }
        context.sauce_config = sauce_config

        driver = webdriver.Remote(
            desired_capabilities=desired_capabilities,
            command_executor="http://%s:%[email protected]:80/wd/hub" %
            (sauce_config['username'], sauce_config['access-key']))

    else:
        driver = webdriver.Chrome(context.chromedriver_path)

    context.base = Base(context.logger, context.directory, context.base_url,
                        driver, 10, context.delay_secs)
    context.home = Home(context.logger, context.directory, context.base_url,
                        driver, 10, context.delay_secs)
    context.navigation = Navigation(context.logger, context.directory,
                                    context.base_url, driver, 10,
                                    context.delay_secs)
    context.datasets = Datasets(context.logger, context.directory,
                                context.base_url, driver, 10,
                                context.delay_secs)
    context.organizations = Organizations(context.logger, context.directory,
                                          context.base_url, driver, 10,
                                          context.delay_secs)
    context.groups = Groups(context.logger, context.directory,
                            context.base_url, driver, 10, context.delay_secs)
    context.screenshot = Screenshot(context.base, context.take_screenshots)

    context.utils = Utils(context.base)
示例#39
0
 def __init__(self, testsetup):
     Base.__init__(self, testsetup)
     WebDriverWait(self.selenium, self.timeout).until(
         lambda s: self.is_element_visible(*self._profile_photo_locator))
示例#40
0
def test_owned_experiments_page_loads(base_url, selenium):
    """Test Owned Deliveries link opens correct page."""
    selenium.get(base_url)
    page = Base(selenium, base_url)
    experiments = page.header.click_owned_experiments()
    assert f"{experiments.count} Deliveries by" in experiments.title
示例#41
0
 def __init__(self, base_url, selenium, open_url=True):
     Base.__init__(self, base_url, selenium)
     if open_url:
         self.selenium.get(self.base_url)
示例#42
0
 def __init__(self, base_url, selenium, open_url=True):
     Base.__init__(self, base_url, selenium)
     if open_url:
         self.selenium.get(self.base_url)
示例#43
0
文件: faq.py 项目: anah/remo-tests
 def __init__(self, testsetup):
     Base.__init__(self, testsetup)
     self.wait_for_element_visible(*self._faq_sidebar)
示例#44
0
 def __init__(self, testsetup):
     ''' Creates a new instance of the class and gets the page ready for testing '''
     Base.__init__(self, testsetup)
     self.selenium.open("%s/" % self.site_version)
     self.selenium.window_maximize()
示例#45
0
 def __init__(self, base_url, selenium):
     Base.__init__(self, base_url, selenium)
     WebDriverWait(
         self.selenium,
         self.timeout).until(lambda s: self.is_no_results_present or len(
             s.find_elements(*self._results_locator)) > 0)
示例#46
0
 def __init__(self, setup):
     Base.__init__(self, setup)
示例#47
0
 def __init__(self, testsetup):
     Base.__init__(self, testsetup)
     WebDriverWait(self.selenium, self.timeout).until(
         lambda s: self.is_element_visible(*self._profile_photo_locator))
示例#48
0
 def __init__(self,setup):
     Base.__init__(self, setup)
示例#49
0
 def __init__(self, testsetup, open_url=True):
     Base.__init__(self, testsetup)
     if open_url:
         self.selenium.get(self.base_url)
示例#50
0
 def __init__(self, testsetup, open_url=True):
     Base.__init__(self, testsetup)
     if open_url:
         self.selenium.get(self.base_url)
     WebDriverWait(self.selenium, self.timeout).until(
         lambda s: s.find_element(*self._promo_box_locator))