From ca336222164c37e68abeb97f26d11c8c815d6f1b Mon Sep 17 00:00:00 2001 From: Natalie Tay Date: Thu, 10 Nov 2022 21:00:12 +0800 Subject: [PATCH] DEV: Add category page object for plugin tests (#18971) Add category page object for plugin tests --- spec/system/page_objects/pages/category.rb | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 spec/system/page_objects/pages/category.rb diff --git a/spec/system/page_objects/pages/category.rb b/spec/system/page_objects/pages/category.rb new file mode 100644 index 00000000000..2acf73c835c --- /dev/null +++ b/spec/system/page_objects/pages/category.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module PageObjects + module Pages + class Category < PageObjects::Pages::Base + # keeping the various category related features combined for now + + def visit(category) + Capybara.current_session.visit("/c/#{category.id}") + self + end + + def visit_settings(category) + Capybara.current_session.visit("/c/#{category.slug}/edit/settings") + self + end + + def back_to_category + find('.edit-category-title-bar span', text: 'Back to category').click + self + end + + def save_settings + find('#save-category').click + self + end + + def toggle_setting(text) + find('.edit-category-tab label.checkbox-label', text: text).click + self + end + end + end +end