discourse/spec/system/page_objects/pages/user_activity_bookmarks.rb
Joffrey JAFFEUX 6f91014d64
FIX: correctly filter user bookmarks (#28612)
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
2024-08-28 15:39:07 -04:00

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