Esempio n. 1
0
def test_devhub_addon_upload_approve_install(base_url, selenium, devhub_upload,
                                             firefox, firefox_notifications):
    """Test uploading an addon via devhub."""
    'ui-test-addon-2' in devhub_upload.addons[-1].name
    # We have to wait for approval
    time.sleep(15)
    page_loaded = False
    while page_loaded is not True:
        try:
            selenium.get('{}/addon/ui-test_devhub_ext/'.format(base_url))
            addon = Detail(selenium, base_url)
            'UI-Test_devhub_ext' in addon.name
        except NoSuchElementException:
            pass
        except Exception:
            raise Exception
        else:
            page_loaded = True
            return page_loaded
    addon.install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallBlocked).allow()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallComplete).close()
Esempio n. 2
0
def test_devhub_addon_upload_approve_install(
        base_url, selenium, devhub_upload, firefox, firefox_notifications):
    """Test uploading an addon via devhub."""
    'ui-test-addon-2' in devhub_upload.addons[-1].name
    # We have to wait for approval
    time.sleep(15)
    page_loaded = False
    while page_loaded is not True:
        try:
            selenium.get('{}/addon/ui-test_devhub_ext/'.format(base_url))
            addon = Detail(selenium, base_url)
            'UI-Test_devhub_ext' in addon.name
        except NoSuchElementException:
            pass
        except Exception:
            raise Exception
        else:
            page_loaded = True
            return page_loaded
    addon.install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallBlocked
    ).allow()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallConfirmation
    ).install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallComplete
    ).close()
Esempio n. 3
0
def test_select_result_with_enter_key(base_url, selenium, variables):
    page = Home(selenium, base_url).open()
    term = variables['search_term']
    page.search.search_for(term, execute=False)
    action = ActionChains(selenium)
    action.send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
    # give time to the detail page to load
    page.wait_for_title_update(term)
    detail = Detail(selenium, base_url)
    detail.wait_for_page_to_load()
    assert term in detail.name
Esempio n. 4
0
def test_select_result_with_click(base_url, selenium, variables):
    page = Home(selenium, base_url).open()
    term = variables['search_term']
    suggestions = page.search.search_for(term, execute=False)
    result = suggestions[0].root
    action = ActionChains(selenium)
    action.move_to_element(result).click().perform()
    # give time to the detail page to load
    page.wait_for_title_update(term)
    detail = Detail(selenium, base_url)
    detail.wait_for_page_to_load()
    assert term in detail.name
Esempio n. 5
0
def test_addon_install(base_url, selenium, firefox, firefox_notifications):
    """Test that navigates to an addon and installs it."""
    selenium.get('{}/addon/ui-test-install'.format(base_url))
    addon = Detail(selenium, base_url)
    assert 'Ui-Addon-Install' in addon.name
    addon.install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallBlocked).allow()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallComplete).close()
Esempio n. 6
0
def test_extension_permissions(selenium, base_url, variables):
    extension = variables['detail_extension_slug']
    selenium.get(f'{base_url}/addon/{extension}')
    addon = Detail(selenium, base_url)
    assert 'Permissions' in addon.permissions.permissions_card_header
    permissions = addon.permissions.permissions_list
    # checks that each permission has a corresponding icon and description
    for permission in permissions:
        assert permission.permission_icon.is_displayed()
        assert permission.permission_description.is_displayed()
    addon.permissions.click_permissions_button()
    addon.wait_for_current_url('permission-request')
def test_addon_install(
        base_url, selenium, firefox, firefox_notifications):
    """Test that navigates to an addon and installs it."""
    selenium.get('{}/addon/ui-test-install'.format(base_url))
    addon = Detail(selenium, base_url)
    assert 'Ui-Addon-Install' in addon.name
    addon.install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallBlocked).allow()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallComplete).close()
Esempio n. 8
0
def test_devhub_addon_upload_approve_install(base_url, selenium, devhub_upload,
                                             firefox, firefox_notifications):
    """Test uploading an addon via devhub."""
    'ui-test-addon-2' in devhub_upload.addons[-1].name
    # We have to wait for approval
    time.sleep(15)
    selenium.get('{}/addon/ui-test_devhub_ext/'.format(base_url))
    addon = Detail(selenium, base_url)
    assert 'UI-Test_devhub_ext' in addon.name
    addon.install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallBlocked).allow()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallComplete).close()
Esempio n. 9
0
def test_lower_firefox_incompatibility(selenium, base_url, variables):
    extension = variables['lower_firefox_version']
    selenium.get(f'{base_url}/addon/{extension}')
    addon = Detail(selenium, base_url)
    assert 'This add-on is not compatible with your version of Firefox.' \
           in addon.incompatibility_message
    assert addon.button_state_disabled
Esempio n. 10
0
def test_platform_incompatibility(selenium, base_url, variables):
    extension = variables['incompatible_platform']
    selenium.get(f'{base_url}/addon/{extension}')
    addon = Detail(selenium, base_url)
    assert 'This add-on is not available on your platform.' \
           in addon.incompatibility_message
    assert addon.button_state_disabled
Esempio n. 11
0
def test_higher_firefox_incompatibility(selenium, base_url, variables):
    extension = variables['higher_firefox_version']
    selenium.get(f'{base_url}/addon/{extension}')
    addon = Detail(selenium, base_url)
    assert 'This add-on requires a newer version of Firefox' \
           in addon.incompatibility_message
    assert addon.button_state_disabled
Esempio n. 12
0
def test_contribute_button(selenium, base_url, variables):
    extension = variables['detail_extension_slug']
    selenium.get(f'{base_url}/addon/{extension}')
    addon = Detail(selenium, base_url)
    assert 'Support this developer' in addon.contribute.contribute_card_header
    assert variables['contribute_card_summary'] in\
           addon.contribute.contribute_card_content
    addon.contribute.click_contribute_button()
    # verifies that utm params are passed from AMO to the external contribute site
    wait = WebDriverWait(selenium, 10)
    wait.until(expected.url_contains(variables['contribute_utm_param']))
Esempio n. 13
0
def test_addon_install(base_url, selenium, firefox, firefox_notifications,
                       addon_type, name_type):
    """Test that navigates to an addon and installs it."""
    selenium.get('{}/addon/{}'.format(base_url, addon_type))
    addon = Detail(selenium, base_url)
    assert name_type in addon.name
    assert addon.is_compatible
    addon.install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        firefox_notifications.AddOnInstallComplete).close()
    assert 'Remove' in addon.button_text
    # Reused the 'install()` method although the next step reflects an uninstall action.
    addon.install()
    # using a 'try - except AssertionError' method because the install button text is different for Themes.
    try:
        assert 'Add to Firefox' in addon.button_text
    except AssertionError:
        assert 'Install Theme' in addon.button_text
Esempio n. 14
0
 def select(self):
     self.root.click()
     from pages.desktop.details import Detail
     return Detail(self.selenium, self.page).wait_for_page_to_load()
Esempio n. 15
0
            def link(self):
                self.find_element(*self._search_item_name_locator).click()
                from pages.desktop.details import Detail

                detail_page = Detail(self.selenium, self.page.base_url)
                return detail_page.wait_for_page_to_load()
Esempio n. 16
0
            def link(self):
                self.find_element(*self._search_item_name_locator).click()
                from pages.desktop.details import Detail

                detail_page = Detail(self.selenium, self.page.base_url)
                return detail_page.wait_for_page_to_load()