discourse/spec/system/page_objects/modals/admin_onboarding_theme_picker.rb
Keegan George 3cd6cbcb06
UX: Polish the theme picker modal (#40414)
Previously, the theme picker modal had small blurry screenshots, only
the "Use this theme" button was interactive (not the card), and changing
themes showed a toast notification that appeared briefly before the page
reloaded.

This change makes the modal wider with taller image previews, lets users
select a card first and then apply with a "Use selected theme" button
(with an inline loading state replacing the toast), and skips the API
call entirely when the already-active theme is reselected.



https://github.com/user-attachments/assets/6496bbfa-bf4e-4c7a-9168-3b3e0039c3de
2026-05-29 14:05:56 -07:00

32 lines
852 B
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Modals
class AdminOnboardingThemePicker < PageObjects::Modals::Base
MODAL_SELECTOR = ".theme-picker-modal"
CARD_SELECTOR = ".theme-picker-modal__card"
NAME_SELECTOR = ".theme-card-preview__name"
def open?
has_css?(MODAL_SELECTOR)
end
def has_theme_cards?(**options)
has_css?(CARD_SELECTOR, **options)
end
def first_selectable_theme_name
find("#{CARD_SELECTOR}:not(.--selected) #{NAME_SELECTOR}", match: :first).text
end
def select_theme(name)
find(CARD_SELECTOR, text: name).click
find(".theme-picker-modal__footer .btn-primary").click
end
def select_first_selectable_theme
first_selectable_theme_name.tap { |name| select_theme(name) }
end
end
end
end