* Add the preview card to logged out feed initial content * initialise the initial dropdowns added on the logged out feed * minor tweak to selector * flip the follow button and the summary * add minimal preview card to build article HTML * WIP: data fetched an inserted into card on logged out feed * WIP: cards added to logged in feed * create separate profile preview card component * small style tweak, import pack on each page that shows feed cards * rename * tweak some styling issues * make sure follow buttons init in cards * populate all matching metadata placeholders after fetch * don't render full preview card upfront on logged out feed * refactors from PR comments * fix issue in person search results * remove check for article author link that will be superseded by cypress test for preview card * Revert "remove check for article author link that will be superseded by cypress test for preview card" This reverts commit 9b42804ffd0f051891c87293d0b791ed2bb0367f. * Revert "fix issue in person search results" This reverts commit 04941e3520c0895212141193b60f2933faed5ca1. * only show the preview cards on story cards for Posts (not users etc in search results) * correct display on collections view * remove link check that will be replaced by cypress test * tweaks to small issues, add a test for the logged out feed * add tests for logged in home feed, logged out tag index * add search test and tag index logged in test * fixes to preview profile spec * tweak to followauthor spec * add cypress test for preview on series page * use a unique test user for series test * correct the jsdoc comments * tweaks following PR review * allow feed preview cards to reposition * move to separate file from pack
42 lines
1.8 KiB
Ruby
42 lines
1.8 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Display articles search spec", type: :system, js: true do
|
|
it "returns correct results for a search" do
|
|
found_article_one = create(:article)
|
|
found_article_one.update_columns(cached_tag_list: "ruby")
|
|
found_article_two = create(:article)
|
|
found_article_two.update_columns(body_markdown: "#{found_article_two.body_markdown} Ruby Tuesday")
|
|
not_found_article = create(:article)
|
|
|
|
visit "/search?q=ruby&filters=class_name:Article"
|
|
|
|
expect(page).to have_content(found_article_one.title)
|
|
expect(page).to have_content(found_article_two.title)
|
|
expect(page).not_to have_content(not_found_article.title)
|
|
end
|
|
|
|
it "returns all expected article fields" do
|
|
found_article_one = create(:article)
|
|
found_article_one.update_columns(cached_tag_list: "ruby",
|
|
reading_time: 5,
|
|
comments_count: 2,
|
|
public_reactions_count: 3)
|
|
visit "/search?q=ruby&filters=class_name:Article"
|
|
|
|
expect(page).to have_content(found_article_one.title)
|
|
expect(find("#article-link-#{found_article_one.id}")["href"]).to include(found_article_one.path)
|
|
expect(page).to have_selector("button[data-reactable-id=\"#{found_article_one.id}\"]")
|
|
expect(page).to have_content("5 min read")
|
|
expect(find_link("#ruby")["href"]).to include("/t/ruby")
|
|
expect(page).to have_content("3 reactions")
|
|
expect(page).to have_content("2 comments")
|
|
end
|
|
|
|
it "does not show reaction data if article has no reactions" do
|
|
found_article_one = create(:article)
|
|
found_article_one.update_columns(cached_tag_list: "ruby", public_reactions_count: 0)
|
|
visit "/search?q=ruby&filters=class_name:Article"
|
|
|
|
expect(page).not_to have_content("0 reactions")
|
|
end
|
|
end
|