mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-06 02:10:08 +08:00
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
60 lines
1.3 KiB
Ruby
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)
|