forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add system federation tests to test basic browse and search pages fed…
…eration
- Loading branch information
1 parent
5b03474
commit 03f4ade
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require "application_system_test_case" | ||
|
||
class FederationTest < ApplicationSystemTestCase | ||
|
||
setup do | ||
@search_path = "/search" | ||
@query = "test" | ||
|
||
@ontologies_path = "/ontologies" | ||
|
||
end | ||
|
||
test "perform federated search in search page and make sure duplicates are managed correctly" do | ||
visit "#{@search_path}?q=#{@query}&lang=all&portals%5B%5D=agroportal&portals%5B%5D=ecoportal&portals%5B%5D=earthportal&portals%5B%5D=biodivportal" | ||
assert_selector ".search-page-number-of-results" | ||
|
||
results_titles = all("a.title div").map { |div| div.text.strip } | ||
|
||
assert_equal results_titles.count, results_titles.uniq.count, "There are duplicated results !" | ||
|
||
end | ||
|
||
|
||
test "perform federated search in browse page and make sure duplicates are managed correctly" do | ||
visit "#{@ontologies_path}?sort_by=ontology_name&portals=agroportal%2Cecoportal%2Cearthportal%2Cbiodivportal" | ||
loop do | ||
loading_element = find_all(".browse-sket").any? | ||
|
||
break unless loading_element | ||
|
||
page.execute_script("window.scrollBy(0, window.innerHeight)") | ||
|
||
sleep 0.3 | ||
end | ||
|
||
ontologies_titles = all(".browse-ontology-title").map { |a| a.text.strip } | ||
|
||
assert_equal ontologies_titles.count, ontologies_titles.uniq.count, "There are duplicated results !" | ||
end | ||
|
||
|
||
|
||
end |