Add project switch spec

pull/5853/head
Oliver Günther 7 years ago
parent b54e955e56
commit 3983c44c16
  1. 33
      spec/features/work_packages/project_context_switch_spec.rb
  2. 2
      spec/support/pages/work_packages_table.rb

@ -0,0 +1,33 @@
require 'spec_helper'
describe 'Project context switching spec', js: true do
let(:user) { FactoryGirl.create :admin }
let(:project) { FactoryGirl.create(:project) }
let(:work_package) { FactoryGirl.create(:work_package, project: project) }
let(:wp_table) { Pages::WorkPackagesTable.new }
let(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }
before do
login_as(user)
work_package
end
it 'allows to switch context' do
wp_table.visit!
wp_table.expect_work_package_listed work_package
# Open WP in global selection
wp_table.open_full_screen_by_link work_package
# Follow link to project context
expect(page).to have_selector('.attributes-group.-project-context')
link = find('.attributes-group.-project-context .project-context--switch-link')
expect(link[:href]).to include(project_work_package_path(project.id, work_package.id))
link.click
wp_page.ensure_page_loaded
expect(page).to have_no_selector('.attributes-group.-project-context')
end
end

@ -137,6 +137,8 @@ module Pages
def open_full_screen_by_link(work_package)
row(work_package).click_link(work_package.id)
FullWorkPackage.new(work_package)
end
def row(work_package)

Loading…
Cancel
Save