<commit_before>import os
import time
import re

import unittest

from selenium                          import webdriver
from selenium.webdriver                import ActionChains
from selenium.webdriver.common.by      import By
from selenium.webdriver.common.keys    import Keys
from selenium.common.exceptions        import NoSuchElementException
from selenium.webdriver.support.ui     import Select
from selenium.webdriver.support.wait   import WebDriverWait
from selenium.webdriver.support        import expected_conditions as EC

import track_selectors


class JBrowseTest (object):

    data_dir = None
    base_url = None

    # this "time dilation" factor hugely increases all our fixed waiting times when
    # running under Travis CI, because the Travis environment is much slower than a desktop.
    time_dilation = 5 if os.getenv('CI','false') == 'true' else 1

    tracksel_type = 'Hierarchical'

    ## TestCase override - use instead of constructor
    def setUp( self ):

        self.track_selector = getattr( track_selectors, '%sTrackSelector' % self.tracksel_type )( self, self.time_dilation )

        #self.browser = self._getChrome()
        self.browser = self._getBrowser()
        if self.base_url and self.data_dir: self.browser.get(self.base_url+self.data_dir)
        else: 
            base = self.baseURL()
            self.browser.get(
                base + ( '&' if base.find('?') >= 0 else '?' )
                + ( "data="+self.data_dir if self.data_dir else "" )
            )
        self.addCleanup(self.browser.quit)
        self._waits_for_load()

    def _getBrowser( self ):<commit_msg>bump up the time dilation for selenium tests running under travis, still getting failures once in a while<commit_after>import os
import time
import re

import unittest

from selenium                          import webdriver
from selenium.webdriver                import ActionChains
from selenium.webdriver.common.by      import By
from selenium.webdriver.common.keys    import Keys
from selenium.common.exceptions        import NoSuchElementException
from selenium.webdriver.support.ui     import Select
from selenium.webdriver.support.wait   import WebDriverWait
from selenium.webdriver.support        import expected_conditions as EC

import track_selectors


class JBrowseTest (object):

    data_dir = None
    base_url = None

    # this "time dilation" factor hugely increases all our fixed waiting times when
    # running under Travis CI, because the Travis environment is much slower than a desktop.
    time_dilation = 8 if os.getenv('CI','false') == 'true' else 1

    tracksel_type = 'Hierarchical'

    ## TestCase override - use instead of constructor
    def setUp( self ):

        self.track_selector = getattr( track_selectors, '%sTrackSelector' % self.tracksel_type )( self, self.time_dilation )

        #self.browser = self._getChrome()
        self.browser = self._getBrowser()
        if self.base_url and self.data_dir: self.browser.get(self.base_url+self.data_dir)
        else: 
            base = self.baseURL()
            self.browser.get(
                base + ( '&' if base.find('?') >= 0 else '?' )
                + ( "data="+self.data_dir if self.data_dir else "" )
            )
        self.addCleanup(self.browser.quit)
        self._waits_for_load()

    def _getBrowser( self ):
{'fraction_non_alphanumeric': 0.08154121863799284, 'fraction_numerical': 0.0017921146953405018, 'mean_word_length': 2.721111111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6884053', 'n_tokens_mistral': 988, 'n_tokens_neox': 910, 'n_words': 275}