discourse-ai/spec/system/page_objects/pages/admin_ai_features.rb
Roman Rizzi 98afd7f8c3
FEATURE: Display features that rely on multiple personas. (#1411)
* FEATURE: Display features that rely on multiple personas.

This change makes the previously hidden feature page visible while displaying features, like the AI helper, which relies on multiple personas.

* Fix system specs
2025-06-09 16:13:09 -03:00

48 lines
1.3 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class AdminAiFeatures < PageObjects::Pages::Base
FEATURES_PAGE = ".ai-features"
def visit
page.visit("/admin/plugins/discourse-ai/ai-features")
self
end
def toggle_configured
page.find("#{FEATURES_PAGE} .ai-feature-groups .configured").click
end
def toggle_unconfigured
page.find("#{FEATURES_PAGE} .ai-feature-groups .unconfigured").click
end
def has_listed_modules?(count)
page.has_css?("#{FEATURES_PAGE} .ai-module", count: count)
end
def has_feature_persona?(feature_name, name)
page.has_css?(
"#{FEATURES_PAGE} .ai-feature-card[data-feature-name='#{feature_name}'] .ai-feature-card__persona-button .d-button-label",
text: name,
)
end
def has_feature_groups?(feature_name, groups)
listed_groups =
page.find(
"#{FEATURES_PAGE} .ai-feature-card[data-feature-name='#{feature_name}'] .ai-feature-card__item-groups",
)
list_items = listed_groups.all("li", visible: true).map(&:text)
list_items.sort == groups.sort
end
def click_edit_module(module_name)
page.find("#{FEATURES_PAGE} .ai-module[data-module-name='#{module_name}'] .edit").click
end
end
end
end