DEV: Avoid waiting full capybara default wait time (#22449)

Why this change?

`not_to be_open` ends up calling `has_css?` on a selector that will
never appear so it ends up waiting the full default wait time.
This commit is contained in:
Alan Guo Xiang Tan 2023-07-06 08:16:58 +08:00 committed by GitHub
parent 37a8036b2d
commit 9a65c78d87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -193,7 +193,7 @@ RSpec.describe "Navigation", type: :system do
expect(thread_page).to have_back_link_to_channel(category_channel)
thread_page.back_to_previous_route
expect(page).to have_current_path("#{category_channel.relative_url}")
expect(side_panel_page).not_to be_open
expect(side_panel_page).to be_closed
end
end
end

View File

@ -7,6 +7,10 @@ module PageObjects
has_css?(".chat-side-panel")
end
def closed?
has_no_css?(".chat-side-panel")
end
def has_open_thread?(thread = nil)
if thread
has_css?(".chat-side-panel .chat-thread[data-id='#{thread.id}']")