diff --git a/spec/system/articles/user_visits_articles_by_tag_spec.rb b/spec/system/articles/user_visits_articles_by_tag_spec.rb
index 9baff83c2..ab267506a 100644
--- a/spec/system/articles/user_visits_articles_by_tag_spec.rb
+++ b/spec/system/articles/user_visits_articles_by_tag_spec.rb
@@ -26,6 +26,12 @@ RSpec.describe "User visits articles by tag", type: :system do
within("header.tag-header") { expect(page).to have_button("Follow") }
end
+ # Regression test for https://github.com/forem/forem/pull/12724
+ it "does not display a comment count of 0", js: true, stub_elasticsearch: true do
+ expect(page).to have_text("Add Comment")
+ expect(page).not_to have_text("0 comments")
+ end
+
it "shows correct articles count" do
expect(page).to have_selector(".crayons-story", count: 2)
end
diff --git a/spec/system/homepage/user_visits_homepage_articles_spec.rb b/spec/system/homepage/user_visits_homepage_articles_spec.rb
index 43482e2f2..b701d2526 100644
--- a/spec/system/homepage/user_visits_homepage_articles_spec.rb
+++ b/spec/system/homepage/user_visits_homepage_articles_spec.rb
@@ -19,6 +19,15 @@ RSpec.describe "User visits a homepage", type: :system do
expect(page).to have_selector(".crayons-story--featured", visible: :visible)
end
+ # Regression test for https://github.com/forem/forem/pull/12724
+ it "does not display a comment count of 0", js: true, stub_elasticsearch: true do
+ expect(page).to have_text("Add Comment")
+ expect(page).not_to have_text("0 comments")
+ article.update_column(:comments_count, 50)
+ visit "/"
+ expect(page).to have_text(/50\s*comments/)
+ end
+
it "shows the main article readable date and time", js: true, stub_elasticsearch: true do
expect(page).to have_selector(".crayons-story--featured time", text: published_date)
selector = ".crayons-story--featured time[datetime='#{timestamp}']"