示例#1
0
def test_enable_and_disable_experiment(base_url, selenium, firefox,
                                       notifications):
    """Test enabling of an experiment."""
    page = Home(selenium, base_url + '/experiments').open()
    selenium.add_cookie({
        'name': 'updates-last-viewed-date',
        'value': datetime.datetime.now().isoformat(),
        'max_age': 120,
        'domain': 'example.com'
    })
    selenium.execute_script(
        "document.querySelector('.landing-experiments').scrollIntoView();")

    if not page.featured.is_displayed:
        selenium.execute_script(
            "document.querySelector('.landing-experiments').scrollIntoView();")
        experiments = page.header.click_install_button()
    else:
        experiments = page.bottom_install_button()

    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()

    experiment = experiments.find_experiment(experiment='Dev Example')
    experiment.enable()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    exp_detail = Detail(selenium, base_url)
    assert exp_detail.enabled_popup.is_popup_displayed()
    exp_detail.enabled_popup.close()
    experiment.disable()
    assert experiment.enable_button.is_displayed()
示例#2
0
def test_enable_and_disable_experiment(base_url, selenium, firefox,
                                       notifications):
    """Test enabling of an experiment."""
    page = Experiments(selenium, base_url).open()
    selenium.add_cookie({
        'name': 'updates-last-viewed-date',
        'value': datetime.datetime.now().isoformat(),
        'max_age': 120,
        'domain': 'example.com'
    })
    experiment = page.find_experiment(experiment='Dev Example')
    experiment.install_and_enable()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    exp_detail = Detail(selenium, base_url)
    assert exp_detail.email_popup.is_popup_displayed()
    exp_detail.email_popup.close()
    assert exp_detail.enabled_popup.is_popup_displayed()
    exp_detail.enabled_popup.close()
    experiment.disable()
    assert experiment.enable_button.is_displayed()
示例#3
0
def test_install_and_enable(base_url, selenium, firefox, notifications):
    Home(selenium, base_url).open()
    experiments = Experiments(selenium, base_url)
    experiment = experiments.find_experiment(experiment='Dev Example')
    experiment.install_and_enable()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    assert Detail(selenium, base_url).enabled_popup.is_popup_displayed()
示例#4
0
def test_enable_experiment(base_url, selenium, firefox, notifications):
    """Test enabling of an experiment."""
    page = Home(selenium, base_url).open()
    experiments = page.header.click_install_button()
    experiments.welcome_popup.close()
    experiment = experiments.find_experiment(experiment='Dev Example')
    experiment.enable()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()
    assert Detail(selenium, base_url).enabled_popup.is_popup_displayed()
示例#5
0
    def find_experiment(self, experiment=None):
        """Locate experiment given.

        Args:
            str: Experiment name.

        Returns:
            obj: Experiment Detail object.

        """
        for item in self.list:
            if experiment in item.name:
                item.click()
                from pages.desktop.detail import Detail
                return Detail(self.selenium, self.base_url)
            else:
                continue
        raise AttributeError('Experiment: {0}, not found.'.format(experiment))
示例#6
0
    def find_experiment(self, experiment=None):
        """Locate experiment given.

        Args:
            str: Experiment name.

        Returns:
            obj: Experiment Detail object.

        """
        for item in self.list:
            if experiment in item.name:
                item.click()
                from pages.desktop.detail import Detail
                return Detail(self.selenium, self.base_url)
            else:
                continue
        raise AttributeError('Experiment: {0}, not found.'.format(experiment))

        @property
        def title(self):
            """Return title text of popup."""
            return self.find_element(*self._popup_locator_title).text
示例#7
0
 def click(self):
     """Clicks on the experiment."""
     self.root.click()
     from pages.desktop.detail import Detail
     return Detail(self.selenium, self.page.base_url)
示例#8
0
        def link(self):
            self.find_element(*self._search_item_link_locator).click()
            from pages.desktop.detail import Detail

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