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

Fix specs

Oliver Günther18574696f5d8
diff --git a/app/components/enterprise_edition/banner_component.rb b/app/components/enterprise_edition/banner_component.rb
index 45424221e25..0ad9914b4d5 100644
--- a/app/components/enterprise_edition/banner_component.rb
+++ b/app/components/enterprise_edition/banner_component.rb
@@ -51,7 +51,8 @@ module EnterpriseEdition
@system_arguments = system_arguments
@system_arguments[:tag] = :div
@system_arguments[:mb] ||= 2
- @system_arguments[:test_selector] = "op-enterprise-banner-#{feature_key.to_s.tr('_', '-')}"
+ @system_arguments[:id] = "op-enterprise-banner-#{feature_key.to_s.tr('_', '-')}"
+ @system_arguments[:test_selector] = "op-enterprise-banner"
super
self.feature_key = feature_key
diff --git a/app/components/enterprise_edition/upsale_page_component.html.erb b/app/components/enterprise_edition/upsale_page_component.html.erb
index 7bcde81f8ff..4b578b81528 100644
--- a/app/components/enterprise_edition/upsale_page_component.html.erb
+++ b/app/components/enterprise_edition/upsale_page_component.html.erb
@@ -3,7 +3,7 @@
<% helpers.write_trial_key_to_gon if !EnterpriseToken.current.present? %>
<% end %>
-<div class="op-enterprise-upsale-page">
+<div class="op-enterprise-upsale-page" data-test-selector="op-enterprise-upsale-page">
<%=
render(Primer::OpenProject::FlexLayout.new(justify_content: :center, align_items: :center)) do |flex|
flex.with_column do
diff --git a/app/helpers/types_helper.rb b/app/helpers/types_helper.rb
index fab6b85098d..6fc73f7bbb8 100644
--- a/app/helpers/types_helper.rb
+++ b/app/helpers/types_helper.rb
@@ -41,7 +41,7 @@ module ::TypesHelper
{
name: "form_configuration",
partial: "types/form/form_configuration",
- path: edit_tab_type_path(id: @type.id, tab: :edit_attribute_groups),
+ path: edit_tab_type_path(id: @type.id, tab: :form_configuration),
label: "types.edit.form_configuration.tab"
},
{
diff --git a/frontend/src/app/core/enterprise/banners.service.ts b/frontend/src/app/core/enterprise/banners.service.ts
index 65d4c85f6e7..4a74e35158d 100644
--- a/frontend/src/app/core/enterprise/banners.service.ts
+++ b/frontend/src/app/core/enterprise/banners.service.ts
@@ -59,7 +59,9 @@ export class BannersService {
return url.toString();
}
- public conditional(feature:string, bannersVisible?:() => void, bannersNotVisible?:() => void) {
+ public async conditional(feature:string, bannersVisible?:() => void, bannersNotVisible?:() => void) {
+ await this.configuration.initialize();
+
if (this.showBannerFor(feature)) {
this.callMaybe(bannersVisible);
} else {
diff --git a/frontend/src/app/features/admin/types/group-edit-in-place.component.ts b/frontend/src/app/features/admin/types/group-edit-in-place.component.ts
index b0267f4f974..9e9d8a575f2 100644
--- a/frontend/src/app/features/admin/types/group-edit-in-place.component.ts
+++ b/frontend/src/app/features/admin/types/group-edit-in-place.component.ts
@@ -67,11 +67,12 @@ export class GroupEditInPlaceComponent implements OnInit {
}
startEditing():void {
- this.bannerService.conditional(
- 'work_package_query_relation_columns',
+ void this.bannerService.conditional(
+ 'edit_attribute_groups',
() => this.bannerService.showEEOnlyHint(),
() => {
this.editing = true;
+ this.cdRef.detectChanges();
},
);
}
diff --git a/frontend/src/app/features/admin/types/type-form-configuration.component.ts b/frontend/src/app/features/admin/types/type-form-configuration.component.ts
index 8e79de47c1c..f185be5cfbe 100644
--- a/frontend/src/app/features/admin/types/type-form-configuration.component.ts
+++ b/frontend/src/app/features/admin/types/type-form-configuration.component.ts
@@ -181,7 +181,7 @@ export class TypeFormConfigurationComponent extends UntilDestroyedMixin implemen
}
editQuery(group:TypeGroup):void {
- this.typeBanner.conditional(
+ void this.typeBanner.conditional(
'edit_attribute_groups',
() => this.typeBanner.showEEOnlyHint(),
() => {
diff --git a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.html b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.html
index 858daed09c1..34ecc7590d0 100644
--- a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.html
@@ -1,5 +1,5 @@
<ng-container
- *ngIf="showBanners"
+ *ngIf="available"
>
<wp-custom-action
*ngFor="let action of actions; trackBy: trackByHref"
diff --git a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.ts b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.ts
index c893c59e287..653735e4bb9 100644
--- a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions.component.ts
@@ -48,7 +48,7 @@ export class WpCustomActionsComponent extends UntilDestroyedMixin implements OnI
actions:CustomActionResource[] = [];
- showBanners = this.bannersService.showBannerFor('custom_actions');
+ available = !this.bannersService.showBannerFor('custom_actions');
constructor(
readonly apiV3Service:ApiV3Service,
diff --git a/modules/auth_saml/spec/features/administration/saml_crud_spec.rb b/modules/auth_saml/spec/features/administration/saml_crud_spec.rb
index 7af47cdb36e..ee4ee1446cb 100644
--- a/modules/auth_saml/spec/features/administration/saml_crud_spec.rb
+++ b/modules/auth_saml/spec/features/administration/saml_crud_spec.rb
@@ -195,7 +195,7 @@ RSpec.describe "SAML administration CRUD",
context "without EE", without_ee: %i[sso_auth_providers] do
it "renders the upsale page" do
visit "/admin/saml/providers"
- expect(page).to have_text "SAML identity providers is an Enterprise add-on"
+ expect(page).to have_text "Available only through the Premium enterprise plan"
end
end
end
diff --git a/modules/boards/spec/features/boards_global_create_spec.rb b/modules/boards/spec/features/boards_global_create_spec.rb
index 8b51a1df3e8..3bdcc098d23 100644
--- a/modules/boards/spec/features/boards_global_create_spec.rb
+++ b/modules/boards/spec/features/boards_global_create_spec.rb
@@ -6,7 +6,6 @@ require_relative "support/board_new_page"
RSpec.describe "Boards",
"Creating a view from a Global Context",
:js,
- :selenium,
with_ee: %i[board_view] do
shared_let(:project) { create(:project, enabled_module_names: %i[work_package_tracking board_view]) }
shared_let(:other_project) { create(:project, enabled_module_names: %i[work_package_tracking board_view]) }
diff --git a/modules/grids/spec/support/pages/grid.rb b/modules/grids/spec/support/pages/grid.rb
index ae40b50d0be..6d36327ea60 100644
--- a/modules/grids/spec/support/pages/grid.rb
+++ b/modules/grids/spec/support/pages/grid.rb
@@ -56,11 +56,8 @@ module Pages
def expect_add_widget_enterprise_edition_notice(row_number, column_number, location)
within_add_widget_modal(row_number, column_number, location) do
- expect(page)
- .to have_content(I18n.t("js.grid.add_widget"))
-
- expect(page)
- .to have_css(".op-toast.-ee-upsale", text: I18n.t("js.upsale.ee_only"))
+ expect(page).to have_content(I18n.t("js.grid.add_widget"))
+ expect(page).to have_text "Available only through the Basic enterprise plan"
end
end
diff --git a/modules/ldap_groups/spec/features/administration_spec.rb b/modules/ldap_groups/spec/features/administration_spec.rb
index 0f5b5eb6f70..dd684cc2d57 100644
--- a/modules/ldap_groups/spec/features/administration_spec.rb
+++ b/modules/ldap_groups/spec/features/administration_spec.rb
@@ -10,7 +10,8 @@ RSpec.describe "LDAP group sync administration spec", :js do
context "without EE" do
it "shows upsale" do
- expect(page).to have_css(".upsale-notification")
+ expect(page).to have_enterprise_upsale_page
+ expect(page).to have_text "Available only through the Premium enterprise plan"
end
end
@@ -19,8 +20,7 @@ RSpec.describe "LDAP group sync administration spec", :js do
let!(:auth_source) { create(:ldap_auth_source, name: "ldap") }
it "allows synced group administration flow" do
- expect(page).to have_no_css(".upsale-notification")
-
+ expect(page).not_to have_enterprise_upsale_page
# Open create menu
page.find_test_selector("op-admin-synchronized-groups--button-new", text: I18n.t(:button_add)).click
# Create group
diff --git a/modules/openid_connect/spec/features/administration/oidc_custom_crud_spec.rb b/modules/openid_connect/spec/features/administration/oidc_custom_crud_spec.rb
index 9b5a5608986..b7a549f9446 100644
--- a/modules/openid_connect/spec/features/administration/oidc_custom_crud_spec.rb
+++ b/modules/openid_connect/spec/features/administration/oidc_custom_crud_spec.rb
@@ -175,7 +175,8 @@ RSpec.describe "OIDC administration CRUD",
context "without EE", without_ee: %i[sso_auth_providers] do
it "renders the upsale page" do
visit "/admin/openid_connect/providers"
- expect(page).to have_text "OpenID providers is an Enterprise add-on"
+ expect(page).to have_enterprise_banner
+ expect(page).to have_text "Available only through the Premium enterprise plan"
end
end
end
diff --git a/spec/components/enterprise_edition/banner_component_spec.rb b/spec/components/enterprise_edition/banner_component_spec.rb
index 03e5621cc33..621d6bb3755 100644
--- a/spec/components/enterprise_edition/banner_component_spec.rb
+++ b/spec/components/enterprise_edition/banner_component_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe EnterpriseEdition::BannerComponent, type: :component do
let(:description) { "Some description" }
let(:expected_description) { description }
let(:href) { "https://www.example.org" }
- let(:component_test_selector) { "op-enterprise-banner-some-enterprise-feature" }
+ let(:component_test_selector) { "op-enterprise-banner" }
let(:features) { nil }
let(:enforce_available_locales) { I18n.config.enforce_available_locales }
let(:i18n_upsale) do
@@ -245,13 +245,22 @@ RSpec.describe EnterpriseEdition::BannerComponent, type: :component do
let(:static_links) do
{
enterprise_features: {
+ default: {
+ href: "https://example.com"
+ },
some_enterprise_feature: {}
}
}
end
- it "raises an error" do
- expect { render_component_in_mo }.to raise_error(RuntimeError)
+ it "uses the default" do
+ render_component_in_mo
+
+ component = find_test_selector(component_test_selector)
+
+ expect(component).to have_text(expected_title)
+ expect(component).to have_text(expected_description)
+ expect(component).to have_link("More information", href: "https://example.com")
end
end
end
diff --git a/spec/components/work_packages/types/subject_configuration_component_spec.rb b/spec/components/work_packages/types/subject_configuration_component_spec.rb
index 6ce0a382039..f4db7176f78 100644
--- a/spec/components/work_packages/types/subject_configuration_component_spec.rb
+++ b/spec/components/work_packages/types/subject_configuration_component_spec.rb
@@ -109,7 +109,7 @@ RSpec.describe WorkPackages::Types::SubjectConfigurationComponent, type: :compon
it "shows the enterprise banner" do
render_component
- expect(page).to have_test_selector("op-enterprise-banner-work-package-subject-generation")
+ expect(page).to have_enterprise_banner
end
it "disables only automatic mode selector", :aggregate_failures do
@@ -125,7 +125,7 @@ RSpec.describe WorkPackages::Types::SubjectConfigurationComponent, type: :compon
it "shows the enterprise banner" do
render_component
- expect(page).to have_test_selector("op-enterprise-banner-work-package-subject-generation")
+ expect(page).to have_enterprise_banner
end
it "enables mode selectors", :aggregate_failures do
diff --git a/spec/features/custom_styles/tabs_navigation_spec.rb b/spec/features/custom_styles/tabs_navigation_spec.rb
index 40dc6ea58ba..007e1daa509 100644
--- a/spec/features/custom_styles/tabs_navigation_spec.rb
+++ b/spec/features/custom_styles/tabs_navigation_spec.rb
@@ -38,7 +38,8 @@ RSpec.describe "Tabs navigation and content switching on the admin/design page"
end
it "redirects to upsale page" do
- expect(page).to have_css(".upsale-notification")
+ expect(page).to have_enterprise_upsale_page
+ expect(page).to have_text "Available only through the Basic enterprise plan"
end
end
diff --git a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
index 1aa2c64900a..729c4e2cbc9 100644
--- a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
@@ -195,11 +195,15 @@ RSpec.describe "Notification center date alerts", :js, with_settings: { journal_
side_menu.click_item "Date alert"
expect(page).to have_current_path(/notifications\/date_alerts/)
- expect(page).to have_text "Date alerts is an Enterprise"
- expect(page).to have_text "Please upgrade to a paid plan "
+ expect(page).to have_enterprise_upsale_page
+ expect(page).to have_text "Available only through the Basic enterprise plan"
# It does not allows direct url access
visit notifications_center_path(filter: "reason", name: "dateAlert")
+
+ expect(page).to have_current_path(/notifications\/date_alerts/)
+ expect(page).to have_enterprise_upsale_page
+ expect(page).to have_text "Available only through the Basic enterprise plan"
end
end
diff --git a/spec/support/matchers/has_enterprise_upsale_page.rb b/spec/support/matchers/has_enterprise_upsale_page.rb
new file mode 100644
index 00000000000..540cc1f50d4
--- /dev/null
+++ b/spec/support/matchers/has_enterprise_upsale_page.rb
@@ -0,0 +1,49 @@
+# 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.
+#++
+
+RSpec::Matchers.define :have_enterprise_upsale_page do |**args|
+ include TestSelectorFinders
+
+ match do |page|
+ page.has_selector?(test_selector("op-enterprise-upsale-page"), **args)
+ end
+
+ match_when_negated do |page|
+ page.has_no_selector?(test_selector("op-enterprise-upsale-page"), **args)
+ end
+
+ failure_message do
+ "expected page to have Enterprise upsale page"
+ end
+
+ failure_message_when_negated do
+ "expected page not to have Enterprise upsale page"
+ end
+end