discourse/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb
Martin Brennan 9a6eefaafc
DEV: Fix chat sidebar system spec flaky (#19844)
The spec was flaky because it was dependent on order,
when usernames got high enough sequence numbers in them
we would get this error:

> expected to find text "bruce99, bruce100" in "bruce100, bruce99"

Also move selectors into page object and use them in the
spec instead.
2023-01-12 14:12:49 +10:00

33 lines
840 B
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class Sidebar < PageObjects::Pages::Base
def channels_section
find(".sidebar-section-chat-channels")
end
def dms_section
find(".sidebar-section-chat-dms")
end
def open_draft_channel
find(".sidebar-section-chat-dms .sidebar-section-header-button", visible: false).click
end
def open_browse
find(".sidebar-section-chat-channels .sidebar-section-header-button", visible: false).click
end
def open_channel(channel)
find(".sidebar-section-link[href='/chat/channel/#{channel.id}/#{channel.slug}']").click
end
def find_channel(channel)
find(".sidebar-section-link[href='/chat/channel/#{channel.id}/#{channel.slug}']")
self
end
end
end
end