From ebf1db54525a6f344725717f83dfeb1f7b1ada18 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 26 Apr 2016 16:23:38 +0000 Subject: Test: main page and first search --- test/lib/main_web_functionality.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/lib/main_web_functionality.rb (limited to 'test/lib') diff --git a/test/lib/main_web_functionality.rb b/test/lib/main_web_functionality.rb new file mode 100644 index 00000000..03c76d42 --- /dev/null +++ b/test/lib/main_web_functionality.rb @@ -0,0 +1,32 @@ +class MainWebFunctionality +end + +describe MainWebFunctionality do + before do + @agent = Mechanize.new + page = @agent.get($host) + # p page + @form = page.forms[1] + + end + + describe MainWebFunctionality do + it "The main page contains a search button" do + @form.buttons[0].value.must_equal "Search" + end + + # http://localhost:5003/search?species=mouse&group=BXD&type=Hippocampus+mRNA&dataset=HC_M2_0606_P&search_terms_or=&search_terms_and=MEAN%3D%2815+16%29+LRS%3D%2823+46%29&FormID=searchResult + it "Search for MEAN=(15 16) LRS=(23 46)" do + @form.fields[2].value = "MEAN=(15 16) LRS=(23 46)" + @form.fields[3].value = "mouse" + @form.fields[4].value = "BXD" + @form.fields[5].value = "Hippocampus mRNA" + @form.fields[6].value = "HC_M2_0606_P" + @searchpage = @agent.submit(@form, @form.buttons.first) + probe_link = @searchpage.links.find { |l| l.text =~ /1435395_s_at/ } + probe_link.uri.to_s.must_equal "/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P" + end + end + +end + -- cgit v1.2.3 From c9c0b876318ae0c192a2895c59baeb394a77295e Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 27 Apr 2016 09:40:24 +0000 Subject: Test: get to trait page --- bin/test-website | 3 +++ test/lib/main_web_functionality.rb | 36 +++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'test/lib') diff --git a/bin/test-website b/bin/test-website index b766edd8..8efa37b1 100755 --- a/bin/test-website +++ b/bin/test-website @@ -32,6 +32,9 @@ $stderr.print "Testing <",$host,">\n" require 'mechanize' require 'minitest/spec' require 'minitest/autorun' + +# These are the actual testing modules + require 'main_web_functionality' diff --git a/test/lib/main_web_functionality.rb b/test/lib/main_web_functionality.rb index 03c76d42..4103d653 100644 --- a/test/lib/main_web_functionality.rb +++ b/test/lib/main_web_functionality.rb @@ -1,30 +1,32 @@ +# In these tests we navigate from the main page to search + class MainWebFunctionality end describe MainWebFunctionality do before do @agent = Mechanize.new - page = @agent.get($host) - # p page - @form = page.forms[1] - end describe MainWebFunctionality do - it "The main page contains a search button" do - @form.buttons[0].value.must_equal "Search" - end - - # http://localhost:5003/search?species=mouse&group=BXD&type=Hippocampus+mRNA&dataset=HC_M2_0606_P&search_terms_or=&search_terms_and=MEAN%3D%2815+16%29+LRS%3D%2823+46%29&FormID=searchResult - it "Search for MEAN=(15 16) LRS=(23 46)" do - @form.fields[2].value = "MEAN=(15 16) LRS=(23 46)" - @form.fields[3].value = "mouse" - @form.fields[4].value = "BXD" - @form.fields[5].value = "Hippocampus mRNA" - @form.fields[6].value = "HC_M2_0606_P" - @searchpage = @agent.submit(@form, @form.buttons.first) - probe_link = @searchpage.links.find { |l| l.text =~ /1435395_s_at/ } + it "Get to trait page" do + page = @agent.get($host) + form = page.forms[1] + form.buttons[0].value.must_equal "Search" + # http://localhost:5003/search?species=mouse&group=BXD&type=Hippocampus+mRNA&dataset=HC_M2_0606_P&search_terms_or=&search_terms_and=MEAN%3D%2815+16%29+LRS%3D%2823+46%29&FormID=searchResult + form.fields[2].value = "MEAN=(15 16) LRS=(23 46)" + form.fields[3].value = "mouse" + form.fields[4].value = "BXD" + form.fields[5].value = "Hippocampus mRNA" + form.fields[6].value = "HC_M2_0606_P" + search_page = @agent.submit(form, form.buttons.first) + probe_link = search_page.links.find { |l| l.text =~ /1435395_s_at/ } probe_link.uri.to_s.must_equal "/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P" + show_trait_page = probe_link.click + # Get to trait page for 1435395_s_at + form2 = show_trait_page.forms_with("trait_page")[0] + form2.fields[30].name.must_equal "value:DBA/2J" + form2.fields[30].value.must_equal "15.287" end end -- cgit v1.2.3 From 4172e8940d2656f9f2a4de6e72e6d114c317d1c0 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 27 Apr 2016 11:25:53 +0000 Subject: test: test for broken links --- test/lib/main_web_functionality.rb | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'test/lib') diff --git a/test/lib/main_web_functionality.rb b/test/lib/main_web_functionality.rb index 4103d653..d0a32835 100644 --- a/test/lib/main_web_functionality.rb +++ b/test/lib/main_web_functionality.rb @@ -6,13 +6,15 @@ end describe MainWebFunctionality do before do @agent = Mechanize.new + @agent.agent.http.ca_file = '/etc/ssl/certs/ca-certificates.crt' end describe MainWebFunctionality do it "Get to trait page" do page = @agent.get($host) form = page.forms[1] - form.buttons[0].value.must_equal "Search" + form.buttons[0].value.must_equal "Search" + # http://localhost:5003/search?species=mouse&group=BXD&type=Hippocampus+mRNA&dataset=HC_M2_0606_P&search_terms_or=&search_terms_and=MEAN%3D%2815+16%29+LRS%3D%2823+46%29&FormID=searchResult form.fields[2].value = "MEAN=(15 16) LRS=(23 46)" form.fields[3].value = "mouse" @@ -23,12 +25,25 @@ describe MainWebFunctionality do probe_link = search_page.links.find { |l| l.text =~ /1435395_s_at/ } probe_link.uri.to_s.must_equal "/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P" show_trait_page = probe_link.click + p show_trait_page + # Get to trait page for 1435395_s_at form2 = show_trait_page.forms_with("trait_page")[0] - form2.fields[30].name.must_equal "value:DBA/2J" - form2.fields[30].value.must_equal "15.287" + form2.fields[30].name.must_equal "variance:C57BL/6J" + # form2.fields[30].value.must_equal "15.287" + + # Test every link on the page to check if it's broken or not + show_trait_page.links.each do |link| + puts link.href + if link.href !~ /static\/dbdoc\/Hippocampus/ and link.href !~ /glossary.html|sample_r|grits.eecs.utk.edu|correlationAnnotation.html/ + # Fetch link, program will crash with exception if link is broken + linkpage = @agent.get(link.href) + puts "Link to #{link.href} is valid, response code #{linkpage.code}" + end + end + end + end - -end +end -- cgit v1.2.3 From c2adf6b49626355576d3ea454d891307c8221f85 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 28 Apr 2016 08:55:57 +0000 Subject: Test: splitting out static URL tests --- test/lib/link_checker.rb | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/lib/link_checker.rb (limited to 'test/lib') diff --git a/test/lib/link_checker.rb b/test/lib/link_checker.rb new file mode 100644 index 00000000..fb201887 --- /dev/null +++ b/test/lib/link_checker.rb @@ -0,0 +1,48 @@ + +class LinkChecker +end + +describe LinkChecker do + before do + @agent = Mechanize.new + @agent.agent.http.ca_file = '/etc/ssl/certs/ca-certificates.crt' + end + + it "Get to front page" do + page = @agent.get($host) + page.links.each do |link| + puts link.href + if link.href !~ /static\/dbdoc\/Hippocampus/ and link.href !~ /glossary.html|sample_r|grits.eecs.utk.edu|correlationAnnotation.html/ + # Fetch link, program will crash with exception if link is broken + linkpage = @agent.get(link.href) + puts "Link to #{link.href} is valid, response code #{linkpage.code}" + end + end + + end + + describe LinkChecker do + it "Get to trait page" do + page = @agent.get($host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P') + p page + + # Get to trait page for 1435395_s_at + # form2 = show_trait_page.forms_with("trait_page")[0] + # form2.fields[30].name.must_equal "variance:C57BL/6J" + # form2.fields[30].value.must_equal "15.287" + + # Test every link on the page to check if it's broken or not + page.links.each do |link| + puts link.href + if link.href !~ /static\/dbdoc\/Hippocampus/ and link.href !~ /glossary.html|sample_r|grits.eecs.utk.edu|correlationAnnotation.html/ + # Fetch link, program will crash with exception if link is broken + linkpage = @agent.get(link.href) + puts "Link to #{link.href} is valid, response code #{linkpage.code}" + end + end + + end + + end + +end -- cgit v1.2.3 From ebf71cc49b70c87096e82b6847b3229b9a224641 Mon Sep 17 00:00:00 2001 From: Dennis E. Mungai Date: Wed, 18 May 2016 02:33:01 +0300 Subject: Notes: We need to test some fields in the results page Not yet implemented. WIP. Expected: Run all ~250 fields.--- test/lib/NavigationTest.rb | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/lib/NavigationTest.rb (limited to 'test/lib') diff --git a/test/lib/NavigationTest.rb b/test/lib/NavigationTest.rb new file mode 100644 index 00000000..26080d28 --- /dev/null +++ b/test/lib/NavigationTest.rb @@ -0,0 +1,46 @@ +# 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 +end + +describe NavigationTest do + before do + @agent = Mechanize.new + @agent.agent.http.ca_file = '/etc/ssl/certs/ca-certificates.crt' + end + + describe NavigationTest do + it "pyLMM mapping tool selection" do + page = @agent.get($host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P') +#Navigates to http://localhost:5003/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P and clicks respective buttons. + 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 NavigationTest do + it "R/qtl mapping tool selection" do + 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 + + -- cgit v1.2.3