def setUpClass(cls):
        if os.environ.get('DISABLE_ACCEPTANCE_TESTS') == 'True':
            raise SkipTest

        cls.selenium = browser()
        cls.selenium.set_page_load_timeout(30)
        super(RefundAcceptanceTestMixin, cls).setUpClass()
Esempio n. 2
0
def check_firefox_version():
    """
    Check that firefox is the correct version.
    """
    if 'BOK_CHOY_HOSTNAME' in os.environ:
        # Firefox is running in a separate Docker container; get its version via Selenium
        driver = browser()
        capabilities = driver.capabilities
        if capabilities['browserName'] == 'firefox':
            firefox_version_regex = re.compile(r'^\d+\.\d+')
            version_key = 'browserVersion' if 'browserVersion' in 'capabilities' else 'version'
            try:
                firefox_ver = float(
                    firefox_version_regex.search(
                        capabilities[version_key]).group(0))
            except AttributeError:
                firefox_ver = 0.0
        else:
            firefox_ver = 0.0
        driver.close()
        if firefox_ver < MINIMUM_FIREFOX_VERSION:
            raise Exception(
                'Required firefox version not found.\n'
                'Expected: {expected_version}; Actual: {actual_version}.\n\n'
                'Make sure that the edx.devstack.firefox container is up-to-date and running\n'
                '\t{expected_version}'.format(
                    actual_version=firefox_ver,
                    expected_version=MINIMUM_FIREFOX_VERSION))
        return

    # Firefox will be run as a local process
    expected_firefox_ver = "Mozilla Firefox " + str(MINIMUM_FIREFOX_VERSION)
    firefox_ver_string = subprocess.check_output("firefox --version",
                                                 shell=True).strip()
    firefox_version_regex = re.compile(r"Mozilla Firefox (\d+.\d+)")
    try:
        firefox_ver = float(
            firefox_version_regex.search(firefox_ver_string).group(1))
    except AttributeError:
        firefox_ver = 0.0
    debian_location = 'https://s3.amazonaws.com/vagrant.testeng.edx.org/'
    debian_package = 'firefox-mozilla-build_42.0-0ubuntu1_amd64.deb'
    debian_path = '{location}{package}'.format(location=debian_location,
                                               package=debian_package)

    if firefox_ver < MINIMUM_FIREFOX_VERSION:
        raise Exception(
            'Required firefox version not found.\n'
            'Expected: {expected_version}; Actual: {actual_version}.\n\n'
            'As the vagrant user in devstack, run the following:\n\n'
            '\t$ sudo wget -O /tmp/firefox_42.deb {debian_path}\n'
            '\t$ sudo apt-get remove firefox\n\n'
            '\t$ sudo gdebi -nq /tmp/firefox_42.deb\n\n'
            'Confirm the new version:\n'
            '\t$ firefox --version\n'
            '\t{expected_version}'.format(
                actual_version=firefox_ver,
                expected_version=expected_firefox_ver,
                debian_path=debian_path))
