Merge pull request #3572 from ulferts/fix/fullscreen_routes
Rework work package index/show page routespull/3513/head
commit
e991984042
@ -0,0 +1,93 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2015 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-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 doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
|
||||
RSpec.feature 'Work package navigation' do |
||||
let(:user) { FactoryGirl.create(:admin) } |
||||
let(:project) { FactoryGirl.create(:project) } |
||||
let(:work_package) { FactoryGirl.build(:work_package, project: project) } |
||||
|
||||
before do |
||||
work_package.save! |
||||
allow(User).to receive(:current).and_return(user) |
||||
end |
||||
|
||||
scenario 'all different angular based work package views', js: true do |
||||
# deep link global work package index |
||||
global_work_packages = Pages::WorkPackagesTable.new |
||||
global_work_packages.visit! |
||||
|
||||
global_work_packages.expect_work_package_listed(work_package) |
||||
|
||||
# open details pane for work package |
||||
|
||||
split_work_package = global_work_packages.open_split_view(work_package) |
||||
|
||||
split_work_package.expect_subject |
||||
split_work_package.expect_current_path |
||||
|
||||
# open work package full screen |
||||
|
||||
full_work_package = global_work_packages.open_full_screen(work_package) |
||||
|
||||
full_work_package.expect_subject |
||||
full_work_package.expect_current_path |
||||
|
||||
# deep link work package details pane |
||||
|
||||
split_work_package.visit! |
||||
split_work_package.expect_subject |
||||
|
||||
# deep link work package show |
||||
|
||||
full_work_package.visit! |
||||
full_work_package.expect_subject |
||||
|
||||
# deep link project work packages |
||||
|
||||
project_work_packages = Pages::WorkPackagesTable.new(project) |
||||
project_work_packages.visit! |
||||
|
||||
project_work_packages.expect_work_package_listed(work_package) |
||||
|
||||
# open project work package details pane |
||||
|
||||
split_project_work_package = project_work_packages.open_split_view(work_package) |
||||
|
||||
split_project_work_package.expect_subject |
||||
split_project_work_package.expect_current_path |
||||
|
||||
# open work package full screen |
||||
|
||||
full_work_package = project_work_packages.open_full_screen(work_package) |
||||
|
||||
full_work_package.expect_subject |
||||
full_work_package.expect_current_path |
||||
end |
||||
end |
@ -0,0 +1,61 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2015 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-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 doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'support/pages/page' |
||||
|
||||
module Pages |
||||
class FullWorkPackage < Page |
||||
|
||||
attr_reader :work_package |
||||
|
||||
def initialize(work_package) |
||||
@work_package = work_package |
||||
end |
||||
|
||||
def expect_subject |
||||
within(container) do |
||||
expect(page).to have_content(work_package.subject) |
||||
end |
||||
end |
||||
|
||||
def expect_current_path |
||||
current_path = URI.parse(current_url).path |
||||
expect(current_path).to eql path |
||||
end |
||||
|
||||
private |
||||
|
||||
def container |
||||
find('.work-packages--show-view') |
||||
end |
||||
|
||||
def path |
||||
work_package_path(work_package.id, "activity") |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,69 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2015 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-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 doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'support/pages/page' |
||||
|
||||
module Pages |
||||
class SplitWorkPackage < Page |
||||
|
||||
attr_reader :work_package, |
||||
:project |
||||
|
||||
def initialize(work_package, project = nil) |
||||
@work_package = work_package |
||||
@project = project |
||||
end |
||||
|
||||
def expect_subject |
||||
within(details_container) do |
||||
expect(page).to have_content(work_package.subject) |
||||
end |
||||
end |
||||
|
||||
def expect_current_path |
||||
current_path = URI.parse(current_url).path |
||||
expect(current_path).to eql path |
||||
end |
||||
|
||||
private |
||||
|
||||
def details_container |
||||
find('.work-packages--details') |
||||
end |
||||
|
||||
def path |
||||
state = "#{work_package.id}/overview" |
||||
|
||||
if project |
||||
project_work_packages_path(project, "details/#{state}") |
||||
else |
||||
details_work_packages_path(state) |
||||
end |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,74 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2015 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-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 doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'support/pages/page' |
||||
|
||||
module Pages |
||||
class WorkPackagesTable < Page |
||||
|
||||
attr_reader :project |
||||
|
||||
def initialize(project = nil) |
||||
@project = project |
||||
end |
||||
|
||||
def expect_work_package_listed(work_package) |
||||
within(table_container) do |
||||
expect(page).to have_content(work_package.subject) |
||||
end |
||||
end |
||||
|
||||
def open_split_view(work_package) |
||||
split_page = SplitWorkPackage.new(work_package, project) |
||||
|
||||
page.driver.browser.mouse.double_click(row(work_package).native) |
||||
|
||||
split_page |
||||
end |
||||
|
||||
def open_full_screen(work_package) |
||||
row(work_package).find_link(work_package.subject).click |
||||
|
||||
FullWorkPackage.new(work_package) |
||||
end |
||||
|
||||
private |
||||
|
||||
def path |
||||
project ? project_work_packages_path(project) : work_packages_path |
||||
end |
||||
|
||||
def table_container |
||||
find('#content .work-package-table--container') |
||||
end |
||||
|
||||
def row(work_package) |
||||
table_container.find("#work-package-#{work_package.id}") |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue