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

Add test case for users who lack permission to see certain tour parts && User localised strings in tests, too

Henriette Darge25fd8542e388
diff --git a/modules/backlogs/spec/features/onboarding/backlogs_onboarding_tour_spec.rb b/modules/backlogs/spec/features/onboarding/backlogs_onboarding_tour_spec.rb
index b9cccd4c13c..3d86816fc0c 100644
--- a/modules/backlogs/spec/features/onboarding/backlogs_onboarding_tour_spec.rb
+++ b/modules/backlogs/spec/features/onboarding/backlogs_onboarding_tour_spec.rb
@@ -78,7 +78,6 @@ describe 'backlogs onboarding tour', js: true do
end
before do
- login_as user
allow(Setting).to receive(:demo_projects_available).and_return(true)
allow(Setting).to receive(:plugin_openproject_backlogs).and_return('story_types' => [story_type.id.to_s],
'task_type' => task_type.id.to_s)
@@ -89,27 +88,54 @@ describe 'backlogs onboarding tour', js: true do
page.execute_script("window.sessionStorage.clear();")
end
- context 'as a new user' do
+ context 'as a new user who is allowed to see the backlogs plugin' do
+ before do
+ login_as user
+ end
+
it 'I see a part of the onboarding tour in the backlogs section' do
# Set the tour parameter so that we can start on the overview page
- visit "/projects/#{project.identifier}/backlogs/?start_scrum_onboarding_tour=true"
- expect(page).to have_text 'Manage your work in the backlogs view.'
+ visit "/projects/#{project.identifier}?start_scrum_onboarding_tour=true"
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.backlogs.overview')), normalize_ws: true
+
+ next_button.click
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.backlogs.sprints')), normalize_ws: true
next_button.click
- expect(page).to have_text 'To see your task board, open the sprint drop-down...'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.backlogs.task_board_arrow')), normalize_ws: true
next_button.click
expect(page).to have_selector('.backlog .items', visible: true)
- expect(page).to have_text '...and select the task board entry.'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.backlogs.task_board_select')), normalize_ws: true
next_button.click
expect(page)
.to have_current_path backlogs_project_sprint_taskboard_path(project.identifier, sprint.id)
- expect(page).to have_text 'The task board visualizes the progress for this sprint.'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.backlogs.task_board')), normalize_ws: true
next_button.click
expect(page)
- .to have_text "Now let's have a look at the work package section, which gives you a more detailed view of your work."
+ .to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.toggler')), normalize_ws: true
+
+ next_button.click
+ expect(page).to have_current_path project_work_packages_path(project.identifier)
+ end
+ end
+
+ context 'as a new user who is not allowed to see the backlogs plugin' do
+ # necessary to be able to see public projects
+ let!(:non_member_role) { FactoryBot.create :non_member, permissions: [:view_work_packages] }
+ let(:non_member_user) { FactoryBot.create :user }
+
+ before do
+ login_as non_member_user
+ end
+
+ it 'skips the backlogs tour and continues directly with the WP tour' do
+ # Set the tour parameter so that we can start on the overview page
+ visit "/projects/#{project.identifier}?start_scrum_onboarding_tour=true"
+ expect(page)
+ .to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.toggler')), normalize_ws: true
next_button.click
expect(page).to have_current_path project_work_packages_path(project.identifier)
diff --git a/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb b/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb
index a713d6d7dca..010e16b239e 100644
--- a/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb
+++ b/modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb
@@ -91,7 +91,7 @@ describe 'boards onboarding tour', js: true do
step_through_onboarding_board_tour
- step_through_onboarding_main_menu_tour
+ step_through_onboarding_main_menu_tour has_full_capabilities: true
end
it "I see the board onboarding tour in the scrum project" do
@@ -105,7 +105,7 @@ describe 'boards onboarding tour', js: true do
step_through_onboarding_board_tour
- step_through_onboarding_main_menu_tour
+ step_through_onboarding_main_menu_tour has_full_capabilities: true
end
end
end
diff --git a/modules/boards/spec/features/support/onboarding_steps.rb b/modules/boards/spec/features/support/onboarding_steps.rb
index d00ea1d40ba..26a5d8e0394 100644
--- a/modules/boards/spec/features/support/onboarding_steps.rb
+++ b/modules/boards/spec/features/support/onboarding_steps.rb
@@ -29,18 +29,18 @@
module OnboardingSteps
def step_through_onboarding_board_tour
next_button.click
- expect(page).to have_text 'Select boards to shift the view and manage your project using the agile boards view.'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.boards.overview')), normalize_ws: true
next_button.click
expect(page)
- .to have_text 'Here you can create multiple lists (columns) within your board.'
+ .to have_text sanitize_string(I18n.t('js.onboarding.steps.boards.lists')), normalize_ws: true
next_button.click
- expect(page).to have_text 'Click on the plus (+) icon to create a new card'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.boards.add')), normalize_ws: true
next_button.click
expect(page)
- .to have_text 'Drag and drop your cards within a given list to reorder them, or to move them to another list.'
+ .to have_text sanitize_string(I18n.t('js.onboarding.steps.boards.drag')), normalize_ws: true
end
end
diff --git a/spec/features/onboarding/onboarding_tour_spec.rb b/spec/features/onboarding/onboarding_tour_spec.rb
index eb0be3e5686..bfe1c1e7f8a 100644
--- a/spec/features/onboarding/onboarding_tour_spec.rb
+++ b/spec/features/onboarding/onboarding_tour_spec.rb
@@ -71,7 +71,7 @@ describe 'onboarding tour for new users', js: true do
end
it 'when the welcome block does not include the demo projects' do
- expect(page).to have_no_text 'Take a three minutes introduction tour to learn the most important features.'
+ expect(page).to have_no_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
expect(page).to have_no_selector '.enjoyhint_next_btn'
end
end
@@ -94,7 +94,7 @@ describe 'onboarding tour for new users', js: true do
it 'directly after the language selection' do
# The tutorial appears
- expect(page).to have_text 'Take a three minutes introduction tour to learn the most important features.'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
expect(page).to have_selector '.enjoyhint_next_btn:not(.enjoyhint_hide)'
end
@@ -102,19 +102,19 @@ describe 'onboarding tour for new users', js: true do
find('.enjoyhint_skip_btn').click
# The tutorial disappears
- expect(page).to have_no_text 'Take a three minutes introduction tour to learn the most important features.'
+ expect(page).to have_no_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
expect(page).to have_no_selector '.enjoyhint_next_btn'
page.driver.browser.navigate.refresh
# The tutorial did not start again
- expect(page).to have_no_text 'Take a three minutes introduction tour to learn the most important features.'
+ expect(page).to have_no_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
expect(page).to have_no_selector '.enjoyhint_next_btn'
end
it 'and I continue the tutorial' do
next_button.click
- expect(page).to have_text 'Please click on one of the demo projects that we have prepared.'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.project_selection')), normalize_ws: true
# SeleniumHubWaiter.wait
find('.welcome').click_link 'Demo project'
@@ -122,8 +122,27 @@ describe 'onboarding tour for new users', js: true do
step_through_onboarding_wp_tour project, wp_1
- step_through_onboarding_main_menu_tour
+ step_through_onboarding_main_menu_tour has_full_capabilities: true
end
end
end
+
+ context 'as a new user who is not allowed to see the parts of the tour' do
+ # necessary to be able to see public projects
+ let!(:non_member_role) { FactoryBot.create :non_member, permissions: [:view_work_packages] }
+ let(:non_member_user) { FactoryBot.create :user }
+
+ before do
+ allow(Setting).to receive(:demo_projects_available).and_return(true)
+ login_as non_member_user
+ end
+
+ it 'skips these steps and continues directly' do
+ # Set the tour parameter so that we can start on the overview page
+ visit "/projects/#{project.identifier}/work_packages?start_onboarding_tour=true"
+ step_through_onboarding_wp_tour project, wp_1
+
+ step_through_onboarding_main_menu_tour has_full_capabilities: false
+ end
+ end
end
diff --git a/spec/support/onboarding_helper.rb b/spec/support/onboarding_helper.rb
index 15e6bb4f9b1..f1f23b9550f 100644
--- a/spec/support/onboarding_helper.rb
+++ b/spec/support/onboarding_helper.rb
@@ -31,44 +31,50 @@ require 'spec_helper'
module OnboardingHelper
def step_through_onboarding_wp_tour(project, wp)
expect(page).not_to have_selector('.loading-indicator')
- expect(page).to have_text 'This work package overview provides a list of all the work in your project'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.list')), normalize_ws: true
next_button.click
expect(page).to have_current_path project_work_package_path(project, wp.id, 'activity')
- expect(page).to have_text 'The work package details view provides all the relevant information'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.full_view')), normalize_ws: true
next_button.click
- expect(page).to have_text 'Use the return arrow in the top left corner to exit and return to the work package list'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.back_button')), normalize_ws: true
next_button.click
- expect(page).to have_text 'The + Create button will add a new work package to your project'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.create_button')), normalize_ws: true
next_button.click
- expect(page).to have_text 'You can activate the Gantt chart view to create a timeline for your project.'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.timeline_button')), normalize_ws: true
next_button.click
- expect(page).to have_text 'Here you can edit your project plan'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.timeline')), normalize_ws: true
next_button.click
- expect(page).to have_text 'Use the return arrow in the top left corner to return to the project’s main menu'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.sidebar_arrow')), normalize_ws: true
end
- def step_through_onboarding_main_menu_tour
- next_button.click
- expect(page).to have_text 'Invite new members to join your project.'
+ def step_through_onboarding_main_menu_tour(has_full_capabilities:)
+ if has_full_capabilities
+ next_button.click
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.members')), normalize_ws: true
- next_button.click
- expect(page).to have_text 'Within the wiki you can document and share knowledge together with your team.'
+ next_button.click
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.wiki')), normalize_ws: true
- next_button.click
- expect(page).to have_text 'Click on the plus (+) icon in the header navigation to create a new project or to invite coworkers.'
+ next_button.click
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.quick_add_button')), normalize_ws: true
+ end
next_button.click
- expect(page).to have_text 'The Help (?) menu provides additional help resources.'
+ expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.help_menu')), normalize_ws: true
next_button.click
expect(page).not_to have_selector '.enjoy_hint_label'
end
+
+ def sanitize_string(string)
+ Sanitize.clean(string).squish
+ end
end
RSpec.configure do |config|