2023-06-20 22:42:30 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe "Viewing top topics on categories page", type: :system, js: true do
|
|
|
|
fab!(:user) { Fabricate(:user) }
|
|
|
|
let(:category_list) { PageObjects::Components::CategoryList.new }
|
2023-07-17 18:35:47 -05:00
|
|
|
let(:topic_view) { PageObjects::Components::TopicView.new }
|
2023-06-20 22:42:30 -05:00
|
|
|
fab!(:category) { Fabricate(:category) }
|
|
|
|
fab!(:topic) { Fabricate(:topic, category: category) }
|
2023-07-17 18:35:47 -05:00
|
|
|
fab!(:post) { Fabricate(:post, topic: topic) }
|
2023-06-20 22:42:30 -05:00
|
|
|
|
|
|
|
it "displays and updates new counter" do
|
2023-07-17 18:26:12 -05:00
|
|
|
skip(<<~TEXT)
|
|
|
|
Flaky at the following step:
|
|
|
|
|
|
|
|
expect(category_list).to have_no_new_posts_badge
|
|
|
|
expected `#<PageObjects::Components::CategoryList:0x00007fe27a3d2340>.has_no_new_posts_badge?` to be truthy, got false
|
|
|
|
TEXT
|
|
|
|
|
2023-06-20 22:42:30 -05:00
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit("/categories")
|
|
|
|
|
|
|
|
category_list.click_new_posts_badge(count: 1)
|
|
|
|
category_list.click_topic(topic)
|
2023-07-17 18:35:47 -05:00
|
|
|
|
|
|
|
expect(topic_view).to have_read_post(post)
|
|
|
|
|
2023-06-20 22:42:30 -05:00
|
|
|
category_list.click_logo
|
|
|
|
category_list.click_category_navigation
|
|
|
|
|
|
|
|
expect(category_list).to have_category(category)
|
|
|
|
expect(category_list).to have_no_new_posts_badge
|
|
|
|
end
|
|
|
|
end
|