Skip to content

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

change some specs

Behrokh Satarnejad0c959a9e139a
diff --git a/app/views/custom_styles/_interface.html.erb b/app/views/custom_styles/_interface.html.erb
index b05d497c71d..b5ef9a33e78 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" data-test-selector="update-interface-colors"><%= I18n.t(:button_save) %></button>
+ <button type="submit" class="button -hide-when-collapsed" data-test-selector="interface-colors-button"><%= 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/show.html.erb b/app/views/custom_styles/show.html.erb
index 764c5e2ebff..6884e2487de 100644
--- a/app/views/custom_styles/show.html.erb
+++ b/app/views/custom_styles/show.html.erb
@@ -48,7 +48,7 @@ See COPYRIGHT and LICENSE files for more details.
</div>
<%= styled_button_tag t(:button_save),
- data: { test_selector: "change-color-theme-button", confirm: (t('admin.custom_styles.theme_warning') unless @current_theme.present?)} %>
+ data: { test_selector: "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.rb
index df7f592aa43..0548b7fe97a 100644
--- a/spec/features/custom_styles/tabs_spec.rb
+++ b/spec/features/custom_styles/tabs_spec.rb
@@ -43,56 +43,62 @@ RSpec.describe "interface tab" do
end
context "with EE token", with_ee: %i[define_custom_style] do
+ let(:custom_style) { create "custom_style_with_logo" }
+
before do
login_as(admin)
visit custom_style_path
end
- it "interface tab is selected when selecting design from menu" do
- expect(page).to have_current_path(custom_style_path tab:'interface')
- end
-
- it "shows interface colours" do
+ it "shows interface tab" do
+ expect(page).to have_current_path(custom_style_path tab: "interface")
expect(page).to have_text I18n.t(:label_interface_colours)
end
- it "selects a color theme" do
+ it "selects a color theme and redirect to the interface tab" do
select("OpenProject Light", from: "theme")
- find("[data-test-selector='change-color-theme-button']").click
+ find("[data-test-selector='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:'interface')
+ expect(page).to have_current_path(custom_style_path tab:"interface")
end
- it "changes accent color" do
+ it "changes accent color and redirects to interface tab" do
fill_in "design_colors[]accent-color", with: "#333333"
- find("[data-test-selector='update-interface-colors']").click
+ find("[data-test-selector='interface-colors-button']").click
expect(page).to have_css("#design_colors_accent-color", value: "#333333")
- expect(page).to have_current_path(custom_style_path tab:'interface')
+ expect(page).to have_current_path(custom_style_path tab: "interface")
end
it "redirects to branding tab" do
click_on "Branding"
- expect(page).to have_current_path(custom_style_path tab:'branding')
+ expect(page).to have_current_path(custom_style_path tab: "branding")
+ # select a color theme and redirect to the branding tab
select("OpenProject Dark", from: "theme")
- find("[data-test-selector='change-color-theme-button']").click
+ find("[data-test-selector='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')
+ expect(page).to have_current_path(custom_style_path tab: "branding")
+
+ # remove the logo and redirect to the branding tab
+ custom_style.send :"remove_logo"
+ 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')
+ expect(page).to have_current_path(custom_style_path tab: "pdf_export_styles")
+ # select a color theme and redirect to the PDF export styles tab
select("OpenProject", from: "theme")
- find("[data-test-selector='change-color-theme-button']").click
+ find("[data-test-selector='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')
+ expect(page).to have_current_path(custom_style_path tab: "pdf_export_styles")
+ # change export cover text color and redirect to the PDF export styles tab
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')
+ expect(page).to have_current_path(custom_style_path tab: "pdf_export_styles")
end
end
end