Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/cv2 5737 integration tests for most relevant articles #2233

Draft
wants to merge 21 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
13506d6
get relevant articles and change the message displayed when we have r…
danielevalverde Nov 19, 2024
076642e
refactoring: move the logic to display the messages from parent to ch…
danielevalverde Nov 19, 2024
98cfa0a
more refactoring
danielevalverde Nov 19, 2024
3f505ee
Merge branch 'develop' of github.com:meedan/check-web into epic/CV2-5…
danielevalverde Nov 25, 2024
72dd5f9
update the code to use relevan_articles from ProjectMediaType
danielevalverde Nov 26, 2024
5c5faac
remove hard code for numberOfArticles variable
danielevalverde Nov 26, 2024
19c5230
add unit tests
danielevalverde Nov 28, 2024
74e4062
linter problems
danielevalverde Nov 28, 2024
1c8ad95
Merge branch 'develop' of github.com:meedan/check-web into epic/CV2-5…
danielevalverde Dec 3, 2024
368cf7d
update query to include explainers fields
danielevalverde Dec 3, 2024
4fa4e39
remove debug
danielevalverde Dec 4, 2024
02cf335
remove more debug
danielevalverde Dec 5, 2024
9bdb72e
apply PR review
danielevalverde Dec 5, 2024
837890f
start working on new integration tests and add new method for calling…
danielevalverde Dec 10, 2024
f6f8cb8
update tests
danielevalverde Dec 10, 2024
9c55071
Merge branch 'develop' of github.com:meedan/check-web into tests/CV2-…
danielevalverde Dec 16, 2024
55d5d29
Merge branch 'develop' of github.com:meedan/check-web into tests/CV2-…
danielevalverde Dec 17, 2024
ad267dc
[full ci]
danielevalverde Dec 17, 2024
111b413
fix linter problems[full ci]
danielevalverde Dec 17, 2024
c14ec4d
Merge branch 'develop' of github.com:meedan/check-web into tests/CV2-…
danielevalverde Dec 18, 2024
9303241
[full ci]
danielevalverde Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions test/spec/api_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 23 additions & 0 deletions test/spec/similarity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down
Loading