<commit_before>#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import logging
import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from steps.common import *


def before_all(context):
    #context.browser = webdriver.Firefox()
    #context.browser = webdriver.Chrome()
    context.browser = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=yes'])
    context.browser.set_window_size(1280, 1024)
    context.browser.implicitly_wait(5)
    context.browser.set_page_load_timeout(60)  # wait for data
    logging.disable('INFO')

    context.browser.get('https://staging.pixelated-project.org/signup')
    wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, 'input#srp_username'))
    fill_by_css_selector(context, 'input#srp_username', 'behave-testuser')
    fill_by_css_selector(context, 'input#srp_password','<PASSWORD>')
    fill_by_css_selector(context, 'input#srp_password_confirmation','<PASSWORD>')
    context.browser.find_element_by_name("button").click()

    context.browser.quit()

def before_feature(context, feature):
    # context.browser = webdriver.Firefox()
    #context.browser = webdriver.Chrome()
    context.browser = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=yes'])
    context.browser.set_window_size(1280, 1024)
    context.browser.implicitly_wait(10)
    context.browser.set_page_load_timeout(60)  # wait for data

def after_feature(context, feature):
    context.browser.quit()


def after_step(context, step):
    save_debug_files(context, step)<commit_msg>take screenshot when before_all() fails<commit_after>#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import logging
import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from steps.common import *


def before_all(context):
    #context.browser = webdriver.Firefox()
    #context.browser = webdriver.Chrome()
    context.browser = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=yes'])
    context.browser.set_window_size(1280, 1024)
    context.browser.implicitly_wait(5)
    context.browser.set_page_load_timeout(60)  # wait for data
    logging.disable('INFO')

    try:
        context.browser.get('https://staging.pixelated-project.org/signup')
        wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, 'input#srp_username'))
        fill_by_css_selector(context, 'input#srp_username', 'behave-testuser')
        fill_by_css_selector(context, 'input#srp_password','<PASSWORD>')
        fill_by_css_selector(context, 'input#srp_password_confirmation','<PASSWORD>')
        context.browser.find_element_by_name("button").click()

    except Exception, e:
        take_screenshot(context, 'before_all.png')

    context.browser.quit()

def before_feature(context, feature):
    # context.browser = webdriver.Firefox()
    #context.browser = webdriver.Chrome()
    context.browser = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=yes'])
    context.browser.set_window_size(1280, 1024)
    context.browser.implicitly_wait(10)
    context.browser.set_page_load_timeout(60)  # wait for data

def after_feature(context, feature):
    context.browser.quit()


def after_step(context, step):
    save_debug_files(context, step)
{'fraction_non_alphanumeric': 0.10278514588859416, 'fraction_numerical': 0.01237842617152962, 'mean_word_length': 4.793854033290653, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '4257210', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1340, 'n_words': 357}