Ejemplo n.º 1
0
def test_macros_search_all_by_form(base_url, selenium):
    """Manual search form can search all pages."""
    page = MacroDashboardPage(selenium, base_url).open()
    page.manual_search('CSSRef')
    url_bits = urlparse(selenium.current_url)
    query = parse_qs(url_bits.query)
    assert query == {
        'locale': ['*'],
        'topic': ['none'],
        'kumascript_macros': ['CSSRef']
    }
Ejemplo n.º 2
0
def test_macros_search_all_by_form(base_url, selenium):
    """Manual search form can search all pages."""
    page = MacroDashboardPage(selenium, base_url).open()
    page.manual_search('CSSRef')
    url_bits = urlparse(selenium.current_url)
    query = parse_qs(url_bits.query)
    assert query == {
        'locale': ['*'],
        'topic': ['none'],
        'kumascript_macros': ['CSSRef']
    }
Ejemplo n.º 3
0
def test_macros_search_all_by_form(base_url, selenium):
    """Manual search form can search all pages."""
    if selenium.capabilities['browserName'] == 'firefox':
        pytest.xfail('"click()" on the macro form-search buttons '
                     'does not currently work for Firefox')
    page = MacroDashboardPage(selenium, base_url).open()
    page.manual_search('CSSRef')
    url_bits = urlparse(selenium.current_url)
    query = parse_qs(url_bits.query)
    assert query == {
        'locale': ['*'],
        'topic': ['none'],
        'kumascript_macros': ['CSSRef']
    }
Ejemplo n.º 4
0
def test_macros_search_all_by_click(base_url, selenium):
    """/en-US/dashboards/macros links to complete search results."""
    page = MacroDashboardPage(selenium, base_url).open()
    if not page.has_usage_counts:
        # ElasticSearch not ready, no search link to click
        return

    name = page.first_source_link.text
    page.click_first_all_search()
    page.wait.until(lambda s: selenium.title != page.TITLE)
    url_bits = urlparse(selenium.current_url)
    query = parse_qs(url_bits.query)
    assert query == {
        'locale': ['*'],
        'topic': ['none'],
        'kumascript_macros': [name]
    }
Ejemplo n.º 5
0
def test_macros_search_all_by_click(base_url, selenium):
    """/en-US/dashboards/macros links to complete search results."""
    page = MacroDashboardPage(selenium, base_url).open()
    if not page.has_usage_counts:
        # ElasticSearch not ready, no search link to click
        return

    name = page.first_source_link.text
    page.click_first_all_search()
    page.wait.until(lambda s: selenium.title != page.TITLE)
    url_bits = urlparse(selenium.current_url)
    query = parse_qs(url_bits.query)
    assert query == {
        'locale': ['*'],
        'topic': ['none'],
        'kumascript_macros': [name]
    }
Ejemplo n.º 6
0
def test_macros(base_url, selenium):
    """/en-US/dashboards/macros returns the active macros list."""
    # Open and check macros dashboard
    page = MacroDashboardPage(selenium, base_url).open()
    assert selenium.title == page.TITLE
    assert page.has_table
    first_source_link = page.first_source_link
    name = first_source_link.text
    href = first_source_link.get_attribute('href')
    assert href.startswith(
        'https://github.com/mdn/kumascript/blob/master/macros/' + name)

    # Click link to Github
    first_source_link.click()
    page.wait.until(lambda s: selenium.title != page.TITLE)
    assert selenium.current_url == href