spec/capybara_spec.rb in sequenceserver-2.0.0.beta3 vs spec/capybara_spec.rb in sequenceserver-2.0.0.beta4
- old
+ new
@@ -12,55 +12,54 @@
it 'properly controls interaction with database listing' do
visit '/'
fill_in('sequence', with: nucleotide_query)
check(nucleotide_databases.first)
page.evaluate_script("$('.protein .database').first().hasClass('disabled')")
- .should eq(true)
+ .should eq(true)
end
it 'shows a dropdown menu when other blast methods are available' do
visit '/'
fill_in('sequence', with: nucleotide_query)
check(nucleotide_databases.first)
- page.save_screenshot('screenshot.png')
page.has_css?('button.dropdown-toggle').should eq(true)
end
it 'can run a simple blastn search' do
perform_search query: nucleotide_query,
- databases: nucleotide_databases
+ databases: nucleotide_databases
page.should have_content('BLASTN')
end
it 'can run a simple blastp search' do
perform_search query: protein_query,
- databases: protein_databases
+ databases: protein_databases
page.should have_content('BLASTP')
end
it 'can run a simple blastx search' do
perform_search query: nucleotide_query,
- databases: protein_databases
+ databases: protein_databases
page.should have_content('BLASTX')
end
it 'can run a simple tblastx search' do
perform_search query: nucleotide_query,
- databases: nucleotide_databases,
- method: 'tblastx'
+ databases: nucleotide_databases,
+ method: 'tblastx'
page.should have_content('TBLASTX')
end
it 'can run a simple tblastn search' do
perform_search query: protein_query,
- databases: nucleotide_databases
+ databases: nucleotide_databases
page.should have_content('TBLASTN')
end
### Test aspects of the generated report.
- it "can download FASTA of each hit" do
+ it 'can download FASTA of each hit' do
# Do a BLASTP search. protein_query refers to the first two sequence in
# protein_databases[0], so the top hits are the query sequences themselves.
perform_search(query: protein_query,
databases: protein_databases.values_at(0))
@@ -68,17 +67,17 @@
# download to finish.
page.execute_script("$('.download-fa:eq(0)').click()")
wait_for_download
# Test name and content of the downloaded file.
- expect(File.basename(downloaded_file)).
- to eq('sequenceserver-SI2.2.0_06267.fa')
- expect(File.read(downloaded_file)).
- to eq(File.read("#{__dir__}/sequences/sequenceserver-SI2.2.0_06267.fa"))
+ expect(File.basename(downloaded_file))
+ .to eq('sequenceserver-SI2.2.0_06267.fa')
+ expect(File.read(downloaded_file))
+ .to eq(File.read("#{__dir__}/sequences/sequenceserver-SI2.2.0_06267.fa"))
end
- it "can download FASTA of selected hits" do
+ it 'can download FASTA of selected hits' do
# Do a BLASTP search. protein_query refers to the first two sequence in
# protein_databases[0], so the top hits are the query sequences themselves.
perform_search(query: protein_query,
databases: protein_databases.values_at(0))
@@ -87,28 +86,28 @@
page.check('Query_2_hit_1_checkbox')
page.click_link('FASTA of 2 selected hit(s)')
wait_for_download
expect(File.basename(downloaded_file)).to eq('sequenceserver-2_hits.fa')
- expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/sequenceserver-2_hits.fa"))
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/sequenceserver-2_hits.fa'))
end
- it "can download FASTA of all hits" do
+ it 'can download FASTA of all hits' do
# Do a BLASTP search. protein_query refers to the first two sequence in
# protein_databases[0], so the top hits are the query sequences themselves.
perform_search(query: protein_query,
databases: protein_databases.values_at(0))
# Click 'FASTA of all hits'.
page.click_link('FASTA of all hits')
wait_for_download
expect(File.basename(downloaded_file)).to eq('sequenceserver-2_hits.fa')
- expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/sequenceserver-2_hits.fa"))
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/sequenceserver-2_hits.fa'))
end
- it "can download alignment for each hit" do
+ it 'can download alignment for each hit' do
# Do a BLASTP search. protein_query refers to the first two sequence in
# protein_databases[0], so the top hits are the query sequences themselves.
perform_search(query: protein_query,
databases: protein_databases.values_at(0))
@@ -117,15 +116,15 @@
page.execute_script("$('.download-aln:eq(0)').click()")
wait_for_download
# Test name and content of the downloaded file.
expect(File.basename(downloaded_file)).to eq('Query_1_SI2_2_0_06267.txt')
- expect(File.read(downloaded_file)).
- to eq(File.read("#{__dir__}/sequences/Query_1_SI2_2_0_06267.txt"))
+ expect(File.read(downloaded_file))
+ .to eq(File.read("#{__dir__}/sequences/Query_1_SI2_2_0_06267.txt"))
end
- it "can download Alignment of selected hits" do
+ it 'can download Alignment of selected hits' do
# Do a BLASTP search. protein_query refers to the first two sequence in
# protein_databases[0], so the top hits are the query sequences themselves.
perform_search(query: protein_query,
databases: protein_databases.values_at(0))
@@ -134,25 +133,25 @@
page.check('Query_2_hit_1_checkbox')
page.click_link('Alignment of 2 selected hit(s)')
wait_for_download
expect(File.basename(downloaded_file)).to eq('alignment-2_hits.txt')
- expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-2_hits.txt"))
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/alignment-2_hits.txt'))
end
- it "can download Alignment of all hits" do
+ it 'can download Alignment of all hits' do
# Do a BLASTP search. protein_query refers to the first two sequence in
# protein_databases[0], so the top hits are the query sequences themselves.
perform_search(query: protein_query,
databases: protein_databases.values_at(0))
# Click 'Alignment of all hits'.
page.click_link('Alignment of all hits')
wait_for_download
expect(File.basename(downloaded_file)).to eq('alignment-2_hits.txt')
- expect(File.read(downloaded_file)).to eq(File.read("spec/sequences/alignment-2_hits.txt"))
+ expect(File.read(downloaded_file)).to eq(File.read('spec/sequences/alignment-2_hits.txt'))
end
it 'can download BLAST results in XML and tabular formats' do
# Do a BLASTP search. protein_query refers to the first two sequence in
# protein_databases[0], so the top hits are the query sequences themselves.
@@ -230,11 +229,11 @@
# protein_databases[0], so the top hits are the query sequences themselves.
perform_search(query: protein_query,
databases: protein_databases.values_at(0))
## Check that there is a circos vis and unfold it.
- page.should have_content('Circos')
+ page.should have_content('Chord diagram: queries and their top hits')
page.execute_script("$('.circos > .grapher-header > h5').click()")
sleep 1
page.execute_script("$('.export-to-svg:eq(0)').click()")
wait_for_download
@@ -244,11 +243,10 @@
page.execute_script("$('.export-to-png:eq(0)').click()")
wait_for_download
expect(File.basename(downloaded_file)).to eq('Circos-visualisation.png')
clear_downloads
-
## Check that there is a graphical overview of hits.
page.should have_content('Graphical overview of hits')
page.execute_script("$('.export-to-svg:eq(1)').click()")
wait_for_download
@@ -258,11 +256,10 @@
page.execute_script("$('.export-to-png:eq(1)').click()")
wait_for_download
expect(File.basename(downloaded_file)).to eq('Alignment-Overview-Query_1.png')
clear_downloads
-
## Check that there is a length distribution of hits.
page.should have_content('Length distribution of hits')
page.execute_script("$('.length-distribution > .grapher-header > h5').click()")
sleep 1
@@ -290,10 +287,10 @@
clear_downloads
end
## Helpers ##
- def perform_search(query: , databases: , method: nil)
+ def perform_search(query:, databases:, method: nil)
# Load search form.
visit '/'
# Fill in query, select databases, submit form.
fill_in('sequence', with: query)