mirror of
https://github.com/discourse/discourse.git
synced 2025-06-10 17:23:49 +08:00
DEV: Add more page objects (#18972)
This commit is contained in:
@ -43,6 +43,7 @@ export default Mixin.create({
|
|||||||
validationMessage: null,
|
validationMessage: null,
|
||||||
isSecret: oneWay("setting.secret"),
|
isSecret: oneWay("setting.secret"),
|
||||||
setting: null,
|
setting: null,
|
||||||
|
attributeBindings: ["setting.setting:data-setting"],
|
||||||
|
|
||||||
@discourseComputed("buffered.value", "setting.value")
|
@discourseComputed("buffered.value", "setting.value")
|
||||||
dirty(bufferVal, settingVal) {
|
dirty(bufferVal, settingVal) {
|
||||||
|
18
spec/system/page_objects/pages/admin_settings.rb
Normal file
18
spec/system/page_objects/pages/admin_settings.rb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module PageObjects
|
||||||
|
module Pages
|
||||||
|
class AdminSettings < PageObjects::Pages::Base
|
||||||
|
def visit_filtered_plugin_setting(filter)
|
||||||
|
visit("/admin/site_settings/category/plugins?filter=#{filter}")
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def toggle_setting(setting_name, text = '')
|
||||||
|
setting = find(".admin-detail .row.setting[data-setting='#{setting_name}']")
|
||||||
|
setting.find('.setting-value span', text: text).click
|
||||||
|
setting.find('.setting-controls button.ok').click
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -6,12 +6,12 @@ module PageObjects
|
|||||||
# keeping the various category related features combined for now
|
# keeping the various category related features combined for now
|
||||||
|
|
||||||
def visit(category)
|
def visit(category)
|
||||||
Capybara.current_session.visit("/c/#{category.id}")
|
page.visit("/c/#{category.id}")
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def visit_settings(category)
|
def visit_settings(category)
|
||||||
Capybara.current_session.visit("/c/#{category.slug}/edit/settings")
|
page.visit("/c/#{category.slug}/edit/settings")
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ module PageObjects
|
|||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle_setting(text)
|
def toggle_setting(setting, text = '')
|
||||||
find('.edit-category-tab label.checkbox-label', text: text).click
|
find(".edit-category-tab .#{setting} label.checkbox-label", text: text).click
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
19
spec/system/page_objects/pages/user.rb
Normal file
19
spec/system/page_objects/pages/user.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module PageObjects
|
||||||
|
module Pages
|
||||||
|
class User < PageObjects::Pages::Base
|
||||||
|
def find(selector)
|
||||||
|
page.find(".user-content-wrapper #{selector}")
|
||||||
|
end
|
||||||
|
|
||||||
|
def active_user_primary_navigation
|
||||||
|
find(".user-primary-navigation li a.active")
|
||||||
|
end
|
||||||
|
|
||||||
|
def active_user_secondary_navigation
|
||||||
|
find(".user-secondary-navigation li a.active")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user