2023-10-23 10:41:36 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Components
|
2024-07-10 14:01:05 -04:00
|
|
|
class AiPostHelperMenu < PageObjects::Components::Base
|
2023-10-23 10:41:36 -04:00
|
|
|
POST_SELECTION_TOOLBAR_SELECTOR = ".quote-button"
|
|
|
|
QUOTE_SELECTOR = ".insert-quote"
|
|
|
|
EDIT_SELECTOR = ".quote-edit-label"
|
|
|
|
SHARE_SELECTOR = ".quote-sharing"
|
|
|
|
|
|
|
|
AI_HELPER_SELECTOR = ".ai-post-helper"
|
2024-07-10 14:01:05 -04:00
|
|
|
AI_HELPER_MOBILE_SELECTOR = ".ai-post-helper-menu-content"
|
2023-10-23 10:41:36 -04:00
|
|
|
TRIGGER_SELECTOR = "#{AI_HELPER_SELECTOR}__trigger"
|
2024-07-10 14:01:05 -04:00
|
|
|
OPTIONS_SELECTOR = ".ai-helper-options"
|
2023-10-23 10:41:36 -04:00
|
|
|
LOADING_SELECTOR = ".ai-helper-context-menu__loading"
|
|
|
|
SUGGESTION_SELECTOR = "#{AI_HELPER_SELECTOR}__suggestion"
|
2024-04-04 14:35:01 -04:00
|
|
|
HIGHLIGHT_SELECTOR = ".ai-helper-highlighted-selection"
|
2023-10-23 10:41:36 -04:00
|
|
|
|
|
|
|
def click_ai_button
|
|
|
|
find(TRIGGER_SELECTOR).click
|
|
|
|
end
|
|
|
|
|
2024-05-03 14:53:17 -04:00
|
|
|
def click_add_footnote
|
|
|
|
find("#{SUGGESTION_SELECTOR}__insert-footnote").click
|
|
|
|
end
|
|
|
|
|
2023-10-23 10:41:36 -04:00
|
|
|
def select_helper_model(mode)
|
|
|
|
find("#{OPTIONS_SELECTOR} .btn[data-value=\"#{mode}\"]").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def suggestion_value
|
2023-12-12 12:28:39 -05:00
|
|
|
find("#{SUGGESTION_SELECTOR}__text").text
|
2023-10-23 10:41:36 -04:00
|
|
|
end
|
|
|
|
|
2024-04-04 14:35:01 -04:00
|
|
|
def has_highlighted_text?
|
|
|
|
page.has_css?(HIGHLIGHT_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_highlighted_text?
|
|
|
|
page.has_no_css?(HIGHLIGHT_SELECTOR)
|
|
|
|
end
|
|
|
|
|
2024-07-10 14:01:05 -04:00
|
|
|
def has_mobile_post_ai_helper?
|
|
|
|
page.has_css?(AI_HELPER_MOBILE_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_mobile_post_ai_helper?
|
|
|
|
page.has_no_css?(AI_HELPER_MOBILE_SELECTOR)
|
|
|
|
end
|
|
|
|
|
2023-10-23 10:41:36 -04:00
|
|
|
def has_post_ai_helper?
|
|
|
|
page.has_css?(AI_HELPER_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_post_ai_helper?
|
|
|
|
page.has_no_css?(AI_HELPER_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_post_ai_helper_options?
|
|
|
|
page.has_css?(OPTIONS_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_post_ai_helper_options?
|
|
|
|
page.has_no_css?(OPTIONS_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_post_selection_toolbar?
|
|
|
|
page.has_css?(POST_SELECTION_TOOLBAR_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_post_selection_toolbar?
|
|
|
|
page.has_no_css?(POST_SELECTION_TOOLBAR_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_post_selection_primary_buttons?
|
|
|
|
page.has_css?(QUOTE_SELECTOR) || page.has_css?(EDIT_SELECTOR) ||
|
|
|
|
page.has_css?(SHARE_SELECTOR)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_post_selection_primary_buttons?
|
|
|
|
page.has_no_css?(QUOTE_SELECTOR) || page.has_no_css?(EDIT_SELECTOR) ||
|
|
|
|
page.has_no_css?(SHARE_SELECTOR)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|