示例#1
0
 def click_home_button(self):
     """Return home object."""
     from pages.home import Home
     recipes_breadcrumb = self.wait.until(
         EC.element_to_be_clickable(self.LOCATORS.recipes_breadcrumb))
     recipes_breadcrumb.click()
     return Home(self.selenium, self.base_url).wait_for_page_to_load()
示例#2
0
    def test_filter_results_by_owner(self, mozwebqa):
        query = u'John Giannelos'
        home_page = Home(mozwebqa)

        events_page = home_page.header.click_events_link()
        events_page.filter_for(query)
        Assert.equal(u'John Giannelos', events_page.event_profile_owner_text)
示例#3
0
    def test_filter_results_by_location(self, mozwebqa):
        query = u'Greece'
        home_page = Home(mozwebqa)

        events_page = home_page.header.click_events_link()
        events_page.filter_for(query)
        Assert.contains(u'Greece', events_page.event_profile_location_text)
示例#4
0
    def test_events_timeline_is_visible(self, mozwebqa):
        home_page = Home(mozwebqa)

        events_page = home_page.header.click_events_link()
        events_page.click_timeline()
        events_page.wait_for_page_to_load()
        Assert.true(events_page.is_events_timeline_visible)
示例#5
0
    def test_advanced_options_are_visible(self, mozwebqa):
        home_page = Home(mozwebqa)

        events_page = home_page.header.click_events_link()
        events_page.click_advanced_options()
        Assert.true(events_page.is_advanced_search_form_visible)
        Assert.true(events_page.is_events_icalendar_export_button_visible)
    def test_login_create_account(self, driver):

        auth = Home(driver).sign_in()
        auth.write_email_create_account("testing")
        auth.click_create_account()
        auth.sleep(3)
        auth.read_error_create_account()
示例#7
0
def test_duplicate_branch_name(base_url, selenium):
    """Test adding a branch with the same name as the control branch."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    experiment.name = "This is a test"
    experiment.short_description = "Testing in here"
    experiment.public_name = "Public Name"
    experiment.public_description = "Public Description"
    experiment.bugzilla_url = "http://bugzilla.com/show_bug.cgi?id=1234"
    exp_detail = experiment.save_btn()
    exp_design = exp_detail.click_edit()
    exp_design.input_firefox_pref_name("robot rock")
    exp_design.select_firefox_pref_type()
    exp_design.select_firefox_pref_branch()
    control_branch = exp_design.current_branches[0]
    control_branch.set_branch_name("DUPLICATE BRANCH")
    control_branch.set_branch_description('THIS IS A TEST')
    control_branch.set_branch_value("false")
    extra_branch = exp_design.current_branches[-1]
    extra_branch.set_branch_name("DUPLICATE BRANCH")
    extra_branch.set_branch_description('THIS IS A TEST')
    extra_branch.set_branch_value("false")
    exp_design.click_continue()
    selenium.find_element_by_css_selector("#design-form .invalid-feedback")
示例#8
0
def fill_overview(selenium, base_url, ds_issue_host, request, variables):
    """Fills overview page."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    experiment_type = getattr(request.module, "experiment_type", None)
    experiment.experiment_type = getattr(
        request.module, "experiment_type_name", "Pref-Flip Experiment"
    )
    if request.node.get_closest_marker("use_variables"):
        experiment.name = f"{variables[experiment_type]['name']}"
        experiment.short_description = "Testing in here"
        experiment.public_name = f"{variables[experiment_type]['userFacingName']}"
        experiment.public_description = (
            f"{variables[experiment_type]['userFacingDescription']}"
        )
    else:
        experiment.name = "This is a test"
        experiment.short_description = "Testing in here"
        experiment.public_name = "Public Name"
        experiment.public_description = "Public Description"
        experiment.ds_issue_url = f"{ds_issue_host}DS-12345"
    experiment.ds_issue_url = f"{ds_issue_host}DS-12345"
    experiment.save_btn()
    # Add url to object
    url = urlparse(selenium.current_url)
    experiment.url = url.path
    return experiment
示例#9
0
 def test_login_missing_password(self, driver):
     sign_in = Home(driver).sign_in()
     sign_in.write_email("*****@*****.**")
     sign_in.click_sign_in()
     error_str = sign_in.read_error_alert()
     assert error_str == "Password is required.", " Expected: 'Password is required.' missing password error.   Actual: {0}".format(
         error_str)
