<commit_before>require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/gradebook2_common')


describe 'Canvadoc' do
  include_context "in-process server selenium tests"
  include Gradebook2Common

  before :once do
    PluginSetting.create! :name => 'canvadocs',
      :settings => {"api_key" => "blahblahblahblahblah",
                    "base_url" => "http://example.com",
                    "annotations_supported" => "1"}
  end

  def turn_on_plugin_settings
    get '/plugins/canvadocs'
    # whee different UI for plugins
    if element_exists?('#accounts_select')
      f("#accounts_select option:nth-child(2)").click
      f("#plugin_setting_disabled").click
      wait_for_ajaximations
    end
    if !f(".save_button").enabled?
      f(".copy_settings_button").click
    end<commit_msg>even moar plugins UI prep<commit_after>require File.expand_path(File.dirname(__FILE__) + '/common')
require File.expand_path(File.dirname(__FILE__) + '/helpers/gradebook2_common')


describe 'Canvadoc' do
  include_context "in-process server selenium tests"
  include Gradebook2Common

  before :once do
    PluginSetting.create! :name => 'canvadocs',
      :settings => {"api_key" => "blahblahblahblahblah",
                    "base_url" => "http://example.com",
                    "annotations_supported" => "1"}
  end

  def turn_on_plugin_settings
    get '/plugins/canvadocs'
    # whee different UI for plugins
    if element_exists?('#accounts_select')
      f("#accounts_select option:nth-child(2)").click
      if !f(".save_button").enabled?
        f(".copy_settings_button").click
      end
      if f("#plugin_setting_disabled")[:checked]
        f("#plugin_setting_disabled").click
      end
      wait_for_ajaximations
    end
{'fraction_non_alphanumeric': 0.12409972299168975, 'fraction_numerical': 0.00443213296398892, 'mean_word_length': 3.426470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5754149', 'n_tokens_mistral': 573, 'n_tokens_neox': 550, 'n_words': 106}