DEV: Add more page objects (#18972)

This commit is contained in:
Natalie Tay 2022-11-11 17:44:40 +08:00 committed by GitHub
parent 66130dc8c1
commit 09b7433167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 4 deletions

View File

@ -43,6 +43,7 @@ export default Mixin.create({
validationMessage: null,
isSecret: oneWay("setting.secret"),
setting: null,
attributeBindings: ["setting.setting:data-setting"],
@discourseComputed("buffered.value", "setting.value")
dirty(bufferVal, settingVal) {

View 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

View File

@ -6,12 +6,12 @@ module PageObjects
# keeping the various category related features combined for now
def visit(category)
Capybara.current_session.visit("/c/#{category.id}")
page.visit("/c/#{category.id}")
self
end
def visit_settings(category)
Capybara.current_session.visit("/c/#{category.slug}/edit/settings")
page.visit("/c/#{category.slug}/edit/settings")
self
end
@ -25,8 +25,8 @@ module PageObjects
self
end
def toggle_setting(text)
find('.edit-category-tab label.checkbox-label', text: text).click
def toggle_setting(setting, text = '')
find(".edit-category-tab .#{setting} label.checkbox-label", text: text).click
self
end
end

View 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