<commit_before># To run this test you'll need to download phantomjs. See:
# https://gist.github.com/telbiyski/ec56a92d7114b8631c906c18064ce620

from django.test import LiveServerTestCase

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException

from work.tests import objects_for_work_tests

class MembershipRequestTestCase(LiveServerTestCase):

    # It helps selenium to wait for loading new pages.
    def wait_loading(self, driver, xpath_string):
        try:
            WebDriverWait(driver, 20).until(lambda driver: driver.find_element_by_xpath(xpath_string))
        except TimeoutException as ex:
            print("Exception has been thrown. " + str(ex))
            self.tearDownClass()

    # It helps selenium to wait for js/css changes of element visibility.
    def wait_js(self, driver, xpath_string):
        try:
            WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, xpath_string)))
        except TimeoutException as ex:
            print("Exception has been thrown. " + str(ex))
            self.tearDownClass()

    @classmethod
    def setUpClass(cls):
        super(MembershipRequestTestCase, cls).setUpClass()
        cls.selenium = webdriver.PhantomJS()

    @classmethod
    def tearDownClass(cls):
        cls.selenium.quit()
        super(MembershipRequestTestCase, cls).tearDownClass()

    # This is the membership request test.
    def test_membership_request(self):
        objects_for_work_tests.initial_test_data()
        s = self.selenium
        s.maximize_window()

        # Anonymous user fills the membership request form.
        s.get('%s%s' % (self.live_server_url, "/freedom-coop"))
        self.wait_loading(s, '//title[contains(text(), "Freedom Coop")]')
        s.find_element_by_link_text("Join FreedomCoop").click()
        self.wait_loading(s, '//title[contains(text(), "Request Membership at FreedomCoop")]')
        s.find_element_by_id("id_name").send_keys("test_name01")
        s.find_element_by_id("id_requested_username").send_keys("test_user01")
        s.find_element_by_id("id_email_address").send_keys("<EMAIL>_name<EMAIL>")
        s.find_element_by_id("id_description").send_keys("This is a test user.")
        s.find_element_by_xpath('//input[@value="Submit"]').click()
        self.wait_loading(s, '//title[contains(text(), "Thank you for your membership request")]')

        # Admin login.
        s.get('%s%s' % (self.live_server_url, "/freedom-coop"))
        self.wait_loading(s, '//title[contains(text(), "Freedom Coop")]')
        s.find_element_by_id("id_username").send_keys("admin_user")
        s.find_element_by_id("id_password").send_keys("<PASSWORD>")
        s.find_element_by_xpath('//button[@type="submit"]').click()
        self.wait_loading(s, '//title[contains(text(), "| My Dashboard")]')

        # Admin takes the simple task (accounting/work -> Mine!)
        self.wait_js(s, '//a[contains(text(), "admin_agent")]')
        s.find_element_by_partial_link_text("admin_agent").click()
        self.wait_js(s, '//a[contains(text(), "Coop Admin App")]')
        s.find_element_by_partial_link_text('Coop Admin App').click()
        self.wait_loading(s, '//title[contains(text(), "| My Work")]')
        s.find_element_by_partial_link_text("All Work").click()
        self.wait_loading(s, '//title[contains(text(), "| Work")]')<commit_msg>fix travis test for freedomcoop membership 2<commit_after># To run this test you'll need to download phantomjs. See:
# https://gist.github.com/telbiyski/ec56a92d7114b8631c906c18064ce620

from django.test import LiveServerTestCase

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException

from work.tests import objects_for_work_tests

class MembershipRequestTestCase(LiveServerTestCase):

    # It helps selenium to wait for loading new pages.
    def wait_loading(self, driver, xpath_string):
        try:
            WebDriverWait(driver, 20).until(lambda driver: driver.find_element_by_xpath(xpath_string))
        except TimeoutException as ex:
            print("Exception has been thrown. " + str(ex))
            self.tearDownClass()

    # It helps selenium to wait for js/css changes of element visibility.
    def wait_js(self, driver, xpath_string):
        try:
            WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, xpath_string)))
        except TimeoutException as ex:
            print("Exception has been thrown. " + str(ex))
            self.tearDownClass()

    @classmethod
    def setUpClass(cls):
        super(MembershipRequestTestCase, cls).setUpClass()
        cls.selenium = webdriver.PhantomJS()

    @classmethod
    def tearDownClass(cls):
        cls.selenium.quit()
        super(MembershipRequestTestCase, cls).tearDownClass()

    # This is the membership request test.
    def test_membership_request(self):
        objects_for_work_tests.initial_test_data()
        s = self.selenium
        s.maximize_window()

        # Anonymous user fills the membership request form.
        s.get('%s%s' % (self.live_server_url, "/freedom-coop"))
        self.wait_loading(s, '//title[contains(text(), "Freedom Coop")]')
        s.find_element_by_link_text("Join Freedom Coop").click()
        self.wait_loading(s, '//title[contains(text(), "Request Membership at FreedomCoop")]')
        s.find_element_by_id("id_name").send_keys("test_name01")
        s.find_element_by_id("id_requested_username").send_keys("test_user01")
        s.find_element_by_id("id_email_address").send_keys("<EMAIL>")
        s.find_element_by_id("id_description").send_keys("This is a test user.")
        s.find_element_by_xpath('//input[@value="Submit"]').click()
        self.wait_loading(s, '//title[contains(text(), "Thank you for your membership request")]')

        # Admin login.
        s.get('%s%s' % (self.live_server_url, "/freedom-coop"))
        self.wait_loading(s, '//title[contains(text(), "Freedom Coop")]')
        s.find_element_by_id("id_username").send_keys("admin_user")
        s.find_element_by_id("id_password").send_keys("<PASSWORD>")
        s.find_element_by_xpath('//button[@type="submit"]').click()
        self.wait_loading(s, '//title[contains(text(), "| My Dashboard")]')

        # Admin takes the simple task (accounting/work -> Mine!)
        self.wait_js(s, '//a[contains(text(), "admin_agent")]')
        s.find_element_by_partial_link_text("admin_agent").click()
        self.wait_js(s, '//a[contains(text(), "Coop Admin App")]')
        s.find_element_by_partial_link_text('Coop Admin App').click()
        self.wait_loading(s, '//title[contains(text(), "| My Work")]')
        s.find_element_by_partial_link_text("All Work").click()
        self.wait_loading(s, '//title[contains(text(), "| Work")]')
{'fraction_non_alphanumeric': 0.13043478260869565, 'fraction_numerical': 0.008835904628330995, 'mean_word_length': 3.6914473684210525, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2962298', 'n_tokens_mistral': 2299, 'n_tokens_neox': 2197, 'n_words': 424}