diff options
-rwxr-xr-x | bin/test-website | 23 | ||||
-rw-r--r-- | test/lib/mapping.rb | 51 | ||||
-rw-r--r-- | test/lib/navigation.rb | 12 |
3 files changed, 71 insertions, 15 deletions
diff --git a/bin/test-website b/bin/test-website index 2e91f364..18994cc5 100755 --- a/bin/test-website +++ b/bin/test-website @@ -2,8 +2,8 @@ USAGE = <<EOT -This is Mechanical-Rob - an automated web server tester for - Genenetwork.org that uses the brilliant +This is Mechanical-Rob - an automated web server tester for + Genenetwork.org that uses the brilliant mechanize gem. To use this software you need to install mechanize. Run it from @@ -16,7 +16,7 @@ If you are using the small deployment database you can use ./bin/test-website --skip -n For more information see http://genenetwork.org/ - + EOT $stderr.print USAGE @@ -25,7 +25,7 @@ require 'optparse' options = { database: :small, link_checker: false} opts = OptionParser.new do |o| o.banner = "Usage: #{File.basename($0)} [options] URL" - + o.on('-d','--database', String, 'Use database (default db_webqtl_s)') do |s| options[:database] = case s @@ -39,11 +39,15 @@ opts = OptionParser.new do |o| o.on('-l','--link-checker', 'Check for dead links') do options[:link_checker] = true end - - o.on('-n','--navigation-test', 'Check for navigation test results') do + + o.on('--navigation-test', 'Check for navigation') do options[:navigation_test] = true end + o.on('--mapping-test', 'Check for mapping') do + options[:mapping_test] = true + end + o.on('--skip-broken', 'Skip tests that are known to be broken') do options[:skip_broken] = true end @@ -62,7 +66,7 @@ if options[:show_help] end $options = options # we are using a global here -$host = +$host = if ARGV.size>0 ARGV.shift else @@ -85,8 +89,11 @@ if options[:link_checker] else require 'main_web_functionality' end - + if options[:navigation_test] require 'navigation' end +if options[:mapping_test] + require 'mapping' +end diff --git a/test/lib/mapping.rb b/test/lib/mapping.rb new file mode 100644 index 00000000..08b6b5da --- /dev/null +++ b/test/lib/mapping.rb @@ -0,0 +1,51 @@ +# In these tests we navigate from the main page to a specific trait then hit the different mapping tool buttons (In this case pylMM and r/qtl) followed by computing the results (marker regressions). + + +class MappingTest +end + +describe MappingTest do + before do + @agent = Mechanize.new + @agent.agent.http.ca_file = '/etc/ssl/certs/ca-certificates.crt' + end + + describe MappingTest do + it "pyLMM mapping tool selection" do + url = $host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P' + page = @agent.get(url) + # get the form + # form = @agent.page.form_with(:name => "my-form") + # get the button you want from the form + # page.forms.each do |form| + # p form + # end + # button = page.button_with(:value => "pylmm_compute") + # submit the form using that button + # agent.submit(form, button) + # link = page.link_with(text: 'pyLMM') + # page = link.click + # puts page.uri + # link = page.link_with(text: 'Compute') + # page = link.click + # puts page.uri + # probe_link.uri.to_s.must_equal "/marker_regression" + end + end + +end + +describe MappingTest do + it "R/qtl mapping tool selection" do + break if $options[:skip_broken] + page = @agent.get($host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P') + link = page.link_with(text: 'R/qtl') + page = link.click + puts page.uri + form.field_with(:name => 'Methods').options[2].select + link = page.link_with(text: 'Compute') + page = link.click + puts page.uri + probe_link.uri.to_s.must_equal "/marker_regression" + end +end diff --git a/test/lib/navigation.rb b/test/lib/navigation.rb index 676ee90c..ee9f41d2 100644 --- a/test/lib/navigation.rb +++ b/test/lib/navigation.rb @@ -1,16 +1,16 @@ # In these tests we navigate from the main page to a specific trait then hit the different mapping tool buttons (In this case pylMM and r/qtl) followed by computing the results (marker regressions). -class NavigationTest +class MappingTest end -describe NavigationTest do +describe MappingTest do before do @agent = Mechanize.new @agent.agent.http.ca_file = '/etc/ssl/certs/ca-certificates.crt' end - describe NavigationTest do + describe MappingTest do it "pyLMM mapping tool selection" do break if $options[:skip_broken] page = @agent.get($host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P') @@ -27,7 +27,7 @@ describe NavigationTest do end -describe NavigationTest do +describe MappingTest do it "R/qtl mapping tool selection" do break if $options[:skip_broken] page = @agent.get($host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P') @@ -38,8 +38,6 @@ describe NavigationTest do link = page.link_with(text: 'Compute') page = link.click puts page.uri - probe_link.uri.to_s.must_equal "/marker_regression" + probe_link.uri.to_s.must_equal "/marker_regression" end end - - |