OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add feature tests for automatic theme switcher
Kabiru Mwenjac38c87ec9b36
diff --git a/spec/features/my/interface_spec.rb b/spec/features/my/interface_spec.rbnew file mode 100644index 00000000000..03980411247--- /dev/null+++ b/spec/features/my/interface_spec.rb@@ -0,0 +1,73 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "spec_helper"++RSpec.describe "My account Interface settings",+ :js, :selenium do+ let(:user) { create(:user) }++ before do+ login_as(user)+ visit my_account_path+ end++ it "allows the user to specify their preferred colour mode" do+ click_on "Interface"++ select "Light", from: "Colour mode"+ click_on "Update look and feel"++ expect(page).to have_css("body[data-color-mode='light'][data-light-theme='light']")++ select "Dark", from: "Colour mode"+ click_on "Update look and feel"++ expect(page).to have_css("body[data-color-mode='dark'][data-dark-theme='dark']")++ select "Automatic (match OS colour mode)", from: "Colour mode"+ click_on "Update look and feel"++ expect(page).to have_css("body[data-auto-theme-switcher-mode-value='sync_with_os']")+ end++ describe "Automatic (match OS colour mode)" do+ context "with OS in dark mode", driver: :chrome_dark_mode do+ it "syncs with OS colour mode" do+ click_on "Interface"++ select "Dark", from: "Colour mode"+ click_on "Update look and feel"++ expect(page).to have_css("body[data-color-mode='dark'][data-dark-theme='dark']")+ end+ end+ end+enddiff --git a/spec/support/browsers/chrome.rb b/spec/support/browsers/chrome.rbindex c41a248cce1..81d169f65cd 100644--- a/spec/support/browsers/chrome.rb+++ b/spec/support/browsers/chrome.rb@@ -130,3 +130,7 @@ register_chrome "en", name: :chrome_revit_add_in do |options|endregister_chrome "en", name: :chrome_new_york_time_zone, override_time_zone: "America/New_York"++register_chrome "en", name: :chrome_dark_mode do |options|+ options.add_argument("--force-dark-mode")+end