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
write a feature spec and remove unnecessary tests
Behrokh Satarnejad72c12f597b04
diff --git a/app/views/custom_styles/_interface.html.erb b/app/views/custom_styles/_interface.html.erbindex b21d2dda7d2..b05d497c71d 100644--- a/app/views/custom_styles/_interface.html.erb+++ b/app/views/custom_styles/_interface.html.erb@@ -28,7 +28,7 @@</div></div><% end %>- <button type="submit" class="button -hide-when-collapsed"><%= I18n.t(:button_save) %></button>+ <button type="submit" class="button -hide-when-collapsed" data-test-selector="update-interface-colors"><%= I18n.t(:button_save) %></button></fieldset></section><%# Fill in the computed css variables in the inputs as their defaults %>diff --git a/app/views/custom_styles/_pdf_export_styles.html.erb b/app/views/custom_styles/_pdf_export_styles.html.erbindex 1e0e11c3216..f81c03ff0f4 100644--- a/app/views/custom_styles/_pdf_export_styles.html.erb+++ b/app/views/custom_styles/_pdf_export_styles.html.erb@@ -116,7 +116,7 @@ See COPYRIGHT and LICENSE files for more details.<% end %></div></div>- <button type="submit" class="button -hide-when-collapsed"><%= I18n.t(:button_save) %></button>+ <button type="submit" class="button -hide-when-collapsed" data-test-selector="text-color-change"><%= I18n.t(:button_save) %></button></fieldset></section><% end %>diff --git a/app/views/custom_styles/show.html.erb b/app/views/custom_styles/show.html.erbindex 26f6f94a331..764c5e2ebff 100644--- a/app/views/custom_styles/show.html.erb+++ b/app/views/custom_styles/show.html.erb@@ -30,11 +30,10 @@ See COPYRIGHT and LICENSE files for more details.<% tabs = design_tabs %><%=render(Admin::DesignHeaderComponent.new(- tabs: tabs,+ tabs: design_tabs,))%>-<%= error_messages_for 'custom_style' %><%= form_tag update_design_themes_path, method: :post, class: "form" do %><section class="form--section">@@ -49,7 +48,7 @@ See COPYRIGHT and LICENSE files for more details.</div><%= styled_button_tag t(:button_save),- data:({ confirm: t('admin.custom_styles.theme_warning') } unless @current_theme.present?) %>+ data: { test_selector: "change-color-theme-button", confirm: (t('admin.custom_styles.theme_warning') unless @current_theme.present?)} %></fieldset></section><% end %>diff --git a/spec/features/custom_styles/tabs_spec.rb b/spec/features/custom_styles/tabs_spec.rbnew file mode 100644index 00000000000..cdf7c921f33--- /dev/null+++ b/spec/features/custom_styles/tabs_spec.rb@@ -0,0 +1,101 @@+#-- 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 "interface tab" do+ shared_let(:admin) { create(:admin) }++ context "without EE token", with_ee: false do+ before do+ login_as(admin)+ visit custom_style_path(tab: "interface")+ end++ it "redirects to upsale page" do+ expect(page).to have_css(".upsale-notification")+ end+ end++ context "with EE token", with_ee: %i[define_custom_style] do+ before do+ login_as(admin)+ visit custom_style_path(tab: "interface")+ end++ it "doesn't show an upload button" do+ expect(page).to have_current_path(custom_style_path tab:'interface')+ expect(page).not_to have_text "Upload"+ end++ it "doesn't show a replace button" do+ expect(page).not_to have_text "Replace"+ end++ it "shows interface colours" do+ expect(page).to have_text I18n.t(:label_interface_colours)+ end++ it "selects a color theme" do+ select("OpenProject Light", from: "theme")+ find("[data-test-selector='change-color-theme-button']").click+ expect(page).to have_css(".op-toast.-success", text: I18n.t(:notice_successful_update))+ end++ it "changes accent color" do+ fill_in "design_colors[]accent-color", with: "#333333"+ find("[data-test-selector='update-interface-colors']").click+ expect(page).to have_css("#design_colors_accent-color", value: "#333333")+ end++ it "redirects to branding tab" do+ click_on "Branding"+ expect(page).to have_current_path(custom_style_path tab:'branding')++ select("OpenProject Dark", from: "theme")+ find("[data-test-selector='change-color-theme-button']").click+ expect(page).to have_css(".op-toast.-success", text: I18n.t(:notice_successful_update))+ expect(page).to have_current_path(custom_style_path tab:'branding')+ end++ it "redirects to pdf export styles tab" do+ click_on "PDF export styles"+ expect(page).to have_current_path(custom_style_path tab:'pdf_export_styles')++ select("OpenProject", from: "theme")+ find("[data-test-selector='change-color-theme-button']").click+ expect(page).to have_css(".op-toast.-success", text: I18n.t(:notice_successful_update))+ expect(page).to have_current_path(custom_style_path tab:'pdf_export_styles')++ fill_in "export_cover_text_color", with: "#333"+ find("[data-test-selector='text-color-change']").click+ expect(page).to have_css("#export_cover_text_color", value: "#333")+ expect(page).to have_current_path(custom_style_path tab:'pdf_export_styles')+ end+ end+enddiff --git a/spec/views/custom_styles/branding.html.erb_spec.rb b/spec/views/custom_styles/branding.html.erb_spec.rbdeleted file mode 100644index 00318c2a37d..00000000000--- a/spec/views/custom_styles/branding.html.erb_spec.rb+++ /dev/null@@ -1,60 +0,0 @@-#-- 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 "custom_styles/branding" do- shared_let(:admin) { create(:admin) }-- before do- login_as admin- end-- context "no custom logo yet" do- before do- assign(:custom_style, CustomStyle.new)- allow(view).to receive(:options_for_select).and_return("")- render- end-- it "shows an upload button" do- expect(rendered).to include "Upload"- end- end- context "with existing custom logo" do- before do- assign(:custom_style, build(:custom_style_with_logo))- allow(view).to receive(:options_for_select).and_return("")- render- end-- it "shows a replace button" do- expect(rendered).to include "Replace"- end- end-enddiff --git a/spec/views/custom_styles/pdf_export_styles.html.erb_spec.rb b/spec/views/custom_styles/pdf_export_styles.html.erb_spec.rbdeleted file mode 100644index 71218c07573..00000000000--- a/spec/views/custom_styles/pdf_export_styles.html.erb_spec.rb+++ /dev/null@@ -1,61 +0,0 @@-#-- 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 "custom_styles/pdf_export_styles" do- shared_let(:admin) { create(:admin) }-- before do- login_as admin- end-- context "no custom logo yet" do- before do- assign(:custom_style, CustomStyle.new)- allow(view).to receive(:options_for_select).and_return("")- render- end-- it "shows an upload button" do- expect(rendered).to include "Upload"- expect(rendered).to have_text I18n.t(:label_custom_export_cover_overlay)- end- end- context "with existing custom logo" do- before do- assign(:custom_style, build(:custom_style_with_export_logo))- allow(view).to receive(:options_for_select).and_return("")- render- end-- it "shows a replace button" do- expect(rendered).to include "Replace"- end- end-enddiff --git a/spec/views/custom_styles/show.html.erb_spec.rb b/spec/views/custom_styles/show.html.erb_spec.rbdeleted file mode 100644index ad071476c82..00000000000--- a/spec/views/custom_styles/show.html.erb_spec.rb+++ /dev/null@@ -1,56 +0,0 @@-#-- 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 "custom_styles/show" do- let(:user) { build(:admin) }-- before do- login_as user- allow(view).to receive(:options_for_select).and_return("")- render- end-- context "interface tab" do- before do- allow(view).to receive(:options_for_select).and_return("")- render- end-- it "doesn't show an upload button" do- expect(rendered).not_to include "Upload"- end- it "doesn't show a replace button" do- expect(rendered).not_to include "Replace"- end- it "shows advanced settings" do- expect(rendered).to have_text I18n.t(:label_interface_colours)- end- end-end