OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/spec/features/work_packages/project_context_switch_spec.rb

34 lines
1.0 KiB

require 'spec_helper'
describe 'Project context switching spec', js: true do
let(:user) { FactoryBot.create :admin }
let(:project) { FactoryBot.create(:project) }
let(:work_package) { FactoryBot.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