discourse/plugins/discourse-topic-voting/spec/system/page_objects/pages/topic.rb
Kris d1b96e8fe4
UX: add toggle to topic voting menu to change notification level to "watching" (#39097)
This adds the ability to easily toggle on the `watching` notification
level after voting for a topic, so voters can stay updated.

This syncs up with the topic's existing tracking level, so it's an
additional interface rather than any sort of new notification logic.

Demo: 



https://github.com/user-attachments/assets/ed66d50f-d29f-467f-b755-a89905bcf343
2026-04-15 10:25:57 +10:00

60 lines
1.3 KiB
Ruby

# frozen_string_literal: true
module TopicVotingTopic
include ::RSpec::Matchers
def vote_count
find(".title-voting .voting-wrapper__count-text")
end
def vote_popup
find(".see-votes")
end
def vote
find(".title-voting button.voting-wrapper__button").click
self
end
def remove_vote
if SiteSetting.topic_voting_enable_vote_limits
vote
find("button.remove-vote").click
else
find(".title-voting button.voting-wrapper__button").click
end
self
end
def click_my_votes
find(".see-votes").click
end
def has_no_remove_vote_button?
has_no_css?("button.remove-vote")
end
def has_voted?
has_css?(".title-voting button.voting-wrapper__button.btn-success")
end
def has_not_voted?
has_css?(".title-voting button.voting-wrapper__button.btn-default") &&
has_no_css?(".title-voting button.voting-wrapper__button.btn-success")
end
def click_watch_toggle
find(".topic-voting-menu__watch-toggle .btn").click
self
end
def has_watch_toggle_on?
has_css?(".topic-voting-menu__watch-toggle .d-icon-toggle-on")
end
def has_watch_toggle_off?
has_css?(".topic-voting-menu__watch-toggle .d-icon-toggle-off")
end
end
PageObjects::Pages::Topic.include(TopicVotingTopic)