Merge pull request #10320 from opf/feature/41050-Add-team-planner-to-onboarding-tour
[41050] Add team planner to onboarding tourpull/10361/head
commit
6051dd31af
@ -0,0 +1,52 @@ |
|||||||
|
import { waitForElement } from 'core-app/core/setup/globals/onboarding/helpers'; |
||||||
|
import { OnboardingStep } from 'core-app/core/setup/globals/onboarding/onboarding_tour'; |
||||||
|
|
||||||
|
export function teamPlannerTourSteps():OnboardingStep[] { |
||||||
|
return [ |
||||||
|
{ |
||||||
|
'next .team-planner-view-menu-item': I18n.t('js.onboarding.steps.team_planner.overview'), |
||||||
|
showSkip: false, |
||||||
|
nextButton: { text: I18n.t('js.onboarding.buttons.next') }, |
||||||
|
onNext() { |
||||||
|
jQuery('.team-planner-view-menu-item ~ .toggler')[0].click(); |
||||||
|
waitForElement('.op-sidemenu--items', '#main-menu', () => { |
||||||
|
jQuery(".op-sidemenu--item-action:contains('Team planner')")[0].click(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
'next [data-qa-selector="op-team-planner--calendar-pane"]': I18n.t('js.onboarding.steps.team_planner.calendar'), |
||||||
|
showSkip: false, |
||||||
|
nextButton: { text: I18n.t('js.onboarding.buttons.next') }, |
||||||
|
containerClass: '-dark -hidden-arrow', |
||||||
|
timeout: () => new Promise((resolve) => { |
||||||
|
waitForElement('.op-wp-single-card', '#content', () => { |
||||||
|
resolve(undefined); |
||||||
|
}); |
||||||
|
}), |
||||||
|
}, |
||||||
|
{ |
||||||
|
'next [data-qa-selector="tp-assignee-add-button"]': I18n.t('js.onboarding.steps.team_planner.add_assignee'), |
||||||
|
showSkip: false, |
||||||
|
nextButton: { text: I18n.t('js.onboarding.buttons.next') }, |
||||||
|
}, |
||||||
|
{ |
||||||
|
'next [data-qa-selector="op-team-planner--add-existing-toggle"]': I18n.t('js.onboarding.steps.team_planner.add_existing'), |
||||||
|
showSkip: false, |
||||||
|
nextButton: { text: I18n.t('js.onboarding.buttons.next') }, |
||||||
|
}, |
||||||
|
{ |
||||||
|
'next [data-qa-selector="op-wp-single-card"]': I18n.t('js.onboarding.steps.team_planner.card'), |
||||||
|
showSkip: false, |
||||||
|
nextButton: { text: I18n.t('js.onboarding.buttons.next') }, |
||||||
|
onNext() { |
||||||
|
const backArrows = Array.from(document.getElementsByClassName('main-menu--arrow-left-to-project')); |
||||||
|
const teamPlannerBackArrow = backArrows.find((backArrow) => (backArrow.nextElementSibling as HTMLElement).innerText === 'Team planners') as HTMLElement; |
||||||
|
|
||||||
|
if (teamPlannerBackArrow) { |
||||||
|
teamPlannerBackArrow.click(); |
||||||
|
} |
||||||
|
}, |
||||||
|
}, |
||||||
|
]; |
||||||
|
} |
@ -0,0 +1,113 @@ |
|||||||
|
#-- 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(: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(:user) do |
||||||
|
create :admin, |
||||||
|
member_in_project: demo_project, |
||||||
|
member_with_permissions: %w[view_work_packages edit_work_packages add_work_packages |
||||||
|
view_team_planner manage_team_planner save_queries manage_public_queries |
||||||
|
work_package_assigned] |
||||||
|
end |
||||||
|
|
||||||
|
let!(:wp1) do |
||||||
|
create(:work_package, |
||||||
|
project: demo_project, |
||||||
|
assigned_to: user, |
||||||
|
start_date: Time.zone.today, |
||||||
|
due_date: Time.zone.today) |
||||||
|
end |
||||||
|
let!(:wp2) { create(:work_package, project: scrum_project) } |
||||||
|
|
||||||
|
let(:query) { create :query, user: user, project: demo_project, public: true, name: 'Team planner' } |
||||||
|
let(:team_plan) do |
||||||
|
create :view_team_planner, |
||||||
|
query: query, |
||||||
|
assignees: [user], |
||||||
|
projects: [demo_project, scrum_project] |
||||||
|
end |
||||||
|
|
||||||
|
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(:demo_view_of_type_team_planner_seeded).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 team planner 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, wp1 |
||||||
|
|
||||||
|
step_through_onboarding_team_planner_tour |
||||||
|
|
||||||
|
step_through_onboarding_main_menu_tour has_full_capabilities: true |
||||||
|
end |
||||||
|
|
||||||
|
it "I do not see the team planner 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, wp2 |
||||||
|
|
||||||
|
step_through_onboarding_main_menu_tour has_full_capabilities: true |
||||||
|
end |
||||||
|
end |
||||||
|
end |
@ -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, wait: 5 |
||||||
|
|
||||||
|
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 |
@ -0,0 +1,53 @@ |
|||||||
|
#-- 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. |
||||||
|
#++ |
||||||
|
|
||||||
|
FactoryBot.define do |
||||||
|
factory :view_team_planner, parent: :view do |
||||||
|
type { 'team_planner' } |
||||||
|
transient do |
||||||
|
assignees { [] } |
||||||
|
projects { [] } |
||||||
|
end |
||||||
|
|
||||||
|
callback(:after_create) do |view, evaluator| |
||||||
|
query = view.query |
||||||
|
|
||||||
|
if evaluator.assignees.any? |
||||||
|
query.add_filter('assigned_to_id', '=', evaluator.assignees.map(&:id).uniq) |
||||||
|
end |
||||||
|
|
||||||
|
if evaluator.projects.any? |
||||||
|
query.add_filter('project_id', '=', ([query.project.id] + evaluator.projects.map(&:id)).uniq) |
||||||
|
end |
||||||
|
|
||||||
|
User.system.run_given do |
||||||
|
query.save! |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue