2023-10-09 05:35:53 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Pages
|
|
|
|
class AdminCustomizeThemes < PageObjects::Pages::Base
|
|
|
|
def has_inactive_themes?
|
|
|
|
has_css?(".inactive-indicator")
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_inactive_themes?
|
|
|
|
has_no_css?(".inactive-indicator")
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_select_inactive_mode_button?
|
|
|
|
has_css?(".select-inactive-mode")
|
|
|
|
end
|
|
|
|
|
2024-03-13 06:52:46 +08:00
|
|
|
def has_overridden_setting?(setting_name)
|
2024-03-13 12:38:21 +08:00
|
|
|
has_css?(setting_selector(setting_name, overridden: true))
|
2024-03-13 06:52:46 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_overriden_setting?(setting_name)
|
2024-03-13 12:38:21 +08:00
|
|
|
has_no_css?(setting_selector(setting_name, overridden: true))
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_setting_description?(setting_name, description)
|
|
|
|
has_css?("#{setting_selector(setting_name)} .desc", exact_text: description)
|
2024-03-13 06:52:46 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def reset_overridden_setting(setting_name)
|
|
|
|
setting_section = find("section.theme.settings .setting[data-setting=\"#{setting_name}\"]")
|
|
|
|
setting_section.click_button(I18n.t("admin_js.admin.settings.reset"))
|
|
|
|
setting_section.find(".setting-controls .ok").click
|
|
|
|
end
|
|
|
|
|
2023-10-09 05:35:53 +08:00
|
|
|
def click_select_inactive_mode
|
|
|
|
find(".select-inactive-mode").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def cancel_select_inactive_mode
|
|
|
|
find(".cancel-select-inactive-mode").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_inactive_themes_selected?(count:)
|
|
|
|
has_css?(".inactive-theme input:checked", count: count)
|
|
|
|
end
|
|
|
|
|
2024-04-17 09:45:59 +08:00
|
|
|
def has_themes?(count:)
|
|
|
|
has_css?(".themes-list-container__item", count: count)
|
|
|
|
end
|
|
|
|
|
2023-10-09 05:35:53 +08:00
|
|
|
def toggle_all_inactive
|
|
|
|
find(".toggle-all-inactive").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_disabled_delete_theme_button?
|
|
|
|
find_button("Delete", disabled: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_delete_themes_button
|
|
|
|
find(".btn-delete").click
|
|
|
|
end
|
2024-03-06 08:24:29 +08:00
|
|
|
|
|
|
|
def click_edit_objects_theme_setting_button(setting_name)
|
|
|
|
find(".theme-setting[data-setting=\"#{setting_name}\"] .setting-value-edit-button").click
|
2024-03-13 06:52:46 +08:00
|
|
|
PageObjects::Pages::AdminObjectsThemeSettingEditor.new
|
2024-03-06 08:24:29 +08:00
|
|
|
end
|
2024-03-11 08:42:12 +08:00
|
|
|
|
|
|
|
def click_theme_settings_editor_button
|
|
|
|
click_button(I18n.t("admin_js.admin.customize.theme.settings_editor"))
|
|
|
|
PageObjects::Components::AdminThemeSettingsEditor.new
|
|
|
|
end
|
2024-03-13 06:52:46 +08:00
|
|
|
|
2024-04-17 09:45:59 +08:00
|
|
|
def switch_to_components
|
|
|
|
find(".components-tab").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def switch_to_themes
|
|
|
|
find(".themes-tab").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def search(term)
|
|
|
|
find(".themes-list-search__input").fill_in with: term
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_search?
|
|
|
|
has_no_css?(".themes-list-search__input")
|
|
|
|
end
|
|
|
|
|
2024-03-13 06:52:46 +08:00
|
|
|
private
|
|
|
|
|
2024-03-13 12:38:21 +08:00
|
|
|
def setting_selector(setting_name, overridden: false)
|
|
|
|
"section.theme.settings .setting#{overridden ? ".overridden" : ""}[data-setting=\"#{setting_name}\"]"
|
2024-03-13 06:52:46 +08:00
|
|
|
end
|
2023-10-09 05:35:53 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|