Skip to content

Commit

Permalink
add system federation tests to test basic browse and search pages fed…
Browse files Browse the repository at this point in the history
…eration
  • Loading branch information
Bilelkihal committed Jan 16, 2025
1 parent 5b03474 commit 03f4ade
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/system/federation_test.rb
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

0 comments on commit 03f4ade

Please sign in to comment.