Add project handle to decide on whether the board onboarding tour shall be shown && add data to test

pull/7148/head
Henriette Dinger 6 years ago
parent cec4a03f21
commit 86db711830
  1. 3
      app/assets/javascripts/onboarding/boards_tour.js
  2. 8
      app/assets/javascripts/onboarding/onboarding_tour.js
  3. 24
      modules/backlogs/spec/features/onboarding/backlogs_onboarding_tour_spec.rb
  4. 38
      modules/boards/spec/features/onboarding/boards_onboarding_tour_spec.rb

@ -14,9 +14,10 @@
'next .board-list--container': I18n.t('js.onboarding.steps.boards.lists'), 'next .board-list--container': I18n.t('js.onboarding.steps.boards.lists'),
'showSkip': false, 'showSkip': false,
'nextButton': {text: I18n.t('js.onboarding.buttons.next')}, 'nextButton': {text: I18n.t('js.onboarding.buttons.next')},
'containerClass': '-dark',
'timeout': function() { 'timeout': function() {
return new Promise(function(resolve) { return new Promise(function(resolve) {
waitForElement('.board-list--container', '#content', function() { waitForElement('.wp-card', '#content', function() {
resolve(); resolve();
}); });
}); });

@ -53,7 +53,7 @@
} }
// ------------------------------- Tutorial WP page ------------------------------- // ------------------------------- Tutorial WP page -------------------------------
if (currentTourPart === "startMainTour" || url.searchParams.get("start_onboarding_tour")) { if (currentTourPart === "startMainTourFromBacklogs" || url.searchParams.get("start_onboarding_tour")) {
mainTour(); mainTour();
} }
@ -114,7 +114,7 @@
} }
function taskboardTour() { function taskboardTour() {
initializeTour('startMainTour'); initializeTour('startMainTourFromBacklogs');
startTour(scrumTaskBoardTourSteps); startTour(scrumTaskBoardTourSteps);
} }
@ -124,9 +124,9 @@
waitForElement('.work-package--results-tbody', '#content', function() { waitForElement('.work-package--results-tbody', '#content', function() {
var steps; var steps;
// Check for EE edition, avaiable seed data of boards, and correct project. // Check for EE edition, available seed data of boards, and correct project.
// Then add boards to the tour, otherwise skip it. // Then add boards to the tour, otherwise skip it.
if (eeTokenAvailable && boardsDemoDataAvailable) { if (eeTokenAvailable && boardsDemoDataAvailable && currentTourPart !== 'startMainTourFromBacklogs') {
steps = wpOnboardingTourSteps.concat(boardTourSteps).concat(menuTourSteps); steps = wpOnboardingTourSteps.concat(boardTourSteps).concat(menuTourSteps);
} else { } else {
steps = wpOnboardingTourSteps.concat(menuTourSteps); steps = wpOnboardingTourSteps.concat(menuTourSteps);

@ -31,8 +31,20 @@ require 'spec_helper'
describe 'backlogs onboarding tour', js: true do describe 'backlogs onboarding tour', js: true do
let(:next_button) { find('.enjoyhint_next_btn') } let(:next_button) { find('.enjoyhint_next_btn') }
let(:user) { FactoryBot.create :admin } let(:user) { FactoryBot.create :admin }
let(:demo_project) { FactoryBot.create :project, name: 'Demo project', identifier: 'demo-project', is_public: true, enabled_module_names: %w[work_package_tracking wiki] } let(:demo_project) do
let(:project) { FactoryBot.create :project, name: 'Scrum project', identifier: 'your-scrum-project', is_public: true, enabled_module_names: %w[work_package_tracking wiki backlogs] } FactoryBot.create :project,
name: 'Demo project',
identifier: 'demo-project',
is_public: true,
enabled_module_names: %w[work_package_tracking wiki]
end
let(:project) do
FactoryBot.create :project,
name: 'Scrum project',
identifier: 'your-scrum-project',
is_public: true,
enabled_module_names: %w[work_package_tracking wiki backlogs]
end
let(:sprint) { FactoryBot.create(:version, project: project, name: 'Sprint 1') } let(:sprint) { FactoryBot.create(:version, project: project, name: 'Sprint 1') }
let(:status) { FactoryBot.create(:default_status) } let(:status) { FactoryBot.create(:default_status) }
let(:priority) { FactoryBot.create(:default_priority) } let(:priority) { FactoryBot.create(:default_priority) }
@ -91,16 +103,16 @@ describe 'backlogs onboarding tour', js: true do
expect(page).to have_text '... and select the Task board entry.' expect(page).to have_text '... and select the Task board entry.'
next_button.click next_button.click
expect(page).to have_current_path backlogs_project_sprint_taskboard_path(project.identifier, sprint.id) 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 'The Task board visualizes the progress for this sprint.'
next_button.click 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." 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."
next_button.click next_button.click
expect(page).to have_current_path project_work_packages_path(project.identifier) expect(page).to have_current_path project_work_packages_path(project.identifier)
end end
end end
end end

@ -30,15 +30,36 @@ require 'spec_helper'
describe 'boards onboarding tour', js: true do describe 'boards onboarding tour', js: true do
let(:next_button) { find('.enjoyhint_next_btn') } let(:next_button) { find('.enjoyhint_next_btn') }
let(:user) { FactoryBot.create :admin } let(:user) { FactoryBot.create :admin,
let(:demo_project) { FactoryBot.create :project, name: 'Demo project', identifier: 'demo-project', is_public: true, enabled_module_names: %w[work_package_tracking wiki] } member_in_project: demo_project,
let(:scrum_project) { FactoryBot.create :project, name: 'Scrum project', identifier: 'your-scrum-project', is_public: true, enabled_module_names: %w[work_package_tracking wiki] } member_through_role: role}
let(:permissions) { %i[show_board_views manage_board_views view_work_packages manage_public_queries] }
let(:role) { FactoryBot.create(:role, permissions: permissions) }
let(:demo_project) do
FactoryBot.create :project,
name: 'Demo project',
identifier: 'demo-project',
is_public: true,
enabled_module_names: %w[work_package_tracking wiki board_view]
end
let(:scrum_project) do
FactoryBot.create :project,
name: 'Scrum project',
identifier: 'your-scrum-project',
is_public: true,
enabled_module_names: %w[work_package_tracking wiki]
end
let!(:wp_1) { FactoryBot.create(:work_package, project: demo_project) } let!(:wp_1) { FactoryBot.create(:work_package, project: demo_project) }
let!(:wp_2) { FactoryBot.create(:work_package, project: scrum_project) } let!(:wp_2) { FactoryBot.create(:work_package, project: scrum_project) }
let!(:board_view) { FactoryBot.create :board_grid_with_query, project: demo_project, name: 'KANBAN', query: query }
let(:query) { FactoryBot.create :query, user: user, project: demo_project }
before do before do
with_enterprise_token :board_view with_enterprise_token :board_view
login_as user login_as user
::OrderedWorkPackage.create(query: query, work_package: wp_1, position: 0)
allow(Setting).to receive(:demo_projects_available).and_return(true) allow(Setting).to receive(:demo_projects_available).and_return(true)
allow(Setting).to receive(:boards_demo_data_available).and_return(true) allow(Setting).to receive(:boards_demo_data_available).and_return(true)
end end
@ -59,19 +80,22 @@ describe 'boards onboarding tour', js: true do
expect(page).to have_text 'Manage your work within an intuitive Boards view.' expect(page).to have_text 'Manage your work within an intuitive Boards view.'
next_button.click next_button.click
expect(page).to have_text 'You can create multiple lists (columns) within one Board view, e.g. to create a KANBAN board.' expect(page)
.to have_text 'You can create multiple lists (columns) within one Board view, e.g. to create a KANBAN board.'
next_button.click next_button.click
expect(page).to have_text 'Click the + will add a new card to the list within a Board.' expect(page).to have_text 'Click the + will add a new card to the list within a Board.'
next_button.click next_button.click
expect(page).to have_text 'Drag & Drop your cards within a list to re-order, or the another list. A double click will open the details view.' expect(page)
.to have_text 'Drag & Drop your cards within a list to re-order, or the another list. A double click will open the details view.'
step_through_onboarding_main_menu_tour step_through_onboarding_main_menu_tour
end end
it "I don't see the board onboarding tour in the scrum project" do it "I don't 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 # Set the tour parameter so that we can start on the wp page
visit "/projects/#{scrum_project.identifier}/work_packages?start_onboarding_tour=true" visit "/projects/#{scrum_project.identifier}/work_packages?start_onboarding_tour=true"
@ -80,5 +104,3 @@ describe 'boards onboarding tour', js: true do
end end
end end
end end

Loading…
Cancel
Save