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 basic test for the team planner onboarding tour (wip as it is still failing)
Henriette Darge6e409089a572
diff --git a/frontend/src/app/core/setup/globals/onboarding/onboarding_tour.ts b/frontend/src/app/core/setup/globals/onboarding/onboarding_tour.tsindex 9cfb2c37f49..c2419b08257 100644--- a/frontend/src/app/core/setup/globals/onboarding/onboarding_tour.ts+++ b/frontend/src/app/core/setup/globals/onboarding/onboarding_tour.ts@@ -70,7 +70,7 @@ function startTour(steps:OnboardingStep[]) {}function moduleVisible(name:string):boolean {- return document.getElementsByClassName(`.${name}-view-menu-item`).length > 0+ return document.getElementsByClassName(`${name}-view-menu-item`).length > 0;}function mainTour() {diff --git a/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb b/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rbnew file mode 100644index 00000000000..8274225a84f--- /dev/null+++ b/modules/team_planner/spec/features/onboarding/team_planner_onboarding_tour_spec.rb@@ -0,0 +1,100 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2022 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'+require_relative './../../support/onboarding/onboarding_steps'++describe 'team planner onboarding tour', js: true do+ let(:next_button) { find('.enjoyhint_next_btn') }+ let(:user) { create :admin }++ let(:demo_project) do+ create :project,+ name: 'Demo project',+ identifier: 'demo-project',+ public: true,+ enabled_module_names: %w[work_package_tracking wiki team_planner_view]+ end+ let(:scrum_project) do+ create :project,+ name: 'Scrum project',+ identifier: 'your-scrum-project',+ public: true,+ enabled_module_names: %w[work_package_tracking wiki]+ end+ let!(:wp_1) do+ create(:work_package,+ project: demo_project,+ assigned_to: user,+ start_date: Date.today,+ due_date: Date.today)+ end+ let!(:wp_2) { create(:work_package, project: scrum_project) }++ let(:query) { create :query, user: user, project: demo_project, public: true, name: 'Team planner' }+ let(:team_plan) { create :view_team_planner, query: query }++ before do+ team_plan+ with_enterprise_token :team_planner_view+ login_as user++ allow(Setting).to receive(:demo_projects_available).and_return(true)+ allow(Setting).to receive(:team_planner_demo_data_available).and_return(true)+ end++ after do+ # Clear session to avoid that the onboarding tour starts+ page.execute_script("window.sessionStorage.clear();")+ end++ context 'as a new user' do+ it 'I see the board onboarding tour in the demo project' do+ # Set the tour parameter so that we can start on the wp page+ visit "/projects/#{demo_project.identifier}/work_packages?start_onboarding_tour=true"++ step_through_onboarding_wp_tour demo_project, wp_1++ step_through_onboarding_team_planner_tour++ step_through_onboarding_main_menu_tour has_full_capabilities: true+ end++ it "I do not see the board onboarding tour in the scrum project" do+ # Set sessionStorage value so that the tour knows that it is in the scum tour+ page.execute_script("window.sessionStorage.setItem('openProject-onboardingTour', 'startMainTourFromBacklogs');")++ # Set the tour parameter so that we can start on the wp page+ visit "/projects/#{scrum_project.identifier}/work_packages?start_onboarding_tour=true"++ step_through_onboarding_wp_tour scrum_project, wp_2++ step_through_onboarding_main_menu_tour has_full_capabilities: true+ end+ end+enddiff --git a/modules/team_planner/spec/support/onboarding/onboarding_steps.rb b/modules/team_planner/spec/support/onboarding/onboarding_steps.rbnew file mode 100644index 00000000000..51b30287c3d--- /dev/null+++ b/modules/team_planner/spec/support/onboarding/onboarding_steps.rb@@ -0,0 +1,54 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2022 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.+#++++module OnboardingSteps+ def step_through_onboarding_team_planner_tour+ next_button.click+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.team_planner.overview')), normalize_ws: true++ next_button.click+ expect(page)+ .to have_text sanitize_string(I18n.t('js.onboarding.steps.team_planner.calendar')), normalize_ws: true++ next_button.click+ expect(page)+ .to have_text sanitize_string(I18n.t('js.onboarding.steps.team_planner.add_assignee')), normalize_ws: true++ next_button.click+ expect(page)+ .to have_text sanitize_string(I18n.t('js.onboarding.steps.team_planner.add_existing')), normalize_ws: true++ next_button.click+ expect(page)+ .to have_text sanitize_string(I18n.t('js.onboarding.steps.team_planner.card')), normalize_ws: true+ end+end++RSpec.configure do |config|+ config.include OnboardingSteps+end