<commit_before>import os
import datetime

import pytest
from pages.desktop.experiments import Experiments
from pages.desktop.home import Home
from pages.desktop.detail import Detail


@pytest.mark.nondestructive
@pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None,
                    reason='Skip install on Release and Beta Firefox.')
def test_install_of_test_pilot_addon(
        base_url, selenium, firefox, notifications):
    """Check that the testpilot addon is installable and installs."""
    page = Home(selenium, base_url).open()
    selenium.execute_script(
        "document.querySelector('.landing-experiments').scrollIntoView();"
    )
    if not page.featured.is_displayed:
        page.header.click_install_button()
        firefox.browser.wait_for_notification(
            notifications.AddOnInstallConfirmation).install()
        firefox.browser.wait_for_notification(
            notifications.AddOnInstallComplete
        ).close()
    else:
        page.featured.click_install_button()
        firefox.browser.wait_for_notification(
            notifications.AddOnInstallConfirmation).install()
        firefox.browser.wait_for_notification(
            notifications.AddOnInstallComplete
        ).close()


@pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None,
                    reason='Skip install on Release and Beta Firefox.')
@pytest.mark.nondestructive
def test_bottom_install_button(base_url, selenium, firefox, notifications):
    page = Home(selenium, base_url).open()
    page.bottom_install_button()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()


@pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None,
                    reason='Skip install on Release and Beta Firefox.')
@pytest.mark.nondestructive
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.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()


@pytest.mark.nondestructive
@pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None,
                    reason='Skip install on Release and Beta Firefox.')
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()
<commit_msg>temporarily disable integration tests until we solidify addon envs (#3662)<commit_after>import os
# import datetime

import pytest
# from pages.desktop.experiments import Experiments
from pages.desktop.home import Home
# from pages.desktop.detail import Detail


# @pytest.mark.nondestructive
# @pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None,
#                     reason='Skip install on Release and Beta Firefox.')
# def test_install_of_test_pilot_addon(
#         base_url, selenium, firefox, notifications):
#     """Check that the testpilot addon is installable and installs."""
#     page = Home(selenium, base_url).open()
#     selenium.execute_script(
#         "document.querySelector('.landing-experiments').scrollIntoView();"
#     )
#     if not page.featured.is_displayed:
#         page.header.click_install_button()
#         firefox.browser.wait_for_notification(
#             notifications.AddOnInstallConfirmation).install()
#         firefox.browser.wait_for_notification(
#             notifications.AddOnInstallComplete
#         ).close()
#     else:
#         page.featured.click_install_button()
#         firefox.browser.wait_for_notification(
#             notifications.AddOnInstallConfirmation).install()
#         firefox.browser.wait_for_notification(
#             notifications.AddOnInstallComplete
#         ).close()


@pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None,
                    reason='Skip install on Release and Beta Firefox.')
@pytest.mark.nondestructive
def test_bottom_install_button(base_url, selenium, firefox, notifications):
    page = Home(selenium, base_url).open()
    page.bottom_install_button()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallConfirmation).install()
    firefox.browser.wait_for_notification(
        notifications.AddOnInstallComplete).close()


# @pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None,
#                     reason='Skip install on Release and Beta Firefox.')
# @pytest.mark.nondestructive
# 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.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()


# @pytest.mark.nondestructive
# @pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None,
#                     reason='Skip install on Release and Beta Firefox.')
# 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()

{'fraction_non_alphanumeric': 0.10143741965642164, 'fraction_numerical': 0.001168633867009466, 'mean_word_length': 3.694459681843116, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '499909', 'n_tokens_mistral': 2546, 'n_tokens_neox': 2467, 'n_words': 391}