discourse/spec/system/page_objects/pages/admin_embedding.rb
Rafael dos Santos Silva 6c2d77ef66
FEATURE: Add full app mode toggle to embedding admin page (#39052)
## Summary
- Adds a toggle to the top of the embedding hosts page
(`/admin/customize/embedding`) to enable/disable the `embed_full_app`
site setting directly from the UI
- When enabled, the configuration snippet automatically includes
`fullApp: true` and `embedHeight: '800px'` parameters
- Un-hides the `embed_full_app` site setting so it also appears in the
embedding settings tab

<img width="1885" height="2033" alt="image"
src="https://github.com/user-attachments/assets/bc541036-61f7-4ff4-b038-81f93e4a174c"
/>
<img width="1146" height="746" alt="image"
src="https://github.com/user-attachments/assets/3e8dfb86-00b8-439f-be2b-9cb550005229"
/>
<img width="1145" height="783" alt="image"
src="https://github.com/user-attachments/assets/54f110d2-17bb-4398-8481-0732a2c96269"
/>

---------

Co-authored-by: Keegan George <kgeorge13@gmail.com>
2026-04-01 15:02:51 -03:00

71 lines
1.7 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class AdminEmbedding < AdminBase
def visit
page.visit("/admin/customize/embedding")
self
end
def click_add_host
find(".admin-embedding__header-add-host").click
self
end
def click_edit_host
find(".admin-embeddable-host-item__edit").click
self
end
def open_embedding_host_menu
find(".embedding-host-menu-trigger").click
self
end
def full_app_mode_toggle
PageObjects::Components::DToggleSwitch.new(
".admin-embedding-index__full-app-toggle .d-toggle-switch__checkbox",
)
end
def click_full_app_mode_toggle
full_app_mode_toggle.toggle
self
end
def has_full_app_mode_enabled?
full_app_mode_toggle.checked?
end
def has_full_app_mode_disabled?
full_app_mode_toggle.unchecked?
end
def expand_snippet
find(".admin-embedding-index__code .admin-config-area-card__toggle-button").click
self
end
def has_snippet_containing?(text)
page.has_css?(".admin-embedding-index__code code", text: text)
end
def has_no_snippet_containing?(text)
page.has_no_css?(".admin-embedding-index__code code", text: text)
end
def click_delete
open_embedding_host_menu
find(".admin-embeddable-host-item__delete").click
self
end
def confirm_delete
find(".dialog-footer .btn-primary").click
expect(page).to have_no_css(".dialog-body", wait: Capybara.default_max_wait_time * 3)
self
end
end
end
end