def test_duplicate_branch_name(base_url, selenium):
    """Test adding a branch with the same name as the control branch."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    experiment.fill_name("This is a test")
    experiment.fill_short_description("Testing in here")
    experiment.fill_bugzilla_url("http://bugzilla.com/show_bug.cgi?id=1234")
    exp_population = experiment.save_and_continue_btn()
    exp_population.fill_firefox_population_percentage()
    exp_population.select_firefox_channel()
    exp_population.select_firefox_min_version()
    exp_population.input_firefox_pref_name("robot rock")
    exp_population.select_firefox_pref_type()
    exp_population.select_firefox_pref_branch()
    control_branch = exp_population.current_branches[0]
    control_branch.set_branch_name("DUPLICATE BRANCH")
    control_branch.set_branch_description('THIS IS A TEST')
    control_branch.set_branch_value("false")
    extra_branch = exp_population.current_branches[-1]
    extra_branch.set_branch_name("DUPLICATE BRANCH")
    extra_branch.set_branch_description('THIS IS A TEST')
    extra_branch.set_branch_value("false")
    exp_population.click_continue()
    selenium.find_element_by_css_selector("#formset .invalid-feedback")
示例#11
0
    def test_profile_grid_is_visible(self, mozwebqa):
        home_page = Home(mozwebqa)

        people_page = home_page.header.click_people_link()
        Assert.true(people_page.is_profile_grid_visible)
        Assert.true(people_page.is_profile_name_visible)
        Assert.true(people_page.is_profile_image_visible)
 def test_link_comment_is_correct(self):
     home = Home(self.driver)
     home.open()
     self.assertEqual(
         home.link_comments.get('text'), home.link_comment(),
         'expected comment to be: %s found %s instead' %
         (home.link_comments.get('text'), home.link_comment()))
 def test_link_title_part_two_is_correct(self):
     home = Home(self.driver)
     home.open()
     self.assertEqual(
         home.link_title_part_two.get('text'), home.link_title_two(),
         'expected link title part one to be: %s, found %s instead' %
         (home.link_title_part_two.get('text'), home.link_title_two()))
 def test_ordinal_number_is_correct(self):
     home = Home(self.driver)
     home.open()
     self.assertEqual(
         home.lp.get('text'), home.link_lp(),
         'expected ordinal number to be: %s, found %s instead' %
         (home.lp.get('text'), home.link_lp()))
示例#15
0
 def login(self, user='******'):
     # browser id is not logging in a normal mode and it requiters a refresh to login properly
     self.selenium.refresh()
     login = self.click_login_browser_id()
     login.login_user_browser_id(user)
     from pages.home import Home
     return Home(self.testsetup)
 def test_sign_up_link_destination_is_correct(self):
     home = Home(self.driver)
     home.open()
     home._validate_page(self.driver)
     link = Home.Header.sign_up
     url = home.link_destination(link.get('locator'))
     self.assertTrue(url.endswith(link.get('suffix')), '%s is bad' % (url))
示例#17
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)
示例#18
0
    def test_login_invalid_email(self, driver):

        sign_in = Home(driver).sign_in()
        sign_in.write_email("invalid-emailgmail.com")
        sign_in.click_sign_in()
        error_str = sign_in.read_error_alert()
        assert error_str == "Invalid email address.", " Expected: 'Invalid email address.' invalid email error.   Actual: {0}".format(
            error_str)
示例#19
0
def test_create_new_job_button_is_displayed(selenium, base_url):
    # GIVEN: Selenium driver and the base_url

    # WHEN: The Home page is fully loaded
    home = Home(selenium, base_url).open()

    # THEN: The create a new job button is displayed
    assert home.is_create_new_job_button_displayed
示例#20
0
    def test_filter_results_by_name(self, mozwebqa):
        # Verify name in search matches query results
        query = u'Reps'
        home_page = Home(mozwebqa)

        people_page = home_page.header.click_people_link()
        people_page.filter_for(query)
        Assert.contains(u'Reps', people_page.people_name_text)

        # Check profile to verify search results where search does not match name
        query = u'moz_reps_user'
        home_page = Home(mozwebqa)

        people_page = home_page.header.click_people_link()
        people_page.filter_for(query)
        profile_page = people_page.click_to_open_profile()
        Assert.contains(query, profile_page.profile_text)
示例#21
0
    def test_menu_items(self, mozwebqa):

        home = Home(mozwebqa)

        home.go_to_homepage()

        for menu_item in home.header.main_menu:
            Assert.contains(menu_item.text, self._menu_items)
示例#22
0
def test_related_experiments_updates_correctly(base_url, selenium):
    """Test updating related experiments."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    assert experiment.related_experiments == "Nothing selected"
    # Choose some random experiment from the list
    experiment.related_experiments = 1
