2024-02-26 15:22:09 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Components
|
|
|
|
class AiCaptionPopup < PageObjects::Components::Base
|
|
|
|
GENERATE_CAPTION_SELECTOR = ".button-wrapper .generate-caption"
|
|
|
|
CAPTION_POPUP_SELECTOR = ".ai-caption-popup"
|
|
|
|
CAPTION_TEXTAREA_SELECTOR = "#{CAPTION_POPUP_SELECTOR} textarea"
|
|
|
|
|
2024-03-01 14:58:33 -05:00
|
|
|
def hover_image_wrapper
|
|
|
|
image_wrapper = find(".d-editor-preview .image-wrapper")
|
|
|
|
image_wrapper.hover
|
|
|
|
end
|
|
|
|
|
2024-02-26 15:22:09 -05:00
|
|
|
def click_generate_caption
|
2024-03-01 14:58:33 -05:00
|
|
|
hover_image_wrapper
|
2024-02-26 15:22:09 -05:00
|
|
|
page.find(GENERATE_CAPTION_SELECTOR, visible: false).click
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_caption_popup_value?(value)
|
|
|
|
page.find(CAPTION_TEXTAREA_SELECTOR).value == value
|
|
|
|
end
|
|
|
|
|
|
|
|
def save_caption
|
2024-03-01 14:58:33 -05:00
|
|
|
hover_image_wrapper
|
2024-02-26 15:22:09 -05:00
|
|
|
find("#{CAPTION_POPUP_SELECTOR} .btn-primary").click
|
|
|
|
end
|
2024-02-28 16:32:45 -05:00
|
|
|
|
|
|
|
def cancel_caption
|
2024-03-01 14:58:33 -05:00
|
|
|
hover_image_wrapper
|
2024-02-28 16:32:45 -05:00
|
|
|
find("#{CAPTION_POPUP_SELECTOR} .cancel-request").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_disabled_generate_button?
|
|
|
|
page.has_no_css?("#{GENERATE_CAPTION_SELECTOR}.disabled", visible: false)
|
|
|
|
end
|
2024-03-11 18:35:20 -04:00
|
|
|
|
|
|
|
def has_no_generate_caption_button?
|
|
|
|
page.has_no_css?(GENERATE_CAPTION_SELECTOR, visible: false)
|
|
|
|
end
|
2024-02-26 15:22:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|