Fix bulk action tests && add test for switch to split/full screen from the card view

pull/7528/head
Henriette Dinger 5 years ago
parent 58024f8342
commit b9d30749f0
  1. 6
      spec/features/work_packages/bulk/copy_work_package_spec.rb
  2. 9
      spec/features/work_packages/bulk/move_work_package_spec.rb
  3. 8
      spec/features/work_packages/bulk/update_work_package_spec.rb
  4. 0
      spec/features/work_packages/select/select_query_spec.rb
  5. 0
      spec/features/work_packages/select/select_work_package_row_spec.rb
  6. 71
      spec/features/work_packages/select/select_wp_card_spec.rb
  7. 53
      spec/support/work_packages/work_package_cards.rb

@ -126,9 +126,9 @@ describe 'Copy work packages through Rails view', js: true do
context 'with permissions' do
let(:current_user) { mover }
it 'does not allow to copy' do
it 'does allow to copy' do
context_menu.open_for work_package, false
context_menu.expect_options 'Bulk copy'
context_menu.expect_options ['Bulk copy']
end
end
@ -137,7 +137,7 @@ describe 'Copy work packages through Rails view', js: true do
it 'does not allow to copy' do
context_menu.open_for work_package, false
context_menu.expect_no_options 'Bulk copy'
context_menu.expect_no_options ['Bulk copy']
end
end
end

@ -126,23 +126,24 @@ describe 'Moving a work package through Rails view', js: true do
before do
display_representation.switch_to_card_layout
loading_indicator_saveguard
find('body').send_keys [:control, 'a']
end
context 'with permissions' do
let(:current_user) { mover }
it 'does not allow to copy' do
it 'does allow to move' do
context_menu.open_for work_package, false
context_menu.expect_options 'Move'
context_menu.expect_options ['Bulk move']
end
end
context 'without permission' do
let(:current_user) { dev }
it 'does not allow to copy' do
it 'does not allow to move' do
context_menu.open_for work_package, false
context_menu.expect_no_options 'Move'
context_menu.expect_no_options ['Bulk move']
end
end
end

@ -132,18 +132,18 @@ describe 'Bulk update work packages through Rails view', js: true do
context 'with permissions' do
let(:current_user) { mover }
it 'does not allow to copy' do
it 'does allow to edit' do
context_menu.open_for work_package, false
context_menu.expect_options 'Bulk edit'
context_menu.expect_options ['Bulk edit']
end
end
context 'without permission' do
let(:current_user) { dev }
it 'does not allow to copy' do
it 'does not allow to edit' do
context_menu.open_for work_package, false
context_menu.expect_no_options 'Bulk edit'
context_menu.expect_no_options ['Bulk edit']
end
end
end

@ -0,0 +1,71 @@
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# 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-2017 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 docs/COPYRIGHT.rdoc for more details.
#++
require 'spec_helper'
describe 'Select work package card', type: :feature, js: true, selenium: true do
let(:user) { FactoryBot.create(:admin) }
let(:project) { FactoryBot.create(:project) }
let(:work_package_1) { FactoryBot.create(:work_package, project: project) }
let(:work_package_2) { FactoryBot.create(:work_package, project: project) }
let(:wp_table) { ::Pages::WorkPackagesTable.new(project) }
let(:wp_card_view) { WorkPackageCards.new(project) }
let(:display_representation) { ::Components::WorkPackages::DisplayRepresentation.new }
before do
login_as(user)
work_package_1
work_package_2
wp_table.visit!
wp_table.expect_work_package_listed(work_package_1)
wp_table.expect_work_package_listed(work_package_2)
display_representation.switch_to_card_layout
end
describe 'opening' do
it 'the full screen view via double click' do
wp_card_view.open_full_screen_by_doubleclick(work_package_1)
expect(page).to have_selector('.work-packages--details--subject',
text: work_package_1.subject)
end
it 'the split screen of the selected WP' do
wp_card_view.select_work_package(work_package_2)
find('#work-packages-details-view-button').click
split_wp = Pages::SplitWorkPackage.new(work_package_2)
split_wp.expect_attributes Subject: work_package_2.subject
find('#work-packages-details-view-button').click
expect(page).to have_no_selector('.work-packages--details')
end
end
end

@ -0,0 +1,53 @@
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# 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-2017 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 docs/COPYRIGHT.rdoc for more details.
#++
require 'spec_helper'
class WorkPackageCards
include Capybara::DSL
include RSpec::Matchers
attr_reader :project
def initialize(project = nil)
@project = project
end
def open_full_screen_by_doubleclick(work_package)
loading_indicator_saveguard
page.driver.browser.action.double_click(card(work_package).native).perform
Pages::FullWorkPackage.new(work_package, project)
end
def select_work_package(work_package)
card(work_package).click
end
def card(work_package)
page.find(".wp-card-#{work_package.id}")
end
end
Loading…
Cancel
Save