discourse/spec/system/page_objects/pages/wizard.rb
Martin Brennan 3135f472e2
FEATURE: Improve wizard quality and rearrange steps (#30055)
This commit contains various quality improvements to
our site setup wizard, along with some rearrangement of
steps to improve the admin setup experience and encourage
admins to customize the site early to avoid "all sites look the
same" sentiment.

#### Step rearrangement

* “Your site is ready” from 3 → 4
* “Logos” from 4 → 5
* “Look and feel” from 5 → 3

#### Font selector improvements

Changes the wizard font selector dropdown to show
a preview of all fonts with a CSS class so you don't
have to choose the font to get a preview.

Also makes the fonts appear in alphabetical order.

#### Preview improvements

Placeholder text changed from lorem ipsum to actual topic titles,
category names, and post content. This makes it feel more "real".

Fixes "undefined" categories. Added a date to the topic timeline.

Fixes button rectangles and other UI elements not changing in
size when the font changed, leading to cut off text which looked super
messy. Also fixed some font color issues.

Fixed table header alignment for Latest topic list.

#### Homepage style selector improvements

Limited the big list of homepage styles to Latest, Hot, Categories with latest topics,
and Category boxes based on research into the most common options.

#### Preview header

Changed the preview header to move the hamburger to the left
and add a chat icon

#### And more!

Changed the background of the wizard to use our branded blob style.
2025-01-02 09:28:23 +10:00

151 lines
4.7 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class Wizard < PageObjects::Pages::Base
attr_reader :introduction_step,
:privacy_step,
:ready_step,
:branding_step,
:styling_step,
:corporate_step
def initialize
@introduction_step = PageObjects::Pages::Wizard::IntroductionStep.new(self)
@privacy_step = PageObjects::Pages::Wizard::PrivacyStep.new(self)
@ready_step = PageObjects::Pages::Wizard::ReadyStep.new(self)
@branding_step = PageObjects::Pages::Wizard::BrandingStep.new(self)
@styling_step = PageObjects::Pages::Wizard::StylingStep.new(self)
@corporate_step = PageObjects::Pages::Wizard::CorporateStep.new(self)
end
def go_to_step(step_id)
visit("/wizard/steps/#{step_id}")
end
def on_step?(step_id)
has_css?(".wizard-container__step.#{step_id}")
end
def click_jump_in
find(".wizard-container__button.jump-in").click
end
def click_configure_more
find(".wizard-container__button.configure-more").click
end
def go_to_next_step
find(".wizard-container__button.next").click
end
def find_field(field_type, field_id)
find(".wizard-container__field.#{field_type}-field.#{field_type}-#{field_id}")
end
def fill_field(field_type, field_id, value)
find_field(field_type, field_id).fill_in(with: value)
end
def has_field_with_value?(field_type, field_id, value)
find_field(field_type, field_id).find("input").value == value
end
end
end
end
class PageObjects::Pages::Wizard::StepBase < PageObjects::Pages::Base
attr_reader :wizard
def initialize(wizard)
@wizard = wizard
end
end
class PageObjects::Pages::Wizard::IntroductionStep < PageObjects::Pages::Wizard::StepBase
end
class PageObjects::Pages::Wizard::PrivacyStep < PageObjects::Pages::Wizard::StepBase
def choice_selector(choice_id)
".wizard-container__radio-choice[data-choice-id='#{choice_id}']"
end
def select_access_option(section, choice_id)
wizard.find_field("radio", section).find(choice_selector(choice_id)).click
end
def has_selected_choice?(section, choice_id)
wizard.find_field("radio", section).has_css?(choice_selector(choice_id) + ".--selected")
end
end
class PageObjects::Pages::Wizard::ReadyStep < PageObjects::Pages::Wizard::StepBase
end
class PageObjects::Pages::Wizard::BrandingStep < PageObjects::Pages::Wizard::StepBase
def click_upload_button(field_id)
wizard.find_field("image", field_id).find(".wizard-container__button-upload").click
end
def has_upload?(field_id)
wizard.find_field("image", field_id).has_css?(".wizard-container__button-upload.has-upload")
end
end
class PageObjects::Pages::Wizard::StylingStep < PageObjects::Pages::Wizard::StepBase
def select_color_palette_option(palette)
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-color-scheme .wizard-container__dropdown")
select_kit.expand
select_kit.select_row_by_value(palette)
end
def select_body_font_option(font)
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-body-font .wizard-container__dropdown")
select_kit.expand
select_kit.select_row_by_value(font)
end
def select_heading_font_option(font)
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-heading-font .wizard-container__dropdown")
select_kit.expand
select_kit.select_row_by_value(font)
end
def select_homepage_style_option(homepage)
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-homepage-style .wizard-container__dropdown")
select_kit.expand
select_kit.select_row_by_value(homepage)
end
def has_selected_color_palette?(palette)
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-color-scheme .wizard-container__dropdown")
select_kit.has_selected_value?(palette)
end
def has_selected_body_font?(font)
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-body-font .wizard-container__dropdown")
select_kit.has_selected_value?(font)
end
def has_selected_heading_font?(font)
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-heading-font .wizard-container__dropdown")
select_kit.has_selected_value?(font)
end
def has_selected_homepage_style?(hompage)
select_kit =
PageObjects::Components::SelectKit.new(".dropdown-homepage-style .wizard-container__dropdown")
select_kit.has_selected_value?(hompage)
end
end
class PageObjects::Pages::Wizard::CorporateStep < PageObjects::Pages::Wizard::StepBase
end