示例#23
0
    def login(self, user='******', use_return=True):
        sign_in = self.header.click_sign_in()
        credentials = self.testsetup.credentials[user]
        sign_in.login(credentials, use_return)

        WebDriverWait(self.selenium, 10).until(lambda s: self.is_element_visible(*self._auth_locator))
        from pages.home import Home
        return Home(self.testsetup , open_url=False)
 def test_logo_link_destination_is_correct(self):
     home = Home(self.driver)
     home.open()
     home._validate_page(self.driver)
     link = Home.Header._logo_url
     url = home.link_destination(link.get('locator'))
     self.assertTrue(url.endswith(link.get('suffix')),
                     '%s does not ends with %s' % (url, link.get('suffix')))
def test_invalid_colid_error_preview(selenium, base_url):
    # GIVEN: Selenium driver and the base url

    # WHEN: The Home page is fully loaded
    home = Home(selenium, base_url).open()

    # AND: The create a new job button is clicked
    modal = home.click_create_new_job_button()

    # AND: Clicks the Web Preview button
    modal.click_web_preview_radio_button()

    # AND: Incorrect collection id is typed into the collection id field
    modal.fill_collection_id_field("1col11229")

    # AND: Create button is clicked
    modal.click_create_button()

    split_col_id_incorrect = modal.collection_id_incorrect_field_error.text.splitlines(
    )
    text_col_id_incorrect = split_col_id_incorrect[1]

    # THEN: Correct error message appears in collection id field
    assert "A valid collection ID is required, e.g. col12345" == text_col_id_incorrect

    split_style = modal.style_field_error.text.splitlines()
    text_style = split_style[1]
    assert "Style is required" == text_style

    split_server = modal.content_server_field_error.text.splitlines()
    text_server = split_server[1]
    assert "Please select a server" == text_server

    # THEN: The modal does not close and remains open
    assert home.create_job_modal_is_open

    # WHEN: modal is open and collection id has incorrect colid/slug
    # AND: Web preview (git) button is clicked
    modal.click_web_preview_git_radio_button()

    # AND: Create button is clicked when data fields are empty and collection ID field has incorrect colid
    modal.click_create_button()

    split_col_id_slug_incorrect = (
        modal.collection_id_slug_incorrect_field_error.text.splitlines())
    text_col_id_slug_incorrect = split_col_id_slug_incorrect[1]

    # THEN: Correct error message appears in collection id and style field
    assert ("A valid repo and slug name is required, e.g. repo-name/slug-name"
            == text_col_id_slug_incorrect)

    split_style = modal.style_field_error.text.splitlines()
    text_style = split_style[1]
    assert "Style is required" == text_style

    # THEN: No error message appears for Content Server as it is disabled for web preview git
    split_server = modal.content_server_field_error.text.splitlines()
    assert "Please select a server" not in split_server
示例#26
0
def test_feature_bugzilla_url_changes_correctly(base_url, selenium):
    """Test adding a bugzilla url."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    assert experiment.feature_bugzilla_url == ""
    new_url = "http://bugzilla.org/1234-new-url"
    experiment.feature_bugzilla_url = new_url
    assert new_url in experiment.feature_bugzilla_url
示例#27
0
def test_overview_type_changes_correctly(base_url, selenium):
    """Test changing experiment type."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    assert "Pref-Flip Experiment" in experiment.experiment_type
    exp_type = "Add-On Experiment"
    experiment.experiment_type = exp_type
    assert exp_type in experiment.experiment_type
示例#28
0
def test_public_description_changes_correctly(base_url, selenium):
    """Test adding a public description."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    assert experiment.public_description == ""
    new_public_description = "THIS IS A LONG DESCRIPTION..!"
    experiment.public_description = new_public_description
    assert new_public_description in experiment.public_description
示例#29
0
def test_public_name_changes_correctly(base_url, selenium):
    """Test adding a public name."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    assert experiment.public_name == ""
    new_public_name = "uitested exp"
    experiment.public_name = new_public_name
    assert new_public_name in experiment.public_name
示例#30
0
def test_overview_owner_changes_correctly(base_url, selenium):
    """Test changing experiment owner."""
    selenium.get(base_url)
    home = Home(selenium, base_url).wait_for_page_to_load()
    experiment = home.create_experiment()
    assert home.header.current_user in experiment.experiment_owner
    owner = "admin"
    experiment.experiment_owner = owner
    assert owner in experiment.experiment_owner