mirror of
https://github.com/discourse/discourse.git
synced 2025-03-01 14:18:56 +08:00

This was failing quite often with the following error: ``` 1) Emoji deny list when using composer should remove denied emojis from emoji picker Failure/Error: find("#{COMPOSER_ID} .emoji-picker") Capybara::ElementNotFound: Unable to find css "#reply-control .emoji-picker" ``` This was because our `click_toolbar_button` call on the Composer page object used a number for the position of the toolbar button, which can be flaky since there are things that hide/show toolbar buttons or change their position. Each toolbar button in the composer has a CSS class, so it is more reliable to use that instead. Also fixed an instance of calling `has_X?` method directly instead of using the `have_x` rspec matcher.
24 lines
567 B
Ruby
24 lines
567 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class EmojiPicker < PageObjects::Components::Base
|
|
def emoji_button_selector(emoji_name)
|
|
".emoji-picker .emoji[title='#{emoji_name}']"
|
|
end
|
|
|
|
def select_emoji(emoji_name)
|
|
find(emoji_button_selector(emoji_name)).click
|
|
end
|
|
|
|
def search_emoji(emoji_name)
|
|
find(".emoji-picker .search input").fill_in(with: emoji_name)
|
|
end
|
|
|
|
def has_emoji?(emoji_name)
|
|
page.has_css?(emoji_button_selector(emoji_name))
|
|
end
|
|
end
|
|
end
|
|
end
|