diff --git a/test/spec/api_helpers.rb b/test/spec/api_helpers.rb index 401ad500c..a03037385 100644 --- a/test/spec/api_helpers.rb +++ b/test/spec/api_helpers.rb @@ -195,4 +195,27 @@ def api_create_team_claim_and_media_tag(params = {}) request_api 'new_media_tag', { pm_id: claim[:id], email: data[:user].email, tag: 'TAG' } @driver.navigate.to "#{@config['self_url']}/#{data[:team].slug}/all-items" end + + def api_create_imported_standalone_fact_check(params = {}) + team_data = params[:team_data] || api_create_team_and_bot(params) + email = params[:email] || team_data[:user].email + description = params[:description] || 'Default Test Description' + context = params[:context] || 'Default Test Context' + title = params[:title] || 'Default Test Title' + summary = params[:summary] || 'Default Test Summary' + url = params[:url] || 'http://example.com/test' + language = params[:language] || 'en' + + # API call to create the standalone fact check + request_api 'create_imported_standalone_fact_check', { + team_id: team_data[:team].dbid, + email: email, + description: description, + context: context, + title: title, + summary: summary, + url: url, + language: language + } + end end diff --git a/test/spec/similarity_spec.rb b/test/spec/similarity_spec.rb index e6afff0c0..9e2284480 100644 --- a/test/spec/similarity_spec.rb +++ b/test/spec/similarity_spec.rb @@ -87,6 +87,29 @@ expect(@driver.find_elements(:css, '.media__relationship').size).to eq 1 end + it 'should display relevant articles suggestion', bin7: true do + data = api_create_team_and_bot(bot: 'alegre') + + # Create the standalone fact check + api_create_imported_standalone_fact_check( + team_data: data, + description: '-', + context: '', + title: 'Foo Bar Testing', + summary: 'Foo Bar Testing', + url: 'http://example.com/test', + language: 'en' + ) + verbose_wait 3 + pm = api_create_claim(data: data, quote: 'Foo Bar Testing') + @driver.navigate.to "#{@config['self_url']}/#{data[:team].slug}/media/#{pm.id}" + verbose_wait 3 + @driver.navigate.refresh + verbose_wait 1 + # wait_for_selector('.article-card') + expect(@driver.page_source.include?('Choose a relevant article')).to be(true) + end + it 'should prepare environment for media similarity tests', bin8: true do data = api_create_team_and_bot(bot: 'alegre', score: { min_es_score: 0 }) pm = api_create_claim(data: data, quote: 'Just kicking off Alegre service.')