mirror of
https://github.com/discourse/discourse.git
synced 2024-12-03 07:28:13 +08:00
6f91014d64
We were not updating `searchTerm` when changing the input which was making us always send an empty q parameter. This commit is also adding tests for: - initial url with q param - filtering the bookmarks through the input
42 lines
865 B
Ruby
42 lines
865 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class UserActivityBookmarks < PageObjects::Pages::Base
|
|
def visit(user, q: nil)
|
|
url = "/u/#{user.username_lower}/activity/bookmarks"
|
|
url += "?q=#{q}" if q
|
|
page.visit(url)
|
|
self
|
|
end
|
|
|
|
def search_for(query)
|
|
fill_in_search(query).submit_button.click
|
|
self
|
|
end
|
|
|
|
def clear_query
|
|
fill_in_search("").submit_button.click
|
|
self
|
|
end
|
|
|
|
def fill_in_search(query)
|
|
fill_in("bookmark-search", with: query)
|
|
self
|
|
end
|
|
|
|
def has_topic?(topic)
|
|
has_content?(topic.title)
|
|
end
|
|
|
|
def has_no_topic?(topic)
|
|
has_no_content?(topic.title)
|
|
end
|
|
|
|
def submit_button
|
|
@submit_button ||= page.find(".bookmark-search-form button")
|
|
end
|
|
end
|
|
end
|
|
end
|