discourse/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb
Martin Brennan 07c3782e51
FEATURE: Show unread in sidebar for unread channel threads (#22342)
This commit makes it so that when the user has unread threads
for a channel we show a blue dot in the sidebar (or channel index
for mobile/drawer).

This blue dot is slightly different from the channel unread messages:

1. It will only show if the new thread messages were created since
   the user last viewed the channel
2. It will be cleared when the user views the channel, but the threads
   are still considered unread because we want the user to click into
   the thread list to view them

This necessitates a change to the current user serializer to also
include the unread thread overview, which is all unread threads
across all channels and their last reply date + time.
2023-07-17 13:00:49 +10:00

56 lines
1.5 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class Sidebar < PageObjects::Pages::Base
PUBLIC_CHANNELS_SECTION_SELECTOR = ".sidebar-section[data-section-name='chat-channels']"
DM_CHANNELS_SECTION_SELECTOR = ".sidebar-section[data-section-name='chat-dms']"
def has_no_public_channels_section?
has_no_css?(PUBLIC_CHANNELS_SECTION_SELECTOR)
end
def channels_section
find(PUBLIC_CHANNELS_SECTION_SELECTOR)
end
def channels_section
find(PUBLIC_CHANNELS_SECTION_SELECTOR)
end
def dms_section
find(DM_CHANNELS_SECTION_SELECTOR)
end
def open_browse
channels_section.find(".sidebar-section-header-button", visible: false).click
end
def open_channel(channel)
find(".sidebar-section-link.channel-#{channel.id}").click
end
def remove_channel(channel)
selector = ".sidebar-section-link.channel-#{channel.id}"
find(selector).hover
find(selector + " .sidebar-section-hover-button").click
end
def find_channel(channel)
find(".sidebar-section-link.channel-#{channel.id}")
self
end
def has_unread_channel?(channel)
has_css?(".sidebar-section-link.channel-#{channel.id} .sidebar-section-link-suffix.unread")
end
def has_no_unread_channel?(channel)
has_no_css?(
".sidebar-section-link.channel-#{channel.id} .sidebar-section-link-suffix.unread",
)
end
end
end
end