Esempio n. 3
0
def check_firefox_version():
    """
    Check that firefox is the correct version.
    """
    if 'BOK_CHOY_HOSTNAME' in os.environ:
        # Firefox is running in a separate Docker container; get its version via Selenium
        driver = browser()
        capabilities = driver.capabilities
        if capabilities['browserName'].lower() == 'firefox':
            firefox_version_regex = re.compile(r'^\d+\.\d+')
            version_key = 'browserVersion' if 'browserVersion' in capabilities else 'version'
            try:
                firefox_ver = float(firefox_version_regex.search(capabilities[version_key]).group(0))
            except AttributeError:
                firefox_ver = 0.0
        else:
            firefox_ver = 0.0
        driver.close()
        if firefox_ver < MINIMUM_FIREFOX_VERSION:
            raise Exception(
                'Required firefox version not found.\n'
                'Expected: {expected_version}; Actual: {actual_version}.\n\n'
                'Make sure that the edx.devstack.firefox container is up-to-date and running\n'
                '\t{expected_version}'.format(
                    actual_version=firefox_ver,
                    expected_version=MINIMUM_FIREFOX_VERSION
                )
            )
        return

    # Firefox will be run as a local process
    expected_firefox_ver = "Mozilla Firefox " + str(MINIMUM_FIREFOX_VERSION)
    firefox_ver_string = subprocess.check_output("firefox --version", shell=True).strip()
    firefox_version_regex = re.compile(r"Mozilla Firefox (\d+.\d+)")
    try:
        firefox_ver = float(firefox_version_regex.search(firefox_ver_string).group(1))
    except AttributeError:
        firefox_ver = 0.0
    debian_location = 'https://s3.amazonaws.com/vagrant.testeng.edx.org/'
    debian_package = 'firefox-mozilla-build_42.0-0ubuntu1_amd64.deb'
    debian_path = '{location}{package}'.format(location=debian_location, package=debian_package)

    if firefox_ver < MINIMUM_FIREFOX_VERSION:
        raise Exception(
            'Required firefox version not found.\n'
            'Expected: {expected_version}; Actual: {actual_version}.\n\n'
            'As the vagrant user in devstack, run the following:\n\n'
            '\t$ sudo wget -O /tmp/firefox_42.deb {debian_path}\n'
            '\t$ sudo apt-get remove firefox\n\n'
            '\t$ sudo gdebi -nq /tmp/firefox_42.deb\n\n'
            'Confirm the new version:\n'
            '\t$ firefox --version\n'
            '\t{expected_version}'.format(
                actual_version=firefox_ver,
                expected_version=expected_firefox_ver,
                debian_path=debian_path
            )
        )
Esempio n. 4
0
File: utils.py Progetto: saadow123/1
def check_firefox_version():
    """
    Check that firefox is the correct version.
    """
    if 'BOK_CHOY_HOSTNAME' in os.environ:
        # Firefox is running in a separate Docker container; get its version via Selenium
        driver = browser()
        capabilities = driver.capabilities
        if capabilities['browserName'].lower() == 'firefox':
            firefox_version_regex = re.compile(r'^\d+\.\d+')
            version_key = 'browserVersion' if 'browserVersion' in capabilities else 'version'
            try:
                firefox_ver = float(firefox_version_regex.search(capabilities[version_key]).group(0))
            except AttributeError:
                firefox_ver = 0.0
        else:
            firefox_ver = 0.0
        driver.close()
        if firefox_ver < MINIMUM_FIREFOX_VERSION:
            raise Exception(
                u'Required firefox version not found.\n'
                u'Expected: {expected_version}; Actual: {actual_version}.\n\n'
                u'Make sure that the edx.devstack.firefox container is up-to-date and running\n'
                u'\t{expected_version}'.format(
                    actual_version=firefox_ver,
                    expected_version=MINIMUM_FIREFOX_VERSION
                )
            )
        return

    # Firefox will be run as a local process
    expected_firefox_ver = "Mozilla Firefox " + str(MINIMUM_FIREFOX_VERSION)
    firefox_ver_string = subprocess.check_output("firefox --version", shell=True).strip()
    if isinstance(firefox_ver_string, six.binary_type):
        firefox_ver_string = firefox_ver_string.decode('utf-8')
    firefox_version_regex = re.compile(r"Mozilla Firefox (\d+.\d+)")
    try:
        firefox_ver = float(firefox_version_regex.search(firefox_ver_string).group(1))
    except AttributeError:
        firefox_ver = 0.0

    if firefox_ver < MINIMUM_FIREFOX_VERSION:
        raise Exception(
            u'Required firefox version not found.\n'
            u'Expected: {expected_version}; Actual: {actual_version}.'.format(
                actual_version=firefox_ver,
                expected_version=expected_firefox_ver
            )
        )
Esempio n. 5
0
    def setUpClass(cls):
        if os.environ.get('DISABLE_ACCEPTANCE_TESTS') == 'True':
            raise SkipTest

        cls.selenium = browser()
        super(OrderViewBrowserTestBase, cls).setUpClass()