2022-12-16 05:25:31 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Components
|
|
|
|
class Composer < PageObjects::Components::Base
|
2023-02-23 02:01:39 -05:00
|
|
|
COMPOSER_ID = "#reply-control"
|
|
|
|
|
|
|
|
def opened?
|
|
|
|
page.has_css?("#{COMPOSER_ID}.open")
|
|
|
|
end
|
|
|
|
|
2022-12-16 05:25:31 -05:00
|
|
|
def open_composer_actions
|
|
|
|
find(".composer-action-title .btn").click
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def fill_title(title)
|
2023-02-23 02:01:39 -05:00
|
|
|
find("#{COMPOSER_ID} #reply-title").fill_in(with: title)
|
2022-12-16 05:25:31 -05:00
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def fill_content(content)
|
2023-01-11 22:54:26 -05:00
|
|
|
composer_input.fill_in(with: content)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def type_content(content)
|
|
|
|
composer_input.send_keys(content)
|
2022-12-16 05:25:31 -05:00
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2023-01-11 22:54:26 -05:00
|
|
|
def clear_content
|
|
|
|
fill_content("")
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_content?(content)
|
|
|
|
composer_input.value == content
|
|
|
|
end
|
|
|
|
|
2022-12-16 05:25:31 -05:00
|
|
|
def select_action(action)
|
|
|
|
find(action(action)).click
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2023-02-23 02:01:39 -05:00
|
|
|
find("#{COMPOSER_ID} .btn-primary").click
|
2022-12-16 05:25:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def action(action_title)
|
|
|
|
".composer-action-title .select-kit-collection li[title='#{action_title}']"
|
|
|
|
end
|
|
|
|
|
|
|
|
def button_label
|
2023-02-23 02:01:39 -05:00
|
|
|
find("#{COMPOSER_ID} .btn-primary .d-button-label")
|
2022-12-16 05:25:31 -05:00
|
|
|
end
|
2023-01-11 22:54:26 -05:00
|
|
|
|
|
|
|
def composer_input
|
2023-02-23 02:01:39 -05:00
|
|
|
find("#{COMPOSER_ID} .d-editor .d-editor-input")
|
2023-01-11 22:54:26 -05:00
|
|
|
end
|
2022-12-16 05:25:31